I'm seeing an very odd and consistent 10 second time to negotiate a websocket connection when using HAproxy, but only when I have more than one server in the rotation.

Going directly to the server from the browser, I connect immediately.
With only one server in the haproxy backend, I connect immediately in the browser.

When I have two servers in the backend haproxy makes connections to both websocket backends and exactly 10 seconds after the client had negotiated the connection to haproxy the client considers itself connected to socket.io application. I added a stick-table based on src thinking it might help which didn't change the behavior.

I tested in haproxy 1.4 (whatever the latest 12.04 LTS is shipping) and the June 1st snapshot of 1.5. Same behavior in both cases. haproxy server is a 64bit m1.small instance on EC2.

I suspect that there is something off if in my cobbled together config from various blogs and serverfault answers. I can also get some proper tcpdump later tonight too.

Ramin

# PUPPETHEADER: This file is owned by Puppet.
# vim:syntax=haproxy

#---------------------------------------------------------------------
# global settings, start

global
  daemon
  gid 0
  maxconn 4000
  pidfile /var/run/haproxy.pid
  stats socket /var/lib/haproxy/stats
  uid 0
  ulimit-n 8192
  log 127.0.0.1 local0 notice

# global settings, end
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# default settings, start

defaults
  mode http
  log global
  option httplog
  option  http-server-close
  option  dontlognull
  option  redispatch
  option  contstats
  retries 3
  backlog 10000
  timeout client          25s
  timeout connect          5s
  timeout server          25s
#  timeout tunnel available in ALOHA 5.5 or HAProxy 1.5-dev10 and higher
#  timeout tunnel        3600s
  timeout http-keep-alive  1s
  timeout http-request    15s
  timeout queue           30s
  timeout tarpit          60s
  default-server inter 3s rise 2 fall 3
  option forwardfor

# default settings, end
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# frontend settings, start of ws

frontend ws
  bind *:80
  default_backend ws

# frontend settings, end of ws
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# backend settings, start of ws

backend ws
  balance roundrobin
  stick store-request src
  stick-table type ip size 200k expire 20m
  server fe01 fe01.stage.usw2.example.com:8000 maxconn 1000 check
  server fe03 fe03.stage.usw2.example.com:8000 maxconn 1000 check

# backend settings, end of ws
#---------------------------------------------------------------------

Reply via email to