Skip to content

v0.0.12版本

Compare
Choose a tag to compare
@guonaihong guonaihong released this 24 Dec 13:50
· 102 commits to master since this release
afc60d4

新加选项 可以把OnMessage函数运行在event loop(io go程)里面。
相比放到业务go程池里面性能更快,可以优化少数场景。

以下是测试数据

测试参数:
io程池=逻辑cpu*2
逻辑go程= 80

一、tps测试

1.1 greatws 的任务在io go程里面运行

./test-client.linux --conns 10000 -c 10000 -w "ws://127.0.0.1:9001/autobahn" -d 100s --open-tmp-result
sec: 1, count: 243141, tps: 243141
sec: 2, count: 672561, tps: 336280
sec: 3, count: 1102809, tps: 367603
sec: 4, count: 1530530, tps: 382632
sec: 5, count: 1946164, tps: 389232
sec: 6, count: 2364096, tps: 394016
sec: 7, count: 2783206, tps: 397600
sec: 8, count: 3194626, tps: 399328
sec: 9, count: 3603743, tps: 400415
sec: 10, count: 4019284, tps: 401928
sec: 11, count: 4432592, tps: 402962
sec: 12, count: 4833168, tps: 402764
sec: 13, count: 5242165, tps: 403243
sec: 14, count: 5657628, tps: 404116
sec: 15, count: 6056780, tps: 403785
sec: 16, count: 6461508, tps: 403844
sec: 17, count: 6860909, tps: 403582
sec: 18, count: 7262491, tps: 403471
sec: 19, count: 7658484, tps: 403078
sec: 20, count: 8052745, tps: 402637
sec: 21, count: 8450633, tps: 402411
sec: 22, count: 8850473, tps: 402294
sec: 23, count: 9250060, tps: 402176
sec: 24, count: 9648830, tps: 402034
sec: 25, count: 10049166, tps: 401966
sec: 26, count: 10441212, tps: 401585
sec: 27, count: 10842683, tps: 401580
sec: 28, count: 11236643, tps: 401308
sec: 29, count: 11639807, tps: 401372
sec: 30, count: 12031313, tps: 401043
sec: 31, count: 12423923, tps: 400771
sec: 32, count: 12820393, tps: 400637
sec: 33, count: 13218268, tps: 400553
sec: 34, count: 13614116, tps: 400415
sec: 35, count: 14007181, tps: 400205
sec: 36, count: 14399093, tps: 399974
sec: 37, count: 14792809, tps: 399805
sec: 38, count: 15189473, tps: 399722
sec: 39, count: 15583806, tps: 399584
sec: 40, count: 15975620, tps: 399390
sec: 41, count: 16367089, tps: 399197
sec: 42, count: 16756346, tps: 398960
sec: 43, count: 17151142, tps: 398863
sec: 44, count: 17545442, tps: 398760
sec: 45, count: 17934202, tps: 398537
sec: 46, count: 18324818, tps: 398365
sec: 47, count: 18720693, tps: 398312
sec: 48, count: 19114012, tps: 398208
sec: 49, count: 19508267, tps: 398127
sec: 50, count: 19901309, tps: 398026
sec: 51, count: 20292237, tps: 397887
sec: 52, count: 20684689, tps: 397782
sec: 53, count: 21073420, tps: 397611
sec: 54, count: 21468786, tps: 397570
sec: 55, count: 21861656, tps: 397484
sec: 56, count: 22246147, tps: 397252
sec: 57, count: 22634420, tps: 397095
sec: 58, count: 23027531, tps: 397026
sec: 59, count: 23419463, tps: 396940
sec: 60, count: 23809914, tps: 396831

1.2 greatws 的任务在业务go程里面运行

