Back to Browse

Web api benchmarking: Python (FastAPI) vs Rust (Axum) with database (Dockerized)

3.3K views
Mar 7, 2023
27:20

#rustlang #axum #tokio #fastapi #python #services #docker Code: https://github.com/Vagelis-Prokopiou/fastapi-async-sample Rust Axum oha CPU: 400% RAM: 25 Mb Summary: Success rate: 1.0000 Total: 2.4182 secs Slowest: 0.0459 secs Fastest: 0.0028 secs Average: 0.0121 secs Requests/sec: 8270.6559 Total data: 331.33 MiB Size/request: 16.96 KiB Size/sec: 137.01 MiB Response time histogram: 0.003 [68] | 0.006 [811] |■■ 0.009 [9951] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.012 [7795] |■■■■■■■■■■■■■■■■■■■■■■■■■ 0.015 [1130] |■■■ 0.018 [122] | 0.021 [21] | 0.024 [2] | 0.027 [0] | 0.030 [3] | 0.033 [97] | Latency distribution: 10% in 0.0098 secs 25% in 0.0108 secs 50% in 0.0118 secs 75% in 0.0130 secs 90% in 0.0144 secs 95% in 0.0154 secs 99% in 0.0187 secs Status code distribution: [200] 20000 responses Rust Axum wrk CPU: 600% RAM: 27 Mb Thread Stats Avg Stdev Max +/- Stdev Latency 9.21ms 1.33ms 23.05ms 75.71% Req/Sec 1.74k 77.96 2.39k 69.44% 312926 requests in 30.06s, 5.09GB read Requests/sec: 10409.49 Transfer/sec: 173.55MB FastApi oha CPU: 1300% RAM: 840 Mb Summary: Success rate: 1.0000 Total: 70.6822 secs Slowest: 1.6597 secs Fastest: 0.0265 secs Average: 0.3525 secs Requests/sec: 282.9568 Total data: 315.51 MiB Size/request: 16.15 KiB Size/sec: 4.46 MiB Response time histogram: 0.094 [1493] |■■■■■■■■■ 0.187 [3123] |■■■■■■■■■■■■■■■■■■■ 0.281 [5078] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.375 [4599] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.469 [2496] |■■■■■■■■■■■■■■■ 0.562 [1189] |■■■■■■■ 0.656 [631] |■■■ 0.750 [370] |■■ 0.844 [318] |■■ 0.937 [243] |■ 1.031 [460] |■■ Latency distribution: 10% in 0.1471 secs 25% in 0.2221 secs 50% in 0.3122 secs 75% in 0.4240 secs 90% in 0.5920 secs 95% in 0.7840 secs 99% in 1.1119 secs Status code distribution: [200] 18778 responses [500] 1222 responses FastApi wrk CPU: 500% RAM: 1.2 GB Thread Stats Avg Stdev Max +/- Stdev Latency 1.34s 360.94ms 2.00s 65.26% Req/Sec 90.71 65.12 495.00 67.24% 15753 requests in 30.10s, 47.07MB read Socket errors: connect 0, read 13218, write 0, timeout 2225 Non-2xx or 3xx responses: 13100 Requests/sec: 523.34 Transfer/sec: 1.56MB

Download

0 formats

No download links available.

Web api benchmarking: Python (FastAPI) vs Rust (Axum) with database (Dockerized) | NatokHD