Skip to content

Performance degenerates on async routes. #34

Description

@IterableTrucks

The performance of mrhttp drops significantly on serving asynchronous routes.

import mrhttp

app = mrhttp.Application()


@app.route('/sync_plaintext', _type="text")
def sync_hello(r):
    return "Hello, world!"


@app.route('/async_plaintext', _type="text")
async def async_hello(r):
    return "Hello, world!"

app.run()

I tested on a laptop with a Ryzen 7640HS CPU and the performance gap between synchronous and asynchronous routes is huge:

wrk -t12 -c10000 -d30s --latency http://127.0.0.1:8080/async_plaintext
Running 30s test @ http://127.0.0.1:8080/async_plaintext
  12 threads and 10000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     9.48ms    5.10ms 575.36ms   92.60%
    Req/Sec     9.40k     5.31k   23.70k    62.11%
  Latency Distribution
     50%    8.47ms
     75%   10.24ms
     90%   13.25ms
     99%   18.56ms
  3088248 requests in 30.04s, 421.16MB read
  Socket errors: connect 8987, read 205, write 0, timeout 18
Requests/sec: 102793.36
Transfer/sec:     14.02MB

wrk -t12 -c10000 -d30s --latency http://127.0.0.1:8080/sync_plaintext
Running 30s test @ http://127.0.0.1:8080/sync_plaintext
  12 threads and 10000 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     6.37ms    6.27ms 760.65ms   99.95%
    Req/Sec    15.65k     7.68k   35.71k    59.63%
  Latency Distribution
     50%    6.36ms
     75%    6.43ms
     90%    6.66ms
     99%    7.35ms
  4670974 requests in 30.05s, 637.01MB read
  Socket errors: connect 8987, read 3293, write 0, timeout 35
Requests/sec: 155460.83
Transfer/sec:     21.20MB

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions