[PATCH] memcached_force_ranges for memcached upstream

Martin Mlynář nexus at smoula.net
Tue Apr 21 13:45:12 UTC 2015


Hello,

Dne 2015-04-21 15:39, Roman Arutyunyan napsal:
> Hello!
> 
> On Tue, Apr 21, 2015 at 01:37:52PM +0200, Martin Mlynář wrote:
>> # HG changeset patch
>> # User Martin Mlynář <nexus at smoula.net>
>> # Date 1429613281 -7200
>> #      Tue Apr 21 12:48:01 2015 +0200
>> # Node ID 4cb149154501fc638596ab51031f8b3b64da2a7f
>> # Parent  1bdfceda86a99a4dc99934181d2f9e2632003ca8
>> memcached_force_ranges for memcached upstream
>> 
>> Allow option force_ranges for memcached upstream
>> 
>> diff -r 1bdfceda86a9 -r 4cb149154501 
>> src/http/modules/ngx_http_memcached_module.c
>> --- a/src/http/modules/ngx_http_memcached_module.c	Mon Apr 20 17:36:51 
>> 2015 +0300
>> +++ b/src/http/modules/ngx_http_memcached_module.c	Tue Apr 21 12:48:01 
>> 2015 +0200
>> @@ -95,6 +95,13 @@
>>        offsetof(ngx_http_memcached_loc_conf_t, upstream.read_timeout),
>>        NULL },
>> 
>> +    { ngx_string("memcached_force_ranges"),
>> +      
>> NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
>> +      ngx_conf_set_flag_slot,
>> +      NGX_HTTP_LOC_CONF_OFFSET,
>> +      offsetof(ngx_http_memcached_loc_conf_t, upstream.force_ranges),
>> +      NULL },
>> +
>>      { ngx_string("memcached_next_upstream"),
>>        
>> NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
>>        ngx_conf_set_bitmask_slot,
>> @@ -604,6 +611,7 @@
>>      conf->upstream.next_upstream_timeout = NGX_CONF_UNSET_MSEC;
>> 
>>      conf->upstream.buffer_size = NGX_CONF_UNSET_SIZE;
>> +    conf->upstream.force_ranges = NGX_CONF_UNSET;
>> 
>>      /* the hardcoded values */
>>      conf->upstream.cyclic_temp_file = 0;
>> @@ -647,6 +655,9 @@
>>      ngx_conf_merge_msec_value(conf->upstream.read_timeout,
>>                                prev->upstream.read_timeout, 60000);
>> 
>> +    ngx_conf_merge_value(conf->upstream.force_ranges,
>> +                              prev->upstream.force_ranges, 0);
>> +
>>      ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout,
>>                                prev->upstream.next_upstream_timeout, 
>> 0);
> 
> It's better to enable ranges in the memcached module without any 
> directives.
> You can find such "hardcoded values" in 
> ngx_http_memcached_create_loc_conf().

I've tried to be consistent with other modules which does it this way 
like:

ngx_http_proxy_module.c
ngx_http_scgi_module.c
ngx_http_uwsgi_module.c
ngx_http_fastcgi_module.c

Is there any reason why memcached should be an exception? Or am I 
getting something wrong?

Thank you for your reply.

--
Martin

> 
> --
> Arutyunyan Roman
> 
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel



More information about the nginx-devel mailing list