sparckles / Robyn

Robyn is a Super Fast Async Python Web Framework with a Rust runtime.
https://robyn.tech/
BSD 2-Clause "Simplified" License
4.44k stars 229 forks source link

[Feature Request]add test results of python's fastest frameworks sanic and robyn #256

Open kitty-eu-org opened 2 years ago

kitty-eu-org commented 2 years ago

Current Behavior

add test results of python's fastest frameworks sanic and robyn,The speed of sanic is much faster than fastapi, and the production use is very stable, I tested the test results of sanic and robyn Desired Behavior

add test results of python's fastest frameworks sanic and robyn,The speed of sanic is much faster than fastapi, and the production use is very stable, I tested the test results of sanic and robyn

Screenshots / Mockups

app = Sanic("MyHelloWorldApp")

@app.get("/") async def hello_world(request): return text("Hello, world.")

app.run(port=5000, workers=16, access_log=False)

+ robyn code
```python
from robyn import Robyn

app = Robyn(__file__)

@app.get("/", const=True)
async def h(_):
    return "Hello, world!"

app.start(port=5000, )
# run command: python robyn_.py --processes 16 

Response time histogram: 0.001 [10097] |■■■■■■■■■■■■■■ 0.002 [22291] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.004 [20434] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ 0.005 [14467] |■■■■■■■■■■■■■■■■■■■■ 0.006 [9893] |■■■■■■■■■■■■■■ 0.007 [7173] |■■■■■■■■■■ 0.008 [5820] |■■■■■■■■ 0.009 [3814] |■■■■■ 0.011 [2499] |■■■ 0.012 [1477] |■■ 0.013 [2035] |■■

Latency distribution: 10% in 0.0015 secs 25% in 0.0023 secs 50% in 0.0037 secs 75% in 0.0059 secs 90% in 0.0085 secs 95% in 0.0102 secs 99% in 0.0136 secs

Details (average, fastest, slowest): DNS+dialup: 0.0056 secs, 0.0029 secs, 0.0091 secs DNS-lookup: 0.0000 secs, 0.0000 secs, 0.0004 secs

Status code distribution: [200] 100000 responses


  2.robyn:oha --insecure -c 100 -n 100000 http://127.0.0.1:5000
```shell
Summary:
  Success rate: 1.0000
  Total:    2.1341 secs
  Slowest:  0.0116 secs
  Fastest:  0.0001 secs
  Average:  0.0021 secs
  Requests/sec: 46858.4073

  Total data:   1.24 MiB
  Size/request: 13 B
  Size/sec: 594.88 KiB

Response time histogram:
  0.001 [3522]  |■■■■
  0.001 [13508] |■■■■■■■■■■■■■■■■
  0.002 [25660] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.002 [25131] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.003 [15750] |■■■■■■■■■■■■■■■■■■■
  0.003 [8224]  |■■■■■■■■■■
  0.004 [4205]  |■■■■■
  0.004 [2134]  |■■
  0.005 [989]   |■
  0.006 [416]   |
  0.006 [461]   |

Latency distribution:
  10% in 0.0010 secs
  25% in 0.0015 secs
  50% in 0.0020 secs
  75% in 0.0026 secs
  90% in 0.0033 secs
  95% in 0.0039 secs
  99% in 0.0051 secs

Details (average, fastest, slowest):
  DNS+dialup:   0.0047 secs, 0.0017 secs, 0.0078 secs
  DNS-lookup:   0.0000 secs, 0.0000 secs, 0.0001 secs

Status code distribution:
  [200] 100000 responses

Alternatives

From the results, robyn is twice as fast as sanic, but the performance of sanic is still very good. Finally, thank you for your contribution to robyn

sansyrox commented 2 years ago

@hezhaozhao-git , thank you for the stats.

Can you share the result of the command neofetch on your terminal too? So, that we can have the specs of the PC as a reference too?

kitty-eu-org commented 2 years ago

@hezhaozhao-git , thank you for the stats.

Can you share the result of the command neofetch on your terminal too? So, that we can have the specs of the PC as a reference too? image