RE: Keep-alive and websocket connections

2014-02-07 Thread Lukas Tribus
Hi,


 Thanks for your suggestion, Lukas.

 For my own understanding, are you saying that there is no difference
 between having http-keep-alive and having http-server-close to a
 backend server once websocket connection to that server is establish,
 and both settings allow for establishing websocket connection
 perfectly.

Yes, thats what I'm saying.



 So is there any advantage of having http-keep-alive to a websocket
 backend?

It doesn't make any difference if this is a pure websocket backend, because
the session is always upgraded to tcp mode after the first transaction.

If the traffic is mixed, then http-keep-alive has obvious advantages for
the non-websocket traffic.


Regards,

Lukas 


RE: Keep-alive and websocket connections

2014-02-06 Thread Lukas Tribus
Hi,


 In the latest HAProxy 1.5 release (dev22), it is indicated that
 keep-alive is now enabled by default for both client and server sides.
 I have some questions regarding its use in the following scenario.

 I use HAProxy in front of an array of servers: one nginx for
 delivering static files, and the others being application servers. One
 of the application servers exclusively deals with websocket (or in the
 event of ws failure, switching to streaming) connections. Currently, I
 am using 'http-server-close' by default for all servers, but I think
 it'd be better to switch to 'http-keep-alive' for the nginx and keep
 'http-server-close' for the websockets server.

You can just default to http-keep-alive everywhere.

HAProxy recognizes the upgrade headers and switches to TCP mode
automatically [1].

Recognizing the upgrade in a HTTP transaction is possible with all modes
expect tcp mode (of course) and (the pre-dev22 default) http tunnel mode [2].



 Is this a correct setup? Thanks.

It is, but you may as well simplify it with http-keep-alive on all sections.

I don't see any advantage by configuring http-server-close on the websocket
backend.

Of course you should test this, before putting it in production.



Regards,

Lukas



[1] http://blog.exceliance.fr/2012/11/07/websockets-load-balancing-with-haproxy/
[2] http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4  
  


Re: Keep-alive and websocket connections

2014-02-06 Thread Chris Yang
Thanks for your suggestion, Lukas.

For my own understanding, are you saying that there is no difference
between having http-keep-alive and having http-server-close to a
backend server once websocket connection to that server is establish,
and both settings allow for establishing websocket connection
perfectly.

So is there any advantage of having http-keep-alive to a websocket backend?


On Thu, Feb 6, 2014 at 4:56 PM, Lukas Tribus luky...@hotmail.com wrote:
 Hi,


 In the latest HAProxy 1.5 release (dev22), it is indicated that
 keep-alive is now enabled by default for both client and server sides.
 I have some questions regarding its use in the following scenario.

 I use HAProxy in front of an array of servers: one nginx for
 delivering static files, and the others being application servers. One
 of the application servers exclusively deals with websocket (or in the
 event of ws failure, switching to streaming) connections. Currently, I
 am using 'http-server-close' by default for all servers, but I think
 it'd be better to switch to 'http-keep-alive' for the nginx and keep
 'http-server-close' for the websockets server.

 You can just default to http-keep-alive everywhere.

 HAProxy recognizes the upgrade headers and switches to TCP mode
 automatically [1].

 Recognizing the upgrade in a HTTP transaction is possible with all modes
 expect tcp mode (of course) and (the pre-dev22 default) http tunnel mode [2].



 Is this a correct setup? Thanks.

 It is, but you may as well simplify it with http-keep-alive on all sections.

 I don't see any advantage by configuring http-server-close on the websocket
 backend.

 Of course you should test this, before putting it in production.



 Regards,

 Lukas



 [1] 
 http://blog.exceliance.fr/2012/11/07/websockets-load-balancing-with-haproxy/
 [2] http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#4