diff --git a/uasyncio/benchmark/test-ab-light.sh b/uasyncio/benchmark/test-ab-light.sh new file mode 100755 index 00000000..bf929862 --- /dev/null +++ b/uasyncio/benchmark/test-ab-light.sh @@ -0,0 +1,12 @@ +#!/bin/sh +# +# This in one-shot scripts to test "light load" uasyncio HTTP server using +# Apache Bench (ab). +# + +micropython -O test_http_server_light.py & +sleep 1 + +ab -n10000 -c100 http://localhost:8081/ + +kill %1 diff --git a/uasyncio/benchmark/test_http_server_light.py b/uasyncio/benchmark/test_http_server_light.py new file mode 100644 index 00000000..48befebd --- /dev/null +++ b/uasyncio/benchmark/test_http_server_light.py @@ -0,0 +1,21 @@ +import uasyncio as asyncio + + +@asyncio.coroutine +def serve(reader, writer): + #print(reader, writer) + #print("================") + yield from reader.read() + yield from writer.awrite("HTTP/1.0 200 OK\r\n\r\nHello.\r\n") + yield from writer.close() + #print("Finished processing request") + + +import logging +#logging.basicConfig(level=logging.INFO) +logging.basicConfig(level=logging.DEBUG) +loop = asyncio.get_event_loop() +mem_info() +loop.call_soon(asyncio.start_server(serve, "127.0.0.1", 8081, backlog=100)) +loop.run_forever() +loop.close()