硬件环境
$ lscpu
Architecture: x86_64
CPU 运行模式: 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
每个核的线程数:2
每个座的核数: 4
Socket(s): 1
NUMA 节点: 1
厂商 ID: GenuineIntel
CPU 系列: 6
型号: 58
Model name: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz
步进: 9
CPU MHz: 2021.406
CPU max MHz: 3900.0000
CPU min MHz: 1600.0000
BogoMIPS: 6784.72
虚拟化: VT-x
L1d 缓存: 32K
L1i 缓存: 32K
L2 缓存: 256K
L3 缓存: 8192K
NUMA node0 CPU(s): 0-7
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm epb tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts
被测试服务端均只返回“hello world”的body体。
客户端使用wrk,在本机测试。
第一名:wrk -> go-fasthttp: 40w TPS
$ time ./wrk -c 100 -d 20 -t 4 http://127.0.0.1:8081/
Running 20s test @ http://127.0.0.1:8081/
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 303.36us 483.32us 13.28ms 93.65%
Req/Sec 100.77k 6.97k 120.41k 72.50%
8026927 requests in 20.02s, 1.09GB read
Requests/sec: 400953.00
Transfer/sec: 55.83MB
real 0m20.024s
user 0m11.548s
sys 0m44.760s
第二名:wrk -> nginx(openresty+echo-nginx-module): 29w TPS
$ time ./wrk -c 100 -d 20 -t 4 http://127.0.0.1:8081/
Running 20s test @ http://127.0.0.1:8081/
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 750.38us 1.48ms 33.83ms 90.27%
Req/Sec 73.30k 10.52k 105.78k 69.75%
5847086 requests in 20.08s, 1.08GB read
Requests/sec: 291202.39
Transfer/sec: 54.99MB
real 0m20.083s
user 0m11.256s
sys 0m34.452s
第三名:wrk -> libevent.http: 28w TPS
$ time ./wrk -c 100 -d 20 -t 4 http://127.0.0.1:8081/dump
Running 20s test @ http://127.0.0.1:8081/dump
4 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 797.46us 1.44ms 30.28ms 88.51%
Req/Sec 71.08k 14.56k 115.91k 69.50%
5671928 requests in 20.06s, 649.10MB read
Requests/sec: 282719.55
Transfer/sec: 32.35MB
real 0m20.066s
user 0m7.340s
sys 0m33.364s
有疑问加站长微信联系(非本文作者)