Skip to content

Commit 1d85ae9

Browse files
committed
add documentation on byte slice caching
1 parent 04e89a7 commit 1d85ae9

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

docs/getting_started.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ running as a Container or as a Systemd service.
3232
| `DNS_RESOLVERS` | No | | | DNS resolvers (separated by single spaces) to configure NGINX with |
3333
| `PROXY_CACHE_MAX_SIZE` | No | | `10g` | Limits cache size |
3434
| `PROXY_CACHE_INACTIVE` | No | | `60m` | Cached data that are not accessed during the time specified by the parameter get removed from the cache regardless of their freshness
35-
| `PROXY_CACHE_SLICE_SIZE` | No | | `1m` | For requests with a `Range` header included, determines the size of the chunks in which the file is fetched. Values much smaller than the requests can lead to inefficiencies due to reading and writing many files | |
35+
| `PROXY_CACHE_SLICE_SIZE` | No | | `1m` | For requests with a `Range` header included, determines the size of the chunks in which the file is fetched. Values much smaller than the requests can lead to inefficiencies due to reading and writing many files. See [below for more details](#byte-range-requests-and-caching) | |
3636
| `PROXY_CACHE_VALID_OK` | No | | `1h` | Sets caching time for response code 200 and 302 |
3737
| `PROXY_CACHE_VALID_NOTFOUND` | No | | `1m` | Sets caching time for response code 404 |
3838
| `PROXY_CACHE_VALID_FORBIDDEN` | No | | `30s` | Sets caching time for response code 403 |
@@ -113,6 +113,17 @@ S3 bucket in a subfolder on an ALB. For example, if you wanted to expose the
113113
root of a bucket under the path "www.mysite.com/somepath", you would set this
114114
variable to "/somepath".
115115

116+
## Byte-Range Requests and Caching
117+
The gateway caches [byte-range](https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests) (requests sent with a `Range` header) requests differently than normal requests.
118+
119+
The gateway is configured to cache such requests in chunks of size `PROXY_CACHE_SLICE_SIZE`. If you don't provide this configuration value it will default to 1 megabyte.
120+
121+
This means that if you request 2.5 megabytes of a 1 gigabyte file, the gateway will cache 3 megabytes and nothing else.
122+
123+
Setting your slice size too small can have performance impacts since NGINX performs a subrequest for each slice. For more details see the [official reference](http://nginx.org/en/docs/http/ngx_http_slice_module.html).
124+
125+
You may make byte-range requests and normal requests for the same file and NGINX will automatically handle them differently. The caches for file chunks and normal file requests are separate on disk.
126+
116127
## Running as a Systemd Service
117128

118129
An [install script](/standalone_ubuntu_oss_install.sh) for the gateway shows

0 commit comments

Comments
 (0)