Added bottle and kyoukai benchmarks, updated sanic and aiohttp

This commit is contained in:
Channel Cat
2016-10-16 00:50:49 -07:00
parent 4ab5ee36de
commit 41d31b9e55
5 changed files with 30 additions and 5 deletions

View File

@@ -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)

View File

@@ -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()

View 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()