./test-client.linux --conns 10000 -c 10000 -w "ws://127.0.0.1:9001/autobahn" -d 100s --open-tmp-result
sec: 1, count: 212625, tps: 212625
sec: 2, count: 623617, tps: 311808
sec: 3, count: 1032070, tps: 344023
sec: 4, count: 1432843, tps: 358210
sec: 5, count: 1838703, tps: 367740
sec: 6, count: 2234781, tps: 372463
sec: 7, count: 2599605, tps: 371372
sec: 8, count: 3003163, tps: 375395
sec: 9, count: 3397984, tps: 377553
sec: 10, count: 3788806, tps: 378880
sec: 11, count: 4176688, tps: 379698
sec: 12, count: 4571395, tps: 380949
sec: 13, count: 4944986, tps: 380383
sec: 14, count: 5318959, tps: 379925
sec: 15, count: 5706142, tps: 380409
sec: 16, count: 6084897, tps: 380306
sec: 17, count: 6468136, tps: 380478
sec: 18, count: 6847595, tps: 380421
sec: 19, count: 7217978, tps: 379893
sec: 20, count: 7601137, tps: 380056
sec: 21, count: 7979298, tps: 379966
sec: 22, count: 8357102, tps: 379868
sec: 23, count: 8740609, tps: 380026
sec: 24, count: 9113241, tps: 379718
sec: 25, count: 9489328, tps: 379573
sec: 26, count: 9866430, tps: 379478
sec: 27, count: 10232431, tps: 378978
sec: 28, count: 10608870, tps: 378888
sec: 29, count: 10978265, tps: 378560
sec: 30, count: 11343350, tps: 378111
sec: 31, count: 11720056, tps: 378066
sec: 32, count: 12063333, tps: 376979
sec: 33, count: 12438641, tps: 376928
sec: 34, count: 12819747, tps: 377051
sec: 35, count: 13191886, tps: 376911
sec: 36, count: 13563319, tps: 376758
sec: 37, count: 13938551, tps: 376717
sec: 38, count: 14320927, tps: 376866
sec: 39, count: 14692830, tps: 376739
sec: 40, count: 15068362, tps: 376709
sec: 41, count: 15435044, tps: 376464
sec: 42, count: 15810016, tps: 376428
sec: 43, count: 16179358, tps: 376264
sec: 44, count: 16550787, tps: 376154
sec: 45, count: 16901867, tps: 375597
sec: 46, count: 17278286, tps: 375614
sec: 47, count: 17653114, tps: 375598
sec: 48, count: 18030044, tps: 375625
sec: 49, count: 18410031, tps: 375714
sec: 50, count: 18771052, tps: 375421
sec: 51, count: 19127988, tps: 375058
sec: 52, count: 19508457, tps: 375162
sec: 53, count: 19873115, tps: 374964
sec: 54, count: 20253186, tps: 375059
sec: 55, count: 20624107, tps: 374983
sec: 56, count: 21000850, tps: 375015
sec: 57, count: 21377777, tps: 375048
sec: 58, count: 21740474, tps: 374835
sec: 59, count: 22103840, tps: 374641
sec: 60, count: 22463686, tps: 374394

1.2 quickws,一个连接一个go程

