wsky / top-link

embedded duplex multi-channel endpoint and connection management for c#/java/...
6 stars 1 forks source link

about server-side keepalive #59

Closed wsky closed 10 years ago

wsky commented 11 years ago

http://www.serverphorums.com/read.php?10,197670

Hello,

I have a problem with haproxy configuration. First let me explain my scenario. I have two hardware servers:

Server A runs a HAPROXY 1.4 and is accessible by HTTP clients
Server B runs two instances of HTTP backend software (two sockets) and is only accessible by HAPROXY

When now "thousands" of "crazy" clients access HAPROXY (500 mixed non keep-alive and keep-alive requests/second), all requests are forwarded 1:1 to my backend. If I have on Server A 100.000 sockets in TIME_WAIT, the same amount of sockets are also in the same state on Server B. What I need is some kind of rewirte / multiplexing / pooling mechanizm to achive the following:

HAPROXY keeps 100 keep-alive connections to the backend and uses them as a pool. No new connections are opened. When now a client will access the HAPROXY its request should be distributed to one of the allready existing connections without opening a new connection to the backend.

The connections are not stateful, so a repeating request does not have to return to the same connection. I am unexperienced with HAPROXY and looking just for a solution. Is this possible? Can someone provide my an example configuration?

Than you very very much,

Maciej

Haproxy design http://haproxy.1wt.eu/#desc

how about 4layer loadbalance

http://serverfault.com/questions/483971/why-are-layer-7-tcp-load-balancers-e-g-haproxy-so-much-simpler-to-setup-than

With LVS, your network traffic essentially goes from the client directly to your backend server. Having a third host (semi-transparently) involved here is not a normal network configuration, which is why it's fairly difficult to implement.

With haproxy, your network traffic goes from the client to haproxy, then haproxy to the server. As far as the server is concerned, haproxy is just another client. This is a normal networking setup, so there's no network layer complexity to setup (though there is Layer 7 complexity, such as X-Forwarded-For headers). It also means that your haproxy machine is a SPOF, and needs to be able to handle the total traffic to your website.