The tests were run using wrk
. The command was to open 8 threads and 1000 connections to hit the server for 20 minutes.
For this test, there were two ASP.NET Core projects: webapi
and webapiaot
. The webapi
project was published as a single-file, ready-to-run output. The webapiaot
was also single-file, ready-to-run, but contained native instructions.
Both webapi
and webapiaot
projects had these options in the csproj
files:
<PublishReadyToRun>true</PublishReadyToRun>
<PublishTrimmed>true</PublishTrimmed>
<SelfContained>true</SelfContained>
<IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
AOT had this additional option:
<PublishAot>true</PublishAot>
Results:
Running 20m test @ http://localhost:5000/todos
8 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 10.30ms 2.62ms 71.82ms 74.24%
Req/Sec 12.20k 645.42 26.51k 74.12%
116549316 requests in 20.00m, 55.90GB read
Requests/sec: 97116.95
Transfer/sec: 47.70MB
AOT (size-opimised) had these additional option:
<PublishAot>true</PublishAot>
<OptimizationPreference>Size</OptimizationPreference>
Running 20m test @ http://localhost:5000/todos
8 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 10.29ms 2.72ms 74.26ms 74.79%
Req/Sec 12.21k 584.60 29.62k 73.77%
116674061 requests in 20.00m, 55.96GB read
Requests/sec: 97220.68
Transfer/sec: 47.75MB
AOT (speed-opimised) had these additional option:
Results:
<PublishAot>true</PublishAot>
<OptimizationPreference>Speed</OptimizationPreference>
Results:
Running 20m test @ http://localhost:5000/todos
8 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 9.43ms 4.13ms 92.82ms 78.69%
Req/Sec 13.38k 1.66k 35.40k 84.58%
127838604 requests in 20.00m, 61.32GB read
Requests/sec: 106523.72
Transfer/sec: 52.32MB
In addition to the common options, the single-file deployment project also had these options. The PublishAot
and OptimizationPreference
options were not included in this csproj
file.
<PublishSingleFile>true</PublishSingleFile>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
Results:
Running 20m test @ http://localhost:5000/todos
8 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 9.41ms 2.35ms 180.00ms 77.45%
Req/Sec 13.37k 652.28 23.40k 82.55%
127684369 requests in 20.00m, 61.24GB read
Requests/sec: 106397.44
Transfer/sec: 52.26MB
TypeScript: bun run index.ts
Running 20m test @ http://localhost:3000/todos
8 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 15.10ms 561.15us 43.84ms 74.85%
Req/Sec 8.32k 428.45 9.86k 54.84%
79455216 requests in 20.00m, 34.34GB read
Requests/sec: 66209.38
Transfer/sec: 29.30MB
JavaScript: bun run index.js
Running 20m test @ http://localhost:3000/todos
8 threads and 1000 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 16.01ms 530.37us 47.02ms 75.10%
Req/Sec 7.84k 403.69 11.04k 79.84%
74919011 requests in 20.00m, 32.38GB read
Requests/sec: 62427.94
Transfer/sec: 27.62MB