haproxy服务器丢弃了很多连接

时间:2014-04-02 19:32:52

标签: linux high-availability haproxy

我正在运行一个haproxy服务器,它服务于特定的流量,并且客户继续报告从他们的终端丢弃的连接。不确定是什么导致了这一点。

我的sysctl.conf如下所示。

net.ipv4.tcp_tw_reuse = 1
net.ipv4.ip_local_port_range = 1024 65023
net.ipv4.tcp_max_syn_backlog = 10240
net.ipv4.tcp_max_tw_buckets = 400000
net.ipv4.tcp_max_orphans = 60000
net.ipv4.tcp_synack_retries = 3
net.core.somaxconn = 10000

ulimit -n也返回65535。

我的/etc/haproxy/haproxy.cfg如下所示

global
  maxconn 50000 # Max simultaneous connections from an upstream server
  spread-checks 5 # Distribute health checks with some randomness
  log /dev/log  local0
  log /dev/log  local1 notice
  chroot /var/lib/haproxy
  user haproxy
  group haproxy
  daemon


defaults # Apply to all services
  log global
  mode http
  option httplog
  maxconn 25000
  balance roundrobin
  option abortonclose # abort request if client closes output channel while waiting
  option httpclose # add "Connection:close" header if it is missing
  option forwardfor # insert x-forwarded-for header 
  option redispatch # any server can handle any session
  retries 3
  timeout client 60s
  timeout connect 30s
  timeout server 30s
  timeout check 30s
  timeout http-request 6s
  stats enable
  stats uri /stats # Real path redacted
  stats realm Haproxy\ Statistics
  stats auth root:*******! # Real credentials redacted
  #monitor-uri /monitor # Returns 200 if we're up; real path redacted
  errorfile 503 /etc/haproxy/errors/503.http

frontend incoming *:80
    reqadd X-Forwarded-Proto:\ http
    monitor-uri /haproxy_test
    default_backend my_app


backend my_app
    balance roundrobin
    option httpchk /api/health
    server my_server_A 0.1.2.3:80 check inter 5000 fastinter 1000 fall 3 rise 1 weight 1 maxconn 5000
    server my_server_B 4.5.6.7:80 check inter 5000 fastinter 1000 fall 3 rise 1 weight 1   maxconn 5000

可能导致连接从另一方丢失的设置是什么。大多数报道的辍学者来自爱尔兰都柏林,服务器位于美国西部,如果这有帮助的话。

0 个答案:

没有答案