分别用两台独立IP的机器对LVS做大量的长连接访问,如下为 LVS 的连接分布情况.
zhangbo3@rise-rs-135:/usr/local/nginx/conf$ sudo ipvsadm -ln IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 58.215.x.x:80 rr -> 10.20.165.173:80 Masq 1 3332 14797 -> 10.20.165.174:80 Masq 1 3198 14931总结:
RR算法,同一个Src IP也会定向到同一个LVS
初始情况下,普通配置时候,单台机器压测数据
Concurrency Level: 10000 Time taken for tests: 5.530 seconds Complete requests: 50000 Failed requests: 0 Write errors: 0 Keep-Alive requests: 49836 Total transferred: 42149180 bytes HTML transferred: 30600000 bytes Requests per second: 9040.98 [#/sec] (mean) Time per request: 1106.074 [ms] (mean) Time per request: 0.111 [ms] (mean, across all concurrent requests) Transfer rate: 7442.78 [Kbytes/sec] received向 LVS 中添加1W个端口映射后的压测数据
Concurrency Level: 10000 Time taken for tests: 5.588 seconds Complete requests: 50000 Failed requests: 0 Write errors: 0 Keep-Alive requests: 49974 Total transferred: 42149870 bytes HTML transferred: 30600000 bytes Requests per second: 8948.49 [#/sec] (mean) Time per request: 1117.506 [ms] (mean) Time per request: 0.112 [ms] (mean, across all concurrent requests) Transfer rate: 7366.76 [Kbytes/sec] received总结:
添加上网条端口映射后,对系统性能无影响.
keepalived双机备份的情况下,打开LVS的连接状态后,查看同步状态发现没同步ESTABLISHED状态,SYNC_RCV,TIME_WAIT状态均已同步,握手和关闭的状态都会同步,但是ESTABLISHED的状态要发送一定的数据包才同步,默认数据包是3个,每秒50个包的频率.
配置导出导入测试 sudo ipvsadm -Sn 可导出当前配置文章属原创,转载请注明出处 联系作者: Email:zhangbolinux@sina.com QQ:513364476