BytesZero / rust_api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

简单测试 Rust API 服务性能

运行

cargo run

测试(斐波那契数列)

wrk -t12 -c400 -d120s http://127.0.0.1:8080/fibonacci/80

结果

Running 2m test @ http://127.0.0.1:8080/fibonacci/80
  12 threads and 400 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     7.99ms    4.59ms 137.68ms   89.93%
    Req/Sec     2.56k     1.24k    6.31k    63.54%
  3670936 requests in 2.00m, 381.60MB read
  Socket errors: connect 155, read 102, write 0, timeout 0
Requests/sec:  30564.57
Transfer/sec:      3.18MB

Docker 部署

docker build -t rust_api .
docker run -p 8080:8080 rust_api

对比测试结果

测试项 Rust NodeJS 请求量
启动 Rust NodeJS 没有请求
10线程 Rust NodeJS
100线程 Rust NodeJS
300线程 Rust NodeJS
500线程 Rust NodeJS
1000线程 Rust NodeJS
2000线程 Rust NodeJS
3000线程 Rust NodeJS

About


Languages

Language:Rust 41.3%Language:Shell 38.1%Language:Dockerfile 20.5%