利用siege测了一下单机JFinal框架+undertow的的性能,也不知道下面的结果到底算是性能如何呢? 为了测最快速度,我只写了一个controller的method直接返回renderNull();
gary@ubuntu18$ siege -c1000 -r100 http://127.0.0.1:8000/mock/siege
** SIEGE 4.0.4
** Preparing 1000 concurrent users for battle.
The server is now under siege...
Transactions: 100000 hits
Availability: 100.00 %
Elapsed time: 19.29 secs
Data transferred: 0.00 MB
Response time: 0.18 secs
Transaction rate: 5184.03 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 929.95
Successful transactions: 100000
Failed transactions: 0
Longest transaction: 2.11
Shortest transaction: 0.00
gary@ubuntu18$ siege -c1000 -r200 http://127.0.0.1:8000/mock/siege
** SIEGE 4.0.4
** Preparing 1000 concurrent users for battle.
The server is now under siege...
Transactions: 200000 hits
Availability: 100.00 %
Elapsed time: 40.25 secs
Data transferred: 0.00 MB
Response time: 0.19 secs
Transaction rate: 4968.94 trans/sec
Throughput: 0.00 MB/sec
Concurrency: 947.82
Successful transactions: 200000
Failed transactions: 0
Longest transaction: 2.36
Shortest transaction: 0.00
另外也调了了一下undertow的ioThread以及workerThread, 基本ioThread最好状态是在 cpu核数×2的数值上, workerThread不宜超过500
可能是 renderNull() 拖慢了速度,改成 renderText("ok") 试一下
当然,性能测试还与很多因素有关