Forum: NGINX http Keepalive implementation

2974d09ac2541e892966b762aad84943?d=identicon&s=25 prkumar (Guest)
on 2014-06-19 07:25
(Received via mailing list)
I was going through NGINX source code to implement keepalive for nginx
zeromq plugin that I have developed.
I have been inspired by ngx_http_upstream_keepalive_module. Was
why nginx uses a kind of two linkedlist based stack implementation to
implement keepalive connection pool. Why not use  typical linkedlist
queue implementation.
Kindly refer to ngx_http_upstream_keepalive_module.c

I used exactly like this without wondering why, now I kind of want to
the reason.

Posted at Nginx Forum:,251033,251033#msg-251033
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2014-06-19 15:38
(Received via mailing list)

On Thu, Jun 19, 2014 at 01:24:53AM -0400, prkumar wrote:

> I used exactly like this without wondering why, now I kind of want to know
> the reason.

The upstream keepalive module uses the "cache" queue as an LRU
queue, to be able to drop unused connections if there isn't enough
room.  Hence it basically uses it as a stack while storing /
retrieving connections.

The "free" queue is used to avoid runtime allocations.

Maxim Dounin
Ba5061f1803f9ab0cfc3d53366d49546?d=identicon&s=25 Lord Nynex (Guest)
on 2014-06-19 23:33
(Received via mailing list)

It seems ZMQ and Nginx keep coming up in conversations lately. There
to be differing opinions on it's performance/feasibility in production.
you plan to open source your code? I'd be curious to look at it.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.