1、? ? SpeedyCloud ? ? ? ? Nginx?HAProxy?LVS? Load Balancer Backend Server Backend Server Backend Server Backend Server Backend Server Load Balancer ? HAProxy Nginx LVS?ip_vs? HAProxy?Nginx 7? ? ?TCP?HTTP? ?HTTP Keepalive? TIME_WAIT TCP?TIME_WAIT ?TCP? cat /proc/sys/net/ipv4/ip_local_port_range Linux?3
2、2768 61000 = 28232? cat /proc/sys/net/ipv4/tcp_fi n_timeout Linux?60 (61000 - 32768) / 60 = 470 TCP?TIME_WAIT ? echo 30 /proc/sys/net/ipv4/tcp_fi n_timeout echo 15000 65000 /proc/sys/net/ipv4/ ip_local_port_range ? echo 1 /proc/sys/net/ipv4/tcp_tw_recycle echo 1 /proc/sys/net/ipv4/tcp_tw_reuse LVS 4
3、? ip_vs? ip_vs? NAT TUN (IP Tunneling) DR ?MAC? LVS ?TCP?TIME_WAIT? ? TUN?DR? ? NAT? TUN?DR?IP? ? Load Balancer Backend Server Backend Server Backend Server DNS User ?DNS?A? ?A?IP? CDN? ?GSLB? CDN? ? ? ?Hash? ? ?IO ? ?APM? ? ?Web Server? ? ?CAP? HBase? CP?Cassandra?AP ?IO? ? ? recv()?send()?read()?
4、write()? ? ?Context Switch? ? IO?IO Multiplexing? ? ? ? ?CPU? ? ?accept ?Worker? ? ? CPU?Context Switch? Linux 3.9 SO_REUSEPORT ? Kernel? Server? ?IO?IO? ?IO? Server? ?MySQL?Redis? ? ?MySQL?Redis? CPU? ?TIME_WAIT? Server? ?MySQL?Redis?Memcached?IO? ? MySQL?MySQL? ? Redis?Memcached?IO? ?Server?CPU? ? ? ?100%?SLA ? ? IDC? ? ? ?Bug ? IDC?“?” ? ? ? ? ? ? ? ?Bug ? ?API? ? ? ?HAProxy?Nginx? ZooKeeper?etcd? ? ? ? ? ? ?