Connection pool

Hi,

where is the best place to add a connection pool, for proxy backends
into nginx?

cheers

Aleks

On Sun, Nov 18, 2007 at 04:00:37PM +0100, Aleksandar L. 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.
The problem is backend’s chunked HTTP/1.1 responses.

On Mon 19.11.2007 09:59, Igor S. wrote:

On Sun, Nov 18, 2007 at 04:00:37PM +0100, Aleksandar L. 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?

The problem is backend’s chunked HTTP/1.1 responses.

Step by step :wink:
1.) add connection pools
2.) keepalive vor backends, due the fact that in the frontend this is
allready there and pass the chunked response 1:1 to client, like a
gateway :wink:
3.) plan how to add the other HTTP/1.1 feature to the proxy module,
which is very tricky for some parts, imho.

Cheers

Aleks

Aleksandar L. ha scritto:

On Mon 19.11.2007 09:59, Igor S. wrote:

On Sun, Nov 18, 2007 at 04:00:37PM +0100, Aleksandar L. 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

It uses an array.

Manlio P.

On Mon 19.11.2007 11:11, Manlio P. wrote:

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 :wink:

Do you use it for connections or something else?

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

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

Cheers

Aleks

Aleksandar L. ha scritto:

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 :wink:

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 P.