Rust 给 Python Web 带来的性能提升

查看 51|回复 1
作者:Baloneo   
对比 FastAPI Robyn Gin json 序列化返回性能 大概的性能对比如下
wrk -t10 -c 10 -d 20s http://127.0.0.1:xxxx/json
FastAPI (async)
Running 20s test @ http://127.0.0.1:8080/json
  10 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   835.68us  798.76us  29.00ms   94.21%
    Req/Sec     1.32k   513.33     2.51k    49.45%
  262867 requests in 20.10s, 38.10MB read
Requests/sec:  13078.90
Transfer/sec:      1.90MB
Robyn (sync)
Running 20s test @ http://127.0.0.1:8111/json
  10 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   358.51us  690.23us  24.51ms   96.09%
    Req/Sec     3.91k     1.70k    9.80k    76.79%
  781679 requests in 20.10s, 75.29MB read
Requests/sec:  38889.89
Transfer/sec:      3.75MB
Robyn (async)
Running 20s test @ http://127.0.0.1:8111/json
  10 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   517.35us  795.62us  32.63ms   95.72%
    Req/Sec     2.42k     0.87k    6.79k    71.78%
  481576 requests in 20.10s, 46.39MB read
Requests/sec:  23959.48
Transfer/sec:      2.31MB
Gin
Running 20s test @ http://127.0.0.1:8888/json
  10 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   293.92us  688.32us  27.60ms   94.13%
    Req/Sec     6.87k     2.66k   13.32k    58.32%
  1368505 requests in 20.10s, 195.77MB read
Requests/sec:  68090.01
Transfer/sec:      9.74MB
robyn 基准参考 https://github.com/sansyrox/robyn-comparison-benchmarks
Rust+Python Python 的下一波春天?

sec, stdev, Requests, robyn

wuwukai007   
官方文档就是个简单的 demo ,很怀疑持久性,对比之前的 litestar 文档就很齐全
您需要登录后才可以回帖 登录 | 立即注册

返回顶部