connection pool

Manlio Perillo manlio_perillo at libero.it
Mon Nov 19 16:24:32 MSK 2007


Aleksandar Lazic ha scritto:
> On Mon 19.11.2007 11:11, Manlio Perillo wrote:
>> Aleksandar Lazic ha scritto:
>>> On Mon 19.11.2007 09:59, Igor Sysoev wrote:
>>>> On Sun, Nov 18, 2007 at 04:00:37PM +0100, Aleksandar Lazic wrote:
>>>>
>>>>> where is the best place to add a connection pool, for proxy
>>>>> backends into nginx?
>>>>
>>>> A connection pool by itself could be easy added.
>>> Ok, I think in src/core/ngx_connection.c and a queue algo, right?
>>
>> I have added a queue implementation in mod_wsgi:
>> http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/src/ngx_queue.h
>> http://hg.mperillo.ath.cx/nginx/mod_wsgi/file/tip/src/ngx_queue.c
> 
> nice ;-)
> 
> Do you use it for connections or something else?
> 

I use it for "manual" memory handling of Python objects.
Each time the WSGI application iterator yields a string and writing this 
string to the clients returns NGX_EAGAIN, I push the object in the queue.

When writing to the client returns NGX_OK, I pop and deallocate all the 
objects in the queue.

So far, this is the best solution I have found for this problem :).

> Do you plan to add shared mem handling so that the queue/pool can be
> shared between the forked nginx-workers?!
> 

No, I do not need this.

> Due the fact that I haven't take a look, when will be the queue
> processed, is there a scheduler in nginx?!
> 

No, the queue is just a data structure.
Not sure to understand.

> Cheers
> 
> Aleks
> 
> 


Regards  Manlio Perillo





More information about the nginx mailing list