這是一個建立於
的文章,其中的資訊可能已經有所發展或是發生改變。
硬體環境
$ lscpuArchitecture: x86_64CPU 運行模式: 32-bit, 64-bitByte Order: Little EndianCPU(s): 8On-line CPU(s) list: 0-7每個核的線程數:2每個座的核心數: 4Socket(s): 1NUMA 節點: 1廠商 ID: GenuineIntelCPU 系列: 6型號: 58Model name: Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz步進: 9CPU MHz: 2021.406CPU max MHz: 3900.0000CPU min MHz: 1600.0000BogoMIPS: 6784.72虛擬化: VT-xL1d 緩衝: 32KL1i 緩衝: 32KL2 緩衝: 256KL3 緩衝: 8192KNUMA node0 CPU(s): 0-7Flags: 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 connectionsThread Stats Avg Stdev Max +/- StdevLatency 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 readRequests/sec: 400953.00Transfer/sec: 55.83MBreal 0m20.024suser 0m11.548ssys 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 connectionsThread Stats Avg Stdev Max +/- StdevLatency 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 readRequests/sec: 291202.39Transfer/sec: 54.99MBreal 0m20.083suser 0m11.256ssys 0m34.452s
第三名:wrk -> libevent.http: 28w TPS
$ time ./wrk -c 100 -d 20 -t 4 http://127.0.0.1:8081/dumpRunning 20s test @ http://127.0.0.1:8081/dump4 threads and 100 connectionsThread Stats Avg Stdev Max +/- StdevLatency 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 readRequests/sec: 282719.55Transfer/sec: 32.35MBreal 0m20.066suser 0m7.340ssys 0m33.364s