# go-tcp-rps **Repository Path**: jinq0123/go-tcp-rps ## Basic Information - **Project Name**: go-tcp-rps - **Description**: Test golang tcp rps - **Primary Language**: Go - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-05-09 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # go-tcp-rps Test golang tcp rps 测试 golang tcp 最大 rps (Request Per Second, 每秒请求数) 2个虚拟机, 一个运行 server, 一个运行 client. 测试结果: ``` [jinqing@host-192-168-150-75 client]$ ./client --address 192.168.23.194:9999 -c 10 TPS: 751019 / 15.000000 = 50067.933333 (t/s) [jinqing@host-192-168-150-75 client]$ ./client --address 192.168.23.194:9999 -c 100 TPS: 1317500 / 15.000000 = 87833.333333 (t/s) [jinqing@host-192-168-150-75 client]$ ./client --address 192.168.23.194:9999 -c 500 TPS: 1499759 / 15.000000 = 99983.933333 (t/s) [jinqing@host-192-168-150-75 client]$ ./client --address 192.168.23.194:9999 -c 1000 TPS: 1542191 / 15.000000 = 102812.733333 (t/s) [jinqing@host-192-168-150-75 client]$ ./client --address 192.168.23.194:9999 -c 2000 Client connect error ! dial tcp 192.168.23.194:9999: socket: too many open files Client connect error ! dial tcp 192.168.23.194:9999: socket: too many open files ``` ``` [root@host-192-168-150-75 client]# ulimit -n 10000 [root@host-192-168-150-75 client]# ./client --address 192.168.23.194:9999 -c 2000 TPS: 1496850 / 15.000000 = 99790.000000 (t/s) [root@host-192-168-150-75 client]# ./client --address 192.168.23.194:9999 -c 3000 TPS: 1464496 / 15.000000 = 97633.066667 (t/s) [root@host-192-168-150-75 client]# ./client --address 192.168.23.194:9999 -c 3000 TPS: 1574086 / 15.000000 = 104939.066667 (t/s) [root@host-192-168-150-75 client]# ./client --address 192.168.23.194:9999 -c 4000 TPS: 1427087 / 15.000000 = 95139.133333 (t/s) [root@host-192-168-150-75 client]# ./client --address 192.168.23.194:9999 -c 5000 TPS: 1391546 / 15.000000 = 92769.733333 (t/s) ``` CPU较空闲,应该是网卡 io 限制。 代码参考了:https://studygolang.com/articles/18115