Welcome! Log In Create A New Profile

Advanced

Re: Slice module

February 23, 2016 03:44AM
Hi Roman,

> On 18 Feb 2016, at 18:14, Roman Arutyunyan <arut@nginx.com> wrote:
>
> Hi Martijn,
>
> On Wed, Feb 17, 2016 at 09:20:37AM +0000, Martijn Berkvens wrote:
>> Hi,
>>
>> First off, thank you for the work on the slice module. We’re currently using a lua implementation to achieve something similar but this has its shortcomings and we would prefer to use this module.
>>
>> We’ve been testing this module and when using range requests it works as expected, but when doing normal requests (without a request range) the module still slices the content when the configured slice size is met resulting in corrupt data as it will only serve out the configured slice size and not the entire requested file.
>
> Module slices all requests, whether they have Range header or not.
> This lets nginx reuse already cached slices.

This explains the behaviour I’m seeing then and there actually is no issue, it was my miss interpretation of how to implement it. I was doing something like this:

set $cachekey "$scheme$http_host$uri$is_args$args”;

if ($http_range)
{
set $cachekey “$cachekey $slice_range”;
}

slice 1m;
proxy_cache_key $cachekey;

After removing the unneeded if clause and just adding $slice_range to the cachekey for all requests everything worked as expected. Great to see that nginx reuses all slices to assemble a full file if requested.

Thanks again for your work and apologies for the confusion.

Martijn


>
> Please describe in detail what exactly is corrupted and show your
> configuration. Nothing should be corrupted when using the slice module, the
> entire file should be assembled of slices and sent to client once you
> configured nginx correctly.
>
>> We run into these issues because a server or location configuration within nginx would service both normal requests as range requests and we have files exceeding the slice size in both cases.
>>
>> Ideally the slice module would only do its magic when a request contains $http_range. We’ve tried creating a map which would set the slice size to 0 (to disable slicing) when no $http_range is present, but unfortunately the slice directive currently does not support variables.
>>
>> For our use case it would most likely be sufficient to add variable support to the slice directive. It is understood and acceptable that we would have duplicate cached content in cases where we have both the sliced versions of the file as the entire file.
>
> You can have that by adding another location for files cached as a whole
> and rewriting your request to that location when $http_range is empty.
>
> --
> Roman Arutyunyan
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Slice module

Roman Arutyunyan 4632 September 29, 2015 12:02PM

Re: Slice module

Anatoli Marinov 1517 October 02, 2015 02:16AM

Re: Slice module

Woon Wai Keen 849 October 05, 2015 03:24PM

Re: Slice module

Roman Arutyunyan 935 October 05, 2015 05:44PM

Re: Slice module

MartijnB 727 February 17, 2016 04:22AM

Re: Slice module

Roman Arutyunyan 804 February 18, 2016 12:16PM

Re: Slice module

MartijnB 931 February 23, 2016 03:44AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 303
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready