Hi,

On Wed, Mar 07, 2012 at 01:49:25PM +0700, Bolang wrote:
> Hi all,
> First, maybe the subject don't match my question. That is the best 
> sentence that i can give (sorry for my bad english).
> 
> For my hobby project, i build a socket & http server with python & gevent.
> And i just realized that python's GIL make it can't work nicely with 
> multithread process & multicore processor.
> For http server, i can simply use nginx to balance the load between worker.
> The problem is for socket server. With haproxy, if some  client X 
> connecting to worker A, then client X send some packets. Will all 
> packets that sent by client X to my sockets server will be automagically 
> received by worker A?

Just to be clear on one point, haproxy does not manipulate *packets* but
streams, as it works over TCP (just like http does). So your clients will
not send packets, they will establish a TCP connection to a host (eg:
haproxy) and this host will establish a TCP connection to a server.
Whatever is exchanged in one connection will be reflected on the other
one. So if your client X sends anything in the connection, the server will
receive it. What is not granted is that if the client breaks the connection
and establishes a new one, you'd like haproxy to reconnect to the same
server. This is where persistence/stickiness may become useful (eg: cookie
insertion). But maybe your application does not need that.

The best you could do would be to test :-)

Regards,
Willy


Reply via email to