./test-client.linux --conns 10000 -c 10000 -w "ws://127.0.0.1:9001/autobahn" -d 100s --open-tmp-result
sec: 1, count: 253330, tps: 253330
sec: 2, count: 680336, tps: 340168
sec: 3, count: 1101934, tps: 367311
sec: 4, count: 1532060, tps: 383015
sec: 5, count: 1953271, tps: 390654
sec: 6, count: 2380540, tps: 396756
sec: 7, count: 2798329, tps: 399761
sec: 8, count: 3216578, tps: 402072
sec: 9, count: 3636470, tps: 404052
sec: 10, count: 4049961, tps: 404996
sec: 11, count: 4465914, tps: 405992
sec: 12, count: 4882582, tps: 406881
sec: 13, count: 5295197, tps: 407322
sec: 14, count: 5713063, tps: 408075
sec: 15, count: 6120831, tps: 408055
sec: 16, count: 6531714, tps: 408232
sec: 17, count: 6938255, tps: 408132
sec: 18, count: 7347506, tps: 408194
sec: 19, count: 7765639, tps: 408717
sec: 20, count: 8165627, tps: 408281
sec: 21, count: 8571903, tps: 408185
sec: 22, count: 8975901, tps: 407995
sec: 23, count: 9384137, tps: 408005
sec: 24, count: 9786892, tps: 407787
sec: 25, count: 10201977, tps: 408079
sec: 26, count: 10605978, tps: 407922
sec: 27, count: 11012471, tps: 407869
sec: 28, count: 11412466, tps: 407588
sec: 29, count: 11813672, tps: 407368
sec: 30, count: 12222631, tps: 407421
sec: 31, count: 12627199, tps: 407329
sec: 32, count: 13025142, tps: 407035
sec: 33, count: 13428382, tps: 406920
sec: 34, count: 13835316, tps: 406921
sec: 35, count: 14234546, tps: 406701
sec: 36, count: 14642271, tps: 406729
sec: 37, count: 15044005, tps: 406594
sec: 38, count: 15443126, tps: 406398
sec: 39, count: 15841269, tps: 406186
sec: 40, count: 16238977, tps: 405974
sec: 41, count: 16629391, tps: 405594
sec: 42, count: 17026134, tps: 405384
sec: 43, count: 17422180, tps: 405166
sec: 44, count: 17819391, tps: 404986
sec: 45, count: 18217738, tps: 404838
sec: 46, count: 18617072, tps: 404718
sec: 47, count: 19023030, tps: 404745
sec: 48, count: 19416438, tps: 404509
sec: 49, count: 19813547, tps: 404358
sec: 50, count: 20213954, tps: 404279
sec: 51, count: 20606688, tps: 404052
sec: 52, count: 21000608, tps: 403857
sec: 53, count: 21399117, tps: 403756
sec: 54, count: 21797565, tps: 403658
sec: 55, count: 22190761, tps: 403468
sec: 56, count: 22587806, tps: 403353
sec: 57, count: 22989951, tps: 403332
sec: 58, count: 23382607, tps: 403148
sec: 59, count: 23783413, tps: 403108
sec: 60, count: 24180300, tps: 403005
sec: 61, count: 24580887, tps: 402965
sec: 62, count: 24970624, tps: 402752
sec: 63, count: 25363958, tps: 402602
sec: 64, count: 25764526, tps: 402570
sec: 65, count: 26159587, tps: 402455
sec: 66, count: 26565234, tps: 402503
sec: 67, count: 26961014, tps: 402403
sec: 68, count: 27352993, tps: 402249
sec: 69, count: 27749803, tps: 402171
sec: 70, count: 28145375, tps: 402076
sec: 71, count: 28544136, tps: 402030
sec: 72, count: 28936243, tps: 401892

二、流量测试

2.1 greatws在 io go程里面跑

tcpkali -c 10000 --connect-rate 10000 -r 10000 -T 30s -f 1K.txt --ws 127.0.0.1:9001/

WARNING: Dumb terminal, expect unglorified output.
Destination: [127.0.0.1]:9001
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [127.0.0.1]:9001
Ramped up to 10000 connections.
Total data sent: 25556.6 MiB (26798078111 bytes)
Total data received: 23417.0 MiB (24554513181 bytes)
Bandwidth per channel: 1.369⇅ Mbps (171.1 kBps)
Aggregate bandwidth: 6547.196↓, 7145.418↑ Mbps
Packet rate estimate: 988126.0↓, 621951.8↑ (2↓, 42↑ TCP MSS/op)
Test duration: 30.0031 s.

2.2 greatws在业务 go程里面跑

tcpkali -c 10000 --connect-rate 10000 -r 10000 -T 30s -f 1K.txt --ws 127.0.0.1:9001/

WARNING: Dumb terminal, expect unglorified output.
Destination: [127.0.0.1]:9001
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [127.0.0.1]:9001
Ramped up to 10000 connections.
Total data sent: 16052.5 MiB (16832318420 bytes)
Total data received: 17379.3 MiB (18223480609 bytes)
Bandwidth per channel: 0.935⇅ Mbps (116.9 kBps)
Aggregate bandwidth: 4859.571↓, 4488.596↑ Mbps
Packet rate estimate: 462978.4↓, 390358.8↑ (1↓, 19↑ TCP MSS/op)
Test duration: 30.0001 s.

2.33 quickws 一个连接一个go程

tcpkali -c 10000 --connect-rate 10000 -r 10000 -T 30s -f 1K.txt --ws 127.0.0.1:9001/

WARNING: Dumb terminal, expect unglorified output.
Destination: [127.0.0.1]:9001
Interface lo address [127.0.0.1]:0
Using interface lo to connect to [127.0.0.1]:9001
Ramped up to 10000 connections.
Total data sent: 25627.6 MiB (26872448477 bytes)
Total data received: 24286.8 MiB (25466521257 bytes)
Bandwidth per channel: 1.395⇅ Mbps (174.4 kBps)
Aggregate bandwidth: 6791.017↓, 7165.928↑ Mbps
Packet rate estimate: 1005037.8↓, 620817.9↑ (2↓, 42↑ TCP MSS/op)