diff --git a/README.md b/README.md index e268881f..76fba594 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,13 @@ All tests were run on a AWS medium instance running ubuntu, using 1 process. Ea | Server | Implementation | Requests/sec | Avg Latency | | ------- | ------------------- | ------------:| -----------:| -| Sanic | Python 3.5 + uvloop | 29,128 | 3.40ms | +| Sanic | Python 3.5 + uvloop | 30,601 | 3.23ms | | Wheezy | gunicorn + meinheld | 20,244 | 4.94ms | | Falcon | gunicorn + meinheld | 18,972 | 5.27ms | +| Bottle | gunicorn + meinheld | 13,596 | 7.36ms | | Flask | gunicorn + meinheld | 4,988 | 20.08ms | -| Aiohttp | Python 3.5 + uvloop | 2,974 | 33.49ms | +| Kyoukai | Python 3.5 + uvloop | 3,889 | 27.44ms | +| Aiohttp | Python 3.5 + uvloop | 2,979 | 33.42ms | ## Hello World diff --git a/requirements-dev.txt b/requirements-dev.txt index 66e700e3..66246850 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -7,3 +7,4 @@ coverage tox gunicorn bottle +kyoukai diff --git a/tests/performance/aiohttp/simple_server.py b/tests/performance/aiohttp/simple_server.py index e8afce66..8cb97b33 100644 --- a/tests/performance/aiohttp/simple_server.py +++ b/tests/performance/aiohttp/simple_server.py @@ -4,12 +4,13 @@ from aiohttp import web import asyncio import sys import uvloop +import ujson as json loop = uvloop.new_event_loop() asyncio.set_event_loop(loop) async def handle(request): - return web.json_response({"test":True}) + return web.Response(body=json.dumps({"test":True}).encode('utf-8'), content_type='application/json') app = web.Application(loop=loop) app.router.add_route('GET', '/', handle) diff --git a/tests/performance/bottle/simple_server.py b/tests/performance/bottle/simple_server.py index 23aab427..d562350a 100644 --- a/tests/performance/bottle/simple_server.py +++ b/tests/performance/bottle/simple_server.py @@ -1,3 +1,5 @@ +# Run with: gunicorn --workers=1 --worker-class=meinheld.gmeinheld.MeinheldWorker -b :8000 simple_server:app +import bottle from bottle import route, run import ujson @@ -6,5 +8,4 @@ import ujson def index(): return ujson.dumps({'test': True}) - -run(server='gunicorn', host='0.0.0.0', port=8080) +app = bottle.default_app() diff --git a/tests/performance/kyoukai/simple_server.py b/tests/performance/kyoukai/simple_server.py new file mode 100644 index 00000000..058514f7 --- /dev/null +++ b/tests/performance/kyoukai/simple_server.py @@ -0,0 +1,20 @@ +# Run with: python3 -O simple_server.py +import asyncio +from kyoukai import Kyoukai, HTTPRequestContext +import logging +import ujson +import uvloop + +loop = uvloop.new_event_loop() +asyncio.set_event_loop(loop) + +kyk = Kyoukai("example_app") + +logger = logging.getLogger("Kyoukai") +logger.setLevel(logging.ERROR) + +@kyk.route("/") +async def index(ctx: HTTPRequestContext): + return ujson.dumps({"test":True}), 200, {"Content-Type": "application/json"} + +kyk.run() \ No newline at end of file