Score:0

Does Nginx combine all cached slices to make one file as in backend?

br flag

I am using the Nginx slice module to fill the cache for big files as shown here https://docs.nginx.com/nginx/admin-guide/content-cache/content-caching/

Here is a sample configuration

location / {
    slice             1m;
    proxy_cache       cache;
    proxy_cache_key   $uri$is_args$args$slice_range;
    proxy_set_header  Range $slice_range;
    proxy_cache_valid 200 206 1h;
    proxy_pass        http://localhost:8000;
}

The article says:

NGINX makes it possible to cache such range requests and gradually fill the cache with the Cache Slice module, which divides files into smaller “slices”. Each range request chooses particular slices that cover the requested range and, if this range is still not cached, put it into the cache. All other requests for these slices take the data from the cache.

My question is, what happens when all the byte ranges of a file have been received from the backend and Nginx has cached all the slices. Does the Nginx still serve the requests using multiple slices or does it join all the slices to make a big file (same as the file in the backend) and then it served the requests from the big file?

As I can see that the cache key is proxy_cache_key $uri$is_args$args$slice_range;. So, does it mean that even though Nginx has got the full content but it will still keep those slices separate and serve the byte-range requests using the slices?

Thanks

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.