Ngx.shared.dict - locking mechanism?

Hi guys,

I was wondering what happens when multiple workers access the
ngx.shared.dict in the http lua module ? Are there conflicts/locking
that
could potentially impact performance of nginx? We are talking about 32
workers in my use case.

Thank you in advance

Posted at Nginx Forum:

Hello!

On Wed, Nov 12, 2014 at 3:01 PM, josephlim wrote:

I was wondering what happens when multiple workers access the
ngx.shared.dict in the http lua module ? Are there conflicts/locking that
could potentially impact performance of nginx? We are talking about 32
workers in my use case.

It uses the lock mechanism provided by the nginx core to ensure
atomicity and consistency. Basically it uses spinlocks to try first,
failing that, falling back to semaphores.

Regards,
-agentzh