github sparckles/Robyn v0.17.0
v0.17.0 - Const Requests

latest releases: v0.66.0, v0.65.1, v0.65.0...
2 years ago

This feature improves the performance substantially when you want to serve constant responses like simple strings, simple JSON payloads, etc.

Benchmark Source: https://github.com/sansyrox/robyn-comparrison-benchmarks

What's Changed

New Syntax

@app.get("/", const=True) # see the 'const' flag here
async def h(_):
    return "Hello, world!"

Performance upgrade

Robyn (6 workers)

➜  ~ oha --no-tui --insecure -c 100 -n 1000000 http://127.0.0.1:5000
Summary:
  Success rate:	1.0000
  Total:	1.9902 secs
  Slowest:	0.0477 secs
  Fastest:	0.0000 secs
  Average:	0.0002 secs
  Requests/sec:	502470.8499

  Total data:	12.40 MiB
  Size/request:	13 B
  Size/sec:	6.23 MiB

Response time histogram:
  0.000 [2608]   |
  0.000 [85802]  |■■■■■■
  0.000 [320394] |■■■■■■■■■■■■■■■■■■■■■■
  0.000 [456025] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.000 [88243]  |■■■■■■
  0.000 [13397]  |
  0.000 [6279]   |
  0.000 [4146]   |
  0.000 [2887]   |
  0.001 [2356]   |
  0.001 [17863]  |■

Latency distribution:
  10% in 0.0001 secs
  25% in 0.0002 secs
  50% in 0.0002 secs
  75% in 0.0002 secs
  90% in 0.0002 secs
  95% in 0.0003 secs
  99% in 0.0008 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.0052 secs, 0.0001 secs, 0.0196 secs
  DNS-lookup:	0.0000 secs, 0.0000 secs, 0.0000 secs

Status code distribution:
  [200] 1000000 responses

FastAPI

➜  ~ oha --no-tui --insecure -c 100 -n 1000000 http://127.0.0.1:5001
Summary:
  Success rate:	1.0000
  Total:	12.2921 secs
  Slowest:	0.0471 secs
  Fastest:	0.0001 secs
  Average:	0.0012 secs
  Requests/sec:	81353.0018

  Total data:	12.40 MiB
  Size/request:	13 B
  Size/sec:	1.01 MiB

Response time histogram:
  0.000 [127872] |■■■■■■■■■■■■■■■■■■■■
  0.001 [178274] |■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.001 [199031] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.001 [204123] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.002 [126955] |■■■■■■■■■■■■■■■■■■■
  0.002 [80915]  |■■■■■■■■■■■■
  0.002 [33556]  |■■■■■
  0.003 [11592]  |■
  0.003 [5180]   |
  0.003 [3270]   |
  0.004 [29232]  |■■■■

Latency distribution:
  10% in 0.0004 secs
  25% in 0.0007 secs
  50% in 0.0011 secs
  75% in 0.0015 secs
  90% in 0.0020 secs
  95% in 0.0024 secs
  99% in 0.0058 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.0113 secs, 0.0001 secs, 0.0451 secs
  DNS-lookup:	0.0000 secs, 0.0000 secs, 0.0001 secs

Status code distribution:
  [200] 1000000 responses

Starlette (24 workers)

➜  ~ oha --no-tui --insecure -c 100 -n 1000000 http://127.0.0.1:5003
Summary:
  Success rate:	1.0000
  Total:	9.8807 secs
  Slowest:	0.0534 secs
  Fastest:	0.0001 secs
  Average:	0.0010 secs
  Requests/sec:	101207.5486

  Total data:	12.40 MiB
  Size/request:	13 B
  Size/sec:	1.25 MiB

Response time histogram:
  0.000 [128086] |■■■■■■■■■■■■■■■■■■■
  0.001 [206731] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.001 [211417] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.001 [174363] |■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.001 [120210] |■■■■■■■■■■■■■■■■■■
  0.002 [69490]  |■■■■■■■■■■
  0.002 [32373]  |■■■■
  0.002 [13678]  |■■
  0.002 [6528]   |
  0.003 [4052]   |
  0.003 [33072]  |■■■■■

Latency distribution:
  10% in 0.0003 secs
  25% in 0.0005 secs
  50% in 0.0008 secs
  75% in 0.0012 secs
  90% in 0.0016 secs
  95% in 0.0020 secs
  99% in 0.0053 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.0368 secs, 0.0077 secs, 0.0520 secs
  DNS-lookup:	0.0000 secs, 0.0000 secs, 0.0001 secs

Status code distribution:
  [200] 1000000 responses

Flask (Bjoern)

➜  ~ oha --no-tui --insecure -c 100 -n 1000000 http://127.0.0.1:5000
Summary:
  Success rate:	1.0000
  Total:	113.6806 secs
  Slowest:	0.1515 secs
  Fastest:	0.0021 secs
  Average:	0.0114 secs
  Requests/sec:	8796.5722

  Total data:	12.40 MiB
  Size/request:	13 B
  Size/sec:	111.67 KiB

Response time histogram:
  0.005 [68]     |
  0.008 [246]    |
  0.011 [417517] |■■■■■■■■■■■■■■■■■■■■■■■
  0.014 [558015] |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
  0.017 [16685]  |
  0.020 [2962]   |
  0.022 [2796]   |
  0.025 [1357]   |
  0.028 [86]     |
  0.031 [187]    |
  0.034 [81]     |

Latency distribution:
  10% in 0.0099 secs
  25% in 0.0102 secs
  50% in 0.0112 secs
  75% in 0.0123 secs
  90% in 0.0129 secs
  95% in 0.0133 secs
  99% in 0.0157 secs

Details (average, fastest, slowest):
  DNS+dialup:	0.0352 secs, 0.0001 secs, 0.0509 secs
  DNS-lookup:	0.0000 secs, 0.0000 secs, 0.0000 secs

Status code distribution:
  [200] 1000000 responses

System Config

    eeeee  eeeeeeeeeeee   eeeee       OS: elementary OS 6.1 Jólnir x86_64
  eeee   eeeee       eee     eeee     Kernel: 5.13.0-51-generic
 eeee   eeee          eee     eeee    Uptime: 12 hours, 28 mins
eee    eee            eee       eee   Packages: 2369 (dpkg), 11 (flatpak), 12 (snap)
eee   eee            eee        eee   Shell: zsh 5.8
ee    eee           eeee       eeee   Resolution: 3840x2160, 2160x3840
ee    eee         eeeee      eeeeee   DE: Pantheon
ee    eee       eeeee      eeeee ee   WM: Mutter(Gala)
eee   eeee   eeeeee      eeeee  eee   Theme: io.elementary.stylesheet.blueberry [GTK3]
eee    eeeeeeeeee     eeeeee    eee   Icons: elementary [GTK3]
 eeeeeeeeeeeeeeeeeeeeeeee    eeeee    Terminal: alacritty
  eeeeeeee eeeeeeeeeeee      eeee     Terminal Font: DankMono Nerd Font
    eeeee                 eeeee       CPU: AMD Ryzen 9 5900X (24) @ 4.000GHz
      eeeeeee         eeeeeee         GPU: NVIDIA 09:00.0 NVIDIA Corporation Device 2489
         eeeeeeeeeeeeeeeee            Memory: 6090MiB / 64214MiB



Full Changelog: v0.16.6...v0.17.0

Don't miss a new Robyn release

NewReleases is sending notifications on new releases.