sanic/tests/performance/aiohttp/simple_server.py
Andrew Svetlov 0822674f70 aiohttp is slightly faster actually
Disabling access log increases RPS a lot
2016-11-11 22:36:49 +02:00

19 lines
449 B
Python

# Run with python3 simple_server.py PORT
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.Response(body=json.dumps({"test":True}).encode('utf-8'), content_type='application/json')
app = web.Application(loop=loop)
app.router.add_route('GET', '/', handle)
web.run_app(app, port=sys.argv[1], access_log=None)