Welcome! Log In Create A New Profile

Advanced

Re: Why named shared memory zones

Marcus Clyne
September 28, 2009 12:08PM
Igor Sysoev wrote:
> On Mon, Sep 28, 2009 at 06:25:37PM +0300, Marcus Clyne wrote:
>
>
>> Hi,
>>
>> Igor Sysoev wrote:
>>
>>> On Mon, Sep 28, 2009 at 03:28:44PM +0300, Marcus Clyne wrote:
>>>
>>>
>>>
>>>> Hi,
>>>>
>>>> What's the purpose/benefit of naming shared memory zones in config files?
>>>>
>>>>
>>> Its names are used in other directives. For example, you may have
>>> several proxy_cache's.
>>>
>>>
>>>
>> I understand their use in other directives, but I was just wondering why
>> you actually need them in the directives.
>>
>> For example, if you define several proxy caches, then each one would
>> automatically use a different shared memory section. It seems
>> unnecessary to me to use names in the config file, since they'd always
>> be different, and from what I gather, if you use the same name (and tag)
>> for two shared memory sections, then you'll get a conf error (correct me
>> if I'm wrong, though).
>>
>> I feel that having the config like
>>
>> proxy_cache_path /data/nginx/cache levels=1:2 10m;
>>
>> or even
>>
>> proxy_cache_path /data/nginx/cache 1:2 10m;
>>
>> would be much neater than
>>
>> proxy_cache_path /data/nginx/cache levels=1:2 key_zone=one:10m;
>>
>> And overall wouldn't lose any information that couldn't be generated in
>> the background.
>>
>
> No, suppose the following:
>
> proxy_cache_path /data/nginx/cache1 levels=1:2 keys_zone=ONE:10m;
> proxy_cache_path /data/nginx/cache2 levels=1:2 keys_zone=TWO:10m;
>
> location / {
> proxy_cache ONE;
> }
>
> location /one/ {
> proxy_cache ONE;
> }
>
> location /two/ {
> proxy_cache TWO;
> }
>
>
I see.

What about offering an alternative, clearer syntax? e.g.:

proxy_cache_path /data/nginx/cache1 1:2 ONE 10m;

>>> The second reason is Win32 uses named shared memory mapping.
>>> However, it's lamost impossible to use shared memory in Win32 due to
>>> Vista ASLR.
>>>
>>>
>> If you need to have named sections, it would be easy enough to generate
>> them sequentially (e.g. ngx_shms1, ngx_shms2...) whilst reading the
>> config file.
>>
>
> The zone name is also logged when zone is out of space.
>
Ok, that's useful.

Thanks,

Marcus.
Subject Author Posted

Why named shared memory zones

Marcus Clyne September 28, 2009 08:32AM

Re: Why named shared memory zones

Igor Sysoev September 28, 2009 08:52AM

Re: Why named shared memory zones

Marcus Clyne September 28, 2009 11:34AM

Re: Why named shared memory zones

Igor Sysoev September 28, 2009 11:44AM

Re: Why named shared memory zones

Marcus Clyne September 28, 2009 12:08PM

Re: Why named shared memory zones

Igor Sysoev September 28, 2009 12:20PM

Re: Why named shared memory zones

Marcus Clyne September 28, 2009 01:00PM

Re: Why named shared memory zones

Igor Sysoev September 28, 2009 03:36PM

Re: Why named shared memory zones

Marcus Clyne September 28, 2009 04:48PM

Re: Why named shared memory zones

Maxim Dounin September 28, 2009 07:32PM

Re: Why named shared memory zones

Marcus Clyne September 28, 2009 08:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 99
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