我在不同的可执行文件、常规 jar、fast-jar 和本机可执行文件中比较相同的 Quarkus 应用程序。为了能够比较它们,我进行了相同的性能测试。
结果如下:
普通 Jar,以
0.904s. 关于性能,结果如下:Running 1m test @ http://localhost:8080/hello 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 361.86us 4.48ms 155.85ms 99.73% Req/Sec 29.86k 4.72k 37.60k 87.83% 3565393 requests in 1.00m, 282.22MB read Requests/sec: 59324.15 Transfer/sec: 4.70MBFast-Jar,开始于
0.590s. 关于性能,结果如下:Running 1m test @ http://localhost:8080/hello 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 344.38us 3.89ms 142.71ms 99.74% Req/Sec 27.21k 6.52k 40.67k 73.48% 3246932 requests in 1.00m, 257.01MB read Requests/sec: 54025.50 Transfer/sec: 4.28MB本机,从
0.011s. 关于性能,结果如下:Running 1m test @ http://localhost:8080/hello 2 threads and 10 connections Thread Stats Avg Stdev Max +/- Stdev Latency 303.72us 471.86us 29.00ms 98.05% Req/Sec 19.03k 3.21k 30.19k 78.75% 2272236 requests in 1.00m, 179.86MB read Requests/sec: 37867.20 Transfer/sec: 3.00MB
在本机应用程序中处理的请求数大约比 JVM Quarkus 应用程序少 100 万。但是,原生应用程序中的启动时间、Avg 和 Stdev 比其他应用程序要好。
我想知道为什么会发生这种情况,以及本机应用程序是否比 JVM 更好。