Does nginx support multi-thread?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Does nginx support multi-thread?

Chieu
I found that nginx can just work in multi-process. I just write a cache and found the cache can not be shared in multi-process model, each work process just copy the cache and manage the cache self. So I want a global cache .Does any way I can share a cache in global?
Reply | Threaded
Open this post in threaded view
|

Re: Does nginx support multi-thread?

Maxim Dounin
Hello!

On Mon, Jun 01, 2009 at 12:54:53PM +0800, Chieu wrote:

> I found that nginx can just work in multi-process. I just write a cache and
> found the cache can not be shared in multi-process model, each work process
> just copy the cache and manage the cache self. So I want a global cache
> .Does any way I can share a cache in global?

For inter-process data nginx typically uses shared memory zones
(implemented via mmap() or shmget() depending on OS capabilites).  
Take a look at ngx_http_limit_zone_module for coding examples.

Maxim Dounin

Reply | Threaded
Open this post in threaded view
|

Re: Does nginx support multi-thread?

Chieu
thanks and I will try it.

2009/6/1 Maxim Dounin <[hidden email]>
Hello!

On Mon, Jun 01, 2009 at 12:54:53PM +0800, Chieu wrote:

> I found that nginx can just work in multi-process. I just write a cache and
> found the cache can not be shared in multi-process model, each work process
> just copy the cache and manage the cache self. So I want a global cache
> .Does any way I can share a cache in global?

For inter-process data nginx typically uses shared memory zones
(implemented via mmap() or shmget() depending on OS capabilites).
Take a look at ngx_http_limit_zone_module for coding examples.

Maxim Dounin