can't reproduce benchmark, get only 10% of RPS using bench/socketify_plaintext.py #216
-
Describe the bug To Reproduce
Expected behavior import os
from socketify import App
def run_app():
app = App(request_response_factory_max_items=200_000)
router = app.router()
@router.get("/")
async def home(res, req):
res.send(b"Hello, World!")
app.listen(
8000,
lambda config: print(
"PID %d Listening on port http://localhost:%d now\n"
% (os.getpid(), config.port)
),
)
app.run()
def create_fork():
n = os.fork()
# n greater than 0 means parent process
if not n > 0:
run_app()
# fork limiting the cpu count - 1
# for i in range(1, multiprocessing.cpu_count()):
# create_fork()
if __name__ == "__main__":
run_app() # run app on the main process too :) wrk -t4 -c64 http://localhost:8000
Running 10s test @ http://localhost:8000
4 threads and 64 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.87ms 221.20us 11.43ms 96.59%
Req/Sec 18.56k 1.36k 32.00k 79.75%
738552 requests in 10.06s, 97.90MB read
Requests/sec: 73406.05
Transfer/sec: 9.73MB compared to a naive asgi from starlette.responses import Response
async def naive(scope, receive, send):
content = "hello, world".encode()
await Response(content)(scope, receive, send) wrk -t4 -c64 http://localhost:8000
Running 10s test @ http://localhost:8000
4 threads and 64 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 0.91ms 840.99us 35.45ms 99.39%
Req/Sec 18.10k 0.95k 29.63k 93.03%
724043 requests in 10.10s, 35.22MB read
Requests/sec: 71691.43
Transfer/sec: 3.49MB Desktop (please complete the following information): |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 11 replies
-
what is your hardware? python version, pypy version? I would stay with TechEmPower benchmarks and use they hardware to see performance. |
Beta Was this translation helpful? Give feedback.
You are also ignoring this part: https://github.com/uNetworking/uSockets/blob/master/src/internal/eventing/epoll_kqueue.h
again no ideia where the 150K RPS number is coming from, like I said before the benchmarks depends on multiple variables, like hardware, operation system, load/pipelining. If is there a problem with TechEmPower numbers please open an Issue in they repo, running they tools locally on your hardware properly will compare all frameworks that you wanna using the same script and you will see a number that matchs your hardware, if you run it in other hardware the numbers will be different, jus…