From 402ddfe4ec7ae97afee1490e04c3ae5cdeef7ec3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marwan=20Rabb=C3=A2a?= Date: Wed, 4 Jul 2018 21:22:23 +0200 Subject: [PATCH] Downgrade python (#288) * Introducing Vibora (#285) * add vibora this code has been tested and it requires `SO_REUSEPORT` on Ubuntu 16.04, therefore can't guarantee anything about the code. Use it at your own risk. * Update benchmarker.cr * update for vibora * fix routing -> type not required * add vibora * use gunicorn for sanic * use http://meinheld.org/ to enable async networking with django * reuse port on tornado * use meinheld / SO_REUSEPORT on django * use meinheld / SO_REUSEPORT on flask * use python36 to test uvloop base frameworks * do not declare extra dependencies * spread vibora on all cores * remove headers specifications on vibora implementations * use default worker numbers on vibora (more performing) * Introducing Vibora (#285) * add vibora this code has been tested and it requires `SO_REUSEPORT` on Ubuntu 16.04, therefore can't guarantee anything about the code. Use it at your own risk. * Update benchmarker.cr * update for vibora * fix routing -> type not required * add vibora * use gunicorn for sanic * use http://meinheld.org/ to enable async networking with django * reuse port on tornado * use meinheld / SO_REUSEPORT on django * use meinheld / SO_REUSEPORT on flask * Introducing Vibora (#285) * add vibora this code has been tested and it requires `SO_REUSEPORT` on Ubuntu 16.04, therefore can't guarantee anything about the code. Use it at your own risk. * Update benchmarker.cr * update for vibora * fix routing -> type not required * add vibora * use gunicorn for sanic * use http://meinheld.org/ to enable async networking with django * reuse port on tornado * use meinheld / SO_REUSEPORT on django * use meinheld / SO_REUSEPORT on flask --- README.md | 192 +++++++++++++++---------------- neph.yaml | 1 - python/japronto/requirements.txt | 7 +- python/vibora/Dockerfile | 2 +- python/vibora/requirements.txt | 4 - python/vibora/server.py | 9 +- tools/src/benchmarker.cr | 1 - 7 files changed, 101 insertions(+), 115 deletions(-) diff --git a/README.md b/README.md index 9f2ded92443..3d61a13531d 100644 --- a/README.md +++ b/README.md @@ -64,126 +64,124 @@ bin/benchmarker [tools] ## Results -Last update: 2018-07-04 +Last update: 2018-07-05 ``` -OS: Linux (version: 4.17.3-200.fc28.x86_64, arch: x86_64) -CPU Cores: 4 +OS: Linux (version: 4.16.11-100.fc26.x86_64, arch: x86_64) +CPU Cores: 8 ``` ### Ranking (Framework) 1. [actix-web](https://github.com/actix/actix-web) (rust) -2. [fasthttprouter](https://github.com/buaazp/fasthttprouter) (go) -3. [evhtp](https://github.com/criticalstack/libevhtp) (cpp) -4. [act](https://github.com/actframework/actframework) (java) -5. [aspnetcore](https://github.com/aspnet/Home) (csharp) -6. [mofuw](https://github.com/2vg/mofuw) (nim) -7. [rocket](https://github.com/SergioBenitez/Rocket) (rust) -8. [nickel](https://github.com/nickel-org/nickel.rs) (rust) -9. [iris](https://github.com/kataras/iris) (go) -10. [echo](https://github.com/labstack/echo) (go) -11. [gorilla-mux](https://github.com/gorilla/mux) (go) -12. [iron](https://github.com/iron/iron) (rust) -13. [japronto](https://github.com/squeaky-pl/japronto) (python) -14. [polka](https://github.com/lukeed/polka) (node) -15. [rayo](https://github.com/GetRayo/rayo.js) (node) -16. [akkahttp](https://github.com/akka/akka-http) (scala) -17. [fastify](https://github.com/fastify/fastify) (node) -18. [perfect](https://github.com/PerfectlySoft/Perfect) (swift) -19. [restify](https://github.com/restify/node-restify) (node) -20. [koa](https://github.com/koajs/koa) (node) -21. [router.cr](https://github.com/tbrand/router.cr) (crystal) +2. [evhtp](https://github.com/criticalstack/libevhtp) (cpp) +3. [fasthttprouter](https://github.com/buaazp/fasthttprouter) (go) +4. [vibora](https://github.com/vibora-io/vibora) (python) +5. [mofuw](https://github.com/2vg/mofuw) (nim) +6. [act](https://github.com/actframework/actframework) (java) +7. [iris](https://github.com/kataras/iris) (go) +8. [iron](https://github.com/iron/iron) (rust) +9. [aspnetcore](https://github.com/aspnet/Home) (csharp) +10. [rocket](https://github.com/SergioBenitez/Rocket) (rust) +11. [echo](https://github.com/labstack/echo) (go) +12. [gorilla-mux](https://github.com/gorilla/mux) (go) +13. [polka](https://github.com/lukeed/polka) (node) +14. [rayo](https://github.com/GetRayo/rayo.js) (node) +15. [nickel](https://github.com/nickel-org/nickel.rs) (rust) +16. [fastify](https://github.com/fastify/fastify) (node) +17. [akkahttp](https://github.com/akka/akka-http) (scala) +18. [koa](https://github.com/koajs/koa) (node) +19. [perfect](https://github.com/PerfectlySoft/Perfect) (swift) +20. [restify](https://github.com/restify/node-restify) (node) +21. [vapor](https://github.com/vapor/vapor) (swift) 22. [express](https://github.com/expressjs/express) (node) -23. [spider-gazelle](https://github.com/spider-gazelle/spider-gazelle) (crystal) -24. [lucky](https://github.com/luckyframework/lucky) (crystal) -25. [vapor](https://github.com/vapor/vapor) (swift) -26. [plug](https://github.com/elixir-lang/plug) (elixir) -27. [kitura](https://github.com/IBM-Swift/Kitura) (swift) -28. [amber](https://github.com/amberframework/amber) (crystal) -29. [kemal](https://github.com/kemalcr/kemal) (crystal) -30. [phoenix](https://github.com/phoenixframework/phoenix) (elixir) -31. [roda](https://github.com/jeremyevans/roda) (ruby) +23. [symfony](https://github.com/symfony/symfony) (php) +24. [plug](https://github.com/elixir-lang/plug) (elixir) +25. [roda](https://github.com/jeremyevans/roda) (ruby) +26. [phoenix](https://github.com/phoenixframework/phoenix) (elixir) +27. [laravel](https://github.com/laravel/framework) (php) +28. [kitura](https://github.com/IBM-Swift/Kitura) (swift) +29. [rack-routing](https://github.com/georgeu2000/rack-routing) (ruby) +30. [router.cr](https://github.com/tbrand/router.cr) (crystal) +31. [spider-gazelle](https://github.com/spider-gazelle/spider-gazelle) (crystal) 32. [gin](https://github.com/gin-gonic/gin) (go) -33. [symfony](https://github.com/symfony/symfony) (php) -34. [laravel](https://github.com/laravel/framework) (php) -35. [jester](https://github.com/dom96/jester) (nim) -36. [rack-routing](https://github.com/georgeu2000/rack-routing) (ruby) -37. [vibora](https://github.com/vibora-io/vibora) (python) +33. [lucky](https://github.com/luckyframework/lucky) (crystal) +34. [kemal](https://github.com/kemalcr/kemal) (crystal) +35. [amber](https://github.com/amberframework/amber) (crystal) +36. [flame](https://github.com/AlexWayfer/flame) (ruby) +37. [flask](https://github.com/pallets/flask) (python) 38. [hanami](https://github.com/hanami/hanami) (ruby) -39. [flask](https://github.com/pallets/flask) (python) -40. [flame](https://github.com/AlexWayfer/flame) (ruby) -41. [sinatra](https://github.com/sinatra/sinatra) (ruby) -42. [sanic](https://github.com/channelcat/sanic) (python) -43. [django](https://github.com/django/django) (python) -44. [tornado](https://github.com/tornadoweb/tornado) (python) -45. [rails](https://github.com/rails/rails) (ruby) +39. [sanic](https://github.com/channelcat/sanic) (python) +40. [sinatra](https://github.com/sinatra/sinatra) (ruby) +41. [jester](https://github.com/dom96/jester) (nim) +42. [django](https://github.com/django/django) (python) +43. [tornado](https://github.com/tornadoweb/tornado) (python) +44. [rails](https://github.com/rails/rails) (ruby) ### Ranking (Language) 1. rust ([actix-web](https://github.com/actix/actix-web)) -2. go ([fasthttprouter](https://github.com/buaazp/fasthttprouter)) -3. cpp ([evhtp](https://github.com/criticalstack/libevhtp)) -4. java ([act](https://github.com/actframework/actframework)) -5. csharp ([aspnetcore](https://github.com/aspnet/Home)) -6. nim ([mofuw](https://github.com/2vg/mofuw)) -7. python ([japronto](https://github.com/squeaky-pl/japronto)) +2. cpp ([evhtp](https://github.com/criticalstack/libevhtp)) +3. go ([fasthttprouter](https://github.com/buaazp/fasthttprouter)) +4. python ([vibora](https://github.com/vibora-io/vibora)) +5. nim ([mofuw](https://github.com/2vg/mofuw)) +6. java ([act](https://github.com/actframework/actframework)) +7. csharp ([aspnetcore](https://github.com/aspnet/Home)) 8. node ([polka](https://github.com/lukeed/polka)) 9. scala ([akkahttp](https://github.com/akka/akka-http)) 10. swift ([perfect](https://github.com/PerfectlySoft/Perfect)) -11. crystal ([router.cr](https://github.com/tbrand/router.cr)) +11. php ([symfony](https://github.com/symfony/symfony)) 12. elixir ([plug](https://github.com/elixir-lang/plug)) 13. ruby ([roda](https://github.com/jeremyevans/roda)) -14. php ([symfony](https://github.com/symfony/symfony)) +14. crystal ([router.cr](https://github.com/tbrand/router.cr)) ### All frameworks | Language (Runtime) | Framework (Middleware) | Requests / s | Latency | 99 percentile | Throughput | |---------------------------|---------------------------|----------------:|----------------:|----------------:|-----------:| -| ruby | rails | 3897.33 | 16534.67 | 106263.33 | 3.09 MB | -| ruby | sinatra | 14916.00 | 4291.67 | 46616.00 | 12.63 MB | -| ruby | roda | 36602.67 | 1832.33 | 29363.00 | 11.86 MB | -| ruby | rack-routing | 28413.00 | 2313.00 | 36260.00 | 5.00 MB | -| ruby | flame | 17715.33 | 3633.67 | 43025.67 | 3.41 MB | -| ruby | hanami | 18842.33 | 3393.67 | 43576.67 | 44.56 MB | -| crystal | kemal | 41926.00 | 23992.67 | 27337.67 | 19.55 MB | -| crystal | router.cr | 52502.00 | 19016.33 | 25307.00 | 14.52 MB | -| crystal | amber | 42250.67 | 23734.33 | 31710.00 | 16.82 MB | -| crystal | lucky | 45144.67 | 21964.33 | 30965.67 | 16.91 MB | -| crystal | spider-gazelle | 45683.33 | 22070.67 | 30138.33 | 12.40 MB | -| go | echo | 91679.33 | 14884.00 | 130063.00 | 52.89 MB | -| go | gorilla-mux | 88578.33 | 15630.33 | 128265.33 | 33.25 MB | -| go | iris | 96490.67 | 14569.00 | 146986.00 | 36.57 MB | -| go | fasthttprouter | 163260.00 | 5460.00 | 13554.33 | 75.39 MB | -| go | gin | 35908.00 | 34265.33 | 156813.67 | 18.90 MB | -| rust | actix-web | 181606.00 | 4728.00 | 14981.00 | 70.86 MB | -| rust | iron | 87743.33 | 349.33 | 1728.67 | 35.01 MB | -| rust | nickel | 103994.33 | 42.67 | 51.33 | 68.41 MB | -| rust | rocket | 105134.00 | 70.00 | 189.00 | 48.76 MB | -| node | express | 46936.67 | 48406.00 | 887460.33 | 38.92 MB | -| node | fastify | 65194.33 | 28248.67 | 534193.00 | 66.23 MB | -| node | polka | 78936.00 | 20722.67 | 349554.00 | 37.99 MB | -| node | rayo | 76292.67 | 19695.33 | 291678.00 | 37.52 MB | -| node | koa | 53626.33 | 39260.67 | 717946.00 | 38.31 MB | -| node | restify | 58412.00 | 21364.67 | 170594.67 | 34.25 MB | -| elixir | plug | 43322.33 | 51003.67 | 697155.67 | 27.79 MB | -| elixir | phoenix | 39391.67 | 40366.33 | 339262.00 | 26.50 MB | -| swift | vapor | 45001.67 | 61975.00 | 1368733.67 | 16.37 MB | -| swift | perfect | 63277.33 | 15729.00 | 19385.33 | 16.96 MB | -| swift | kitura | 42841.33 | 24383.67 | 100690.67 | 26.31 MB | -| scala | akkahttp | 67532.67 | 253080.67 | 4929728.00 | 50.81 MB | -| csharp | aspnetcore | 116722.33 | 8890.67 | 17008.67 | 60.83 MB | -| python | sanic | 14774.33 | 67164.67 | 125040.67 | 8.81 MB | -| python | japronto | 82049.67 | 12384.33 | 15956.33 | 32.21 MB | -| python | flask | 17787.00 | 59817.67 | 191245.00 | 15.38 MB | -| python | django | 11619.00 | 86205.00 | 197110.33 | 11.18 MB | -| python | tornado | 6978.33 | 228052.00 | 2947652.33 | 4.83 MB | -| python | vibora | 28263.00 | 51878.33 | 103748.00 | 20.07 MB | -| nim | jester | 29081.00 | 76547.00 | 1686765.67 | 10.50 MB | -| nim | mofuw | 115072.00 | 9772.00 | 46172.67 | 64.39 MB | -| java | act | 138152.33 | 9633.33 | 116304.00 | 74.13 MB | -| cpp | evhtp | 156938.67 | 5784.33 | 14014.33 | 50.92 MB | -| php | symfony | 32745.33 | 192165.67 | 2652773.33 | 52.94 MB | -| php | laravel | 30293.67 | 261373.00 | 3585675.67 | 47.73 MB | +| ruby | rails | 4929.00 | 26016.67 | 158555.33 | 4.52 MB | +| ruby | sinatra | 16960.67 | 7519.67 | 42064.67 | 14.24 MB | +| ruby | roda | 47429.00 | 2646.00 | 12115.00 | 14.64 MB | +| ruby | rack-routing | 35453.00 | 3694.67 | 28968.33 | 6.64 MB | +| ruby | flame | 21039.00 | 6116.00 | 43857.33 | 3.87 MB | +| ruby | hanami | 19916.67 | 6450.00 | 43367.33 | 47.11 MB | +| crystal | kemal | 26241.67 | 38333.00 | 53639.00 | 11.97 MB | +| crystal | router.cr | 32949.33 | 30163.67 | 48114.67 | 8.83 MB | +| crystal | amber | 25937.67 | 41523.33 | 191221.67 | 11.03 MB | +| crystal | lucky | 28037.00 | 35525.67 | 54591.00 | 10.06 MB | +| crystal | spider-gazelle | 32191.33 | 31266.67 | 50261.00 | 8.27 MB | +| go | echo | 97116.67 | 11351.33 | 50338.67 | 55.86 MB | +| go | gorilla-mux | 91919.00 | 10792.00 | 33209.33 | 34.45 MB | +| go | iris | 104709.00 | 9592.33 | 27661.00 | 39.20 MB | +| go | fasthttprouter | 169550.00 | 5936.00 | 17381.33 | 77.99 MB | +| go | gin | 28369.67 | 56173.00 | 313997.00 | 16.50 MB | +| rust | actix-web | 192814.33 | 4801.00 | 14455.33 | 72.33 MB | +| rust | iron | 104620.00 | 561.67 | 2507.00 | 39.56 MB | +| rust | nickel | 81319.67 | 103.00 | 297.33 | 48.74 MB | +| rust | rocket | 97964.33 | 139.67 | 829.67 | 41.30 MB | +| node | express | 55013.67 | 23975.67 | 264864.33 | 46.00 MB | +| node | fastify | 75240.00 | 17954.00 | 192346.00 | 75.39 MB | +| node | polka | 90443.33 | 14183.67 | 132408.33 | 45.32 MB | +| node | rayo | 87775.67 | 14052.33 | 113420.00 | 43.90 MB | +| node | koa | 61574.67 | 23661.00 | 342473.67 | 44.97 MB | +| node | restify | 58498.33 | 19266.67 | 127451.00 | 35.07 MB | +| elixir | plug | 49210.33 | 24896.33 | 142760.67 | 31.30 MB | +| elixir | phoenix | 45529.33 | 28456.67 | 211058.00 | 30.67 MB | +| swift | vapor | 55761.67 | 27291.00 | 441861.00 | 20.00 MB | +| swift | perfect | 59168.33 | 16478.67 | 20715.00 | 16.88 MB | +| swift | kitura | 35671.33 | 29004.00 | 85609.33 | 20.35 MB | +| scala | akkahttp | 64432.33 | 206881.33 | 4339488.67 | 49.93 MB | +| csharp | aspnetcore | 99514.33 | 10163.67 | 30573.33 | 52.31 MB | +| python | sanic | 18267.00 | 56052.00 | 159447.33 | 10.71 MB | +| python | flask | 20657.67 | 52338.33 | 148850.67 | 17.11 MB | +| python | django | 12434.67 | 82708.33 | 198759.00 | 11.58 MB | +| python | tornado | 8666.67 | 112379.33 | 170080.00 | 6.16 MB | +| python | vibora | 144485.00 | 8425.67 | 22648.00 | 67.71 MB | +| nim | jester | 16642.33 | 240892.33 | 4590197.00 | 6.24 MB | +| nim | mofuw | 125784.67 | 9016.33 | 56692.00 | 71.40 MB | +| java | act | 125644.00 | 10037.67 | 68708.33 | 46.15 MB | +| cpp | evhtp | 170223.33 | 5423.33 | 14555.33 | 54.59 MB | +| php | symfony | 49262.33 | 180582.00 | 2693203.00 | 77.60 MB | +| php | laravel | 45492.67 | 256662.67 | 4052371.33 | 70.55 MB | ## How to contribute ? diff --git a/neph.yaml b/neph.yaml index 5764199e1ea..3f8e89c74eb 100644 --- a/neph.yaml +++ b/neph.yaml @@ -40,7 +40,6 @@ nim: python: dependencies: - flask - - japronto - django - sanic - tornado diff --git a/python/japronto/requirements.txt b/python/japronto/requirements.txt index e6a5e7cfc53..f753aa44ae6 100644 --- a/python/japronto/requirements.txt +++ b/python/japronto/requirements.txt @@ -1,6 +1 @@ -appdirs==1.4.3 -japronto==0.1.1 -packaging==17.1 -pyparsing==2.2.0 -six==1.11.0 -uvloop==0.8.1 +-e git+https://github.com/squeaky-pl/japronto.git#egg=japronto diff --git a/python/vibora/Dockerfile b/python/vibora/Dockerfile index 69efd43a482..317b6018ff4 100644 --- a/python/vibora/Dockerfile +++ b/python/vibora/Dockerfile @@ -1,4 +1,4 @@ -FROM python +FROM python:3.6 WORKDIR /usr/src/app diff --git a/python/vibora/requirements.txt b/python/vibora/requirements.txt index 60a0005a642..c8cdfd89c08 100644 --- a/python/vibora/requirements.txt +++ b/python/vibora/requirements.txt @@ -1,5 +1 @@ -python-dateutil==2.6.1 -pendulum==2.0.2 -ujson==1.35 -uvloop==0.10.2 vibora==0.0.6 diff --git a/python/vibora/server.py b/python/vibora/server.py index 24f6bd0ad32..9064326e5ec 100644 --- a/python/vibora/server.py +++ b/python/vibora/server.py @@ -4,16 +4,15 @@ @app.route('/') async def index(): - return Response(b'', headers={'content-type': 'html'}) + return Response(b'') @app.route("/user/", methods=['GET']) async def user_info(id : int): - return Response(f'{id}', headers={'content-type': 'html'}) - + return Response(f'{id}') @app.route("/user", methods=['POST']) async def user(): - return Response(b'', headers={'content-type': 'html'}) + return Response(b'') if __name__ == '__main__': - app.run(debug=True, host='0.0.0.0', port=3000) + app.run(host='0.0.0.0', port=3000, debug=False) \ No newline at end of file diff --git a/tools/src/benchmarker.cr b/tools/src/benchmarker.cr index f440eea8c0c..de953516345 100644 --- a/tools/src/benchmarker.cr +++ b/tools/src/benchmarker.cr @@ -97,7 +97,6 @@ LANGS = [ ]}, {lang: "python", targets: [ {name: "sanic", repo: "channelcat/sanic"}, - {name: "japronto", repo: "squeaky-pl/japronto"}, {name: "flask", repo: "pallets/flask"}, {name: "django", repo: "django/django"}, {name: "tornado", repo: "tornadoweb/tornado"},