1 comment

[ 3.4 ms ] story [ 14.8 ms ] thread
After starting the project called socketify.py at https://github.com/cirospaciari/socketify.py, I got pretty good results and reviews, but many people asked if socketify.py could be used to create a WSGI and ASGI server. WSGI and ASGI have a lot of overhead, that's is why I choose not to use them in the first place, but adding an ASGI and WSGI server allows a lot of code already written to run faster!

The focus of socketify is PyPy not because it allows for more CPU-intensive workloads, but because it also allows removing a lot of overhead of CPython itself!

The performance targets for ASGI with CPython were the same as uvicorn for ASGI and meinheld for WSGI, and I am happy to say that we got it to be faster in most cases and at least on pair in the worst case! Socketify ASGI 541,645 vs uvicorn 337,265 in CPython every single framework got a performance boost in WSGI and/or ASGI.

Falcon is the only one that is a little bit faster in WSGI with meinheld using CPython but socketify WSGI managed to get into the same ballpark of performance.

Using with PyPy we are the fastest ASGI and WSGI in all scenarios with a HUGE margin.

Falcon manage to pass the 1 million requests/s mark, and Flask and Django are faster than ever socketify WSGI,

FastAPI from 165k using uvicorn + gunicorn goes to 423k using socketify ASGI with PyPy

Emmett from 208k using uvicorn + gunicorn goes to 558k using socketify ASGI with PyPy

Falcon is the ASGI champion in throughput with 625k requests/s