rwf2 / Rocket

A web framework for Rust.
https://rocket.rs
Other
24.63k stars 1.57k forks source link

Perfomance issue #315

Closed mrLSD closed 7 years ago

mrLSD commented 7 years ago

Rust version: current nightly Rocket: current OS: Ubuntu 16.04 App: Rocket hello example. Build: cargo build --release

I tested performance with benchmark tool: https://github.com/mrLSD/go-benchmark-app

Config:

# ab benchmarks parametres
[ab]
concurency = 500
keepalive = false
requests = 1000

# wrk benchmarks parametres
[wrk]
connections = 5000
duration = 10
threads = 1000

# siege benchmarks parametres
[siege]
concurrent = 100
time = 10

Results:

Iron pure & minimal:
  [Ab Benchmark results]
    Failed Requests:    0.00
    Requests Per Second:    13372.35
    Time Per Request:   37.92 ms
    Time Per Request [avg]: 0.08 ms
    Transfer Rate:      1488.72 Kbytes
  [Wrk Benchmark results]
    Latency Stats Avg:  253.50 us
    Latency Stats Stdev:    736.57 us
    Latency Stats Max:  72.21 ms
    Req/Sec Stats Avg:  15.90 k
    Req/Sec Stats Stdev:    5.20 k
    Req/Sec Stats Max:  37.47 k
    Latency Distribution
            [99%]:  1.60 ms
    Requests/sec:       128325.62
    Requests:       1296590.20
    Failed Requests:    0.00
  [Siege Benchmark results]
    Transactions:       115767.40
    Availability:       99.18%
    Transaction Rate:   15720.57
    Concurrency:        82.15
    Longest Transaction:    0.31
Nickel pure & minimal:
  [Ab Benchmark results]
    Failed Requests:    0.00
    Requests Per Second:    12036.39
    Time Per Request:   42.14 ms
    Time Per Request [avg]: 0.08 ms
    Transfer Rate:      1339.99 Kbytes
  [Wrk Benchmark results]
    Latency Stats Avg:  256.19 us
    Latency Stats Stdev:    686.63 us
    Latency Stats Max:  73.80 ms
    Req/Sec Stats Avg:  15.13 k
    Req/Sec Stats Stdev:    5.42 k
    Req/Sec Stats Max:  34.02 k
    Latency Distribution
            [99%]:  1.43 ms
    Requests/sec:       130560.90
    Requests:       1319203.80
    Failed Requests:    0.00
  [Siege Benchmark results]
    Transactions:       121709.40
    Availability:       99.14%
    Transaction Rate:   16517.35
    Concurrency:        80.08
    Longest Transaction:    0.34
Iron CMS minimal:
  [Ab Benchmark results]
    Failed Requests:    0.00
    Requests Per Second:    11957.77
    Time Per Request:   42.08 ms
    Time Per Request [avg]: 0.08 ms
    Transfer Rate:      1331.23 Kbytes
  [Wrk Benchmark results]
    Latency Stats Avg:  253.46 us
    Latency Stats Stdev:    745.18 us
    Latency Stats Max:  88.09 ms
    Req/Sec Stats Avg:  15.13 k
    Req/Sec Stats Stdev:    5.48 k
    Req/Sec Stats Max:  32.84 k
    Latency Distribution
            [99%]:  1.46 ms
    Requests/sec:       126513.15
    Requests:       1278130.60
    Failed Requests:    0.00
  [Siege Benchmark results]
    Transactions:       123092.80
    Availability:       99.29%
    Transaction Rate:   16490.46
    Concurrency:        83.70
    Longest Transaction:    0.34
Nickel CMS minimal:
  [Ab Benchmark results]
    Failed Requests:    0.00
    Requests Per Second:    12691.88
    Time Per Request:   39.76 ms
    Time Per Request [avg]: 0.08 ms
    Transfer Rate:      1412.97 Kbytes
  [Wrk Benchmark results]
    Latency Stats Avg:  256.04 us
    Latency Stats Stdev:    747.50 us
    Latency Stats Max:  88.62 ms
    Req/Sec Stats Avg:  15.79 k
    Req/Sec Stats Stdev:    4.97 k
    Req/Sec Stats Max:  37.04 k
    Latency Distribution
            [99%]:  1.50 ms
    Requests/sec:       128754.08
    Requests:       1300863.40
    Failed Requests:    0.00
  [Siege Benchmark results]
    Transactions:       115963.20
    Availability:       99.14%
    Transaction Rate:   15396.18
    Concurrency:        81.67
    Longest Transaction:    0.35
Rocket Hello:
  [Ab Benchmark results]
    Failed Requests:    0.00
    Requests Per Second:    4612.84
    Time Per Request:   108.45 ms
    Time Per Request [avg]: 0.22 ms
    Transfer Rate:      743.28 Kbytes
  [Wrk Benchmark results]
    Latency Stats Avg:  187.01 us
    Latency Stats Stdev:    296.90 us
    Latency Stats Max:  15.14 ms
    Req/Sec Stats Avg:  21.36 k
    Req/Sec Stats Stdev:    +Inf k
    Req/Sec Stats Max:  22.47 k
    Latency Distribution
            [99%]:  1059.00 us
    Requests/sec:       21876.85
    Requests:       221044.40
    Failed Requests:    0.00
  [Siege Benchmark results]
    Transactions:       40369.40
    Availability:       97.37%
    Transaction Rate:   9019.98
    Concurrency:        73.05
    Longest Transaction:    0.39

Rocket was significantly slow. Is it problem from my environment or known issue?

SergioBenitez commented 7 years ago

Did you disable logging? You should run Rocket under the prod environment: ROCKET_ENV=prod.

mrLSD commented 7 years ago

I tested again with prod environment and have got excellent results:

Rocket Hello:
  [Ab Benchmark results]
    Failed Requests:    0.00
    Requests Per Second:    13480.71
    Time Per Request:   37.33 ms
    Time Per Request [avg]: 0.07 ms
    Transfer Rate:      2172.18 Kbytes
  [Wrk Benchmark results]
    Latency Stats Avg:  35.83 us
    Latency Stats Stdev:    44.36 us
    Latency Stats Max:  11.14 ms
    Req/Sec Stats Avg:  106.05 k
    Req/Sec Stats Stdev:    6.41 k
    Req/Sec Stats Max:  111.47 k
    Latency Distribution
            [99%]:  72.20 us
    Requests/sec:       109628.09
    Requests:       1107530.40
    Failed Requests:    0.00
  [Siege Benchmark results]
    Transactions:       126736.80
    Availability:       99.16%
    Transaction Rate:   20891.67
    Concurrency:        82.28
    Longest Transaction:    0.41