Hello!
On Mon, Aug 15, 2016 at 5:24 PM, Alexis Okuwa wrote:
> Wanted to know i someone can go into depth about the ngx.shared so i know
> what its used for but the way the docs talk about its to be careful because
> its in the global space so wanted to know how the locking for this sort of
> thing works. Do reads block reads or do they just block writes does it block
> everything with in one shared space or just the element of the shared space.
> Would love to use something like this for some IPC like stuff but not sure
> how it works.
>
It's a per-zone global lock. Readers block writers and other readers
atm. It's usually not a problem since there is usually NO syscalls or
I/O involved while holding the lock. (All most all the standard nginx
modules like ngx_limit_zone and ngx_limit_req use the same lock for
their shm zones).
Regards,
-agentzh