Added bottle and kyoukai benchmarks, updated sanic and aiohttp
This commit is contained in:
parent
4ab5ee36de
commit
41d31b9e55
|
@ -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 |
|
| 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 |
|
| Wheezy | gunicorn + meinheld | 20,244 | 4.94ms |
|
||||||
| Falcon | gunicorn + meinheld | 18,972 | 5.27ms |
|
| Falcon | gunicorn + meinheld | 18,972 | 5.27ms |
|
||||||
|
| Bottle | gunicorn + meinheld | 13,596 | 7.36ms |
|
||||||
| Flask | gunicorn + meinheld | 4,988 | 20.08ms |
|
| 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
|
## Hello World
|
||||||
|
|
||||||
|
|
|
@ -7,3 +7,4 @@ coverage
|
||||||
tox
|
tox
|
||||||
gunicorn
|
gunicorn
|
||||||
bottle
|
bottle
|
||||||
|
kyoukai
|
||||||
|
|
|
@ -4,12 +4,13 @@ from aiohttp import web
|
||||||
import asyncio
|
import asyncio
|
||||||
import sys
|
import sys
|
||||||
import uvloop
|
import uvloop
|
||||||
|
import ujson as json
|
||||||
|
|
||||||
loop = uvloop.new_event_loop()
|
loop = uvloop.new_event_loop()
|
||||||
asyncio.set_event_loop(loop)
|
asyncio.set_event_loop(loop)
|
||||||
|
|
||||||
async def handle(request):
|
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 = web.Application(loop=loop)
|
||||||
app.router.add_route('GET', '/', handle)
|
app.router.add_route('GET', '/', handle)
|
||||||
|
|
|
@ -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
|
from bottle import route, run
|
||||||
import ujson
|
import ujson
|
||||||
|
|
||||||
|
@ -6,5 +8,4 @@ import ujson
|
||||||
def index():
|
def index():
|
||||||
return ujson.dumps({'test': True})
|
return ujson.dumps({'test': True})
|
||||||
|
|
||||||
|
app = bottle.default_app()
|
||||||
run(server='gunicorn', host='0.0.0.0', port=8080)
|
|
||||||
|
|
20
tests/performance/kyoukai/simple_server.py
Normal file
20
tests/performance/kyoukai/simple_server.py
Normal file
|
@ -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()
|
Loading…
Reference in New Issue
Block a user