dymmond / lilya

Yet another ASGI toolkit that delivers
https://lilya.dev
MIT License
35 stars 4 forks source link

lilya is almost 5x slow compared to blacksheep #71

Closed NobinKhan closed 2 months ago

NobinKhan commented 2 months ago

The starting point for issues should usually be a discussion...

https://github.com/dymmond/lilya/discussions

Potential bugs may be raised as a "Potential Issue" discussion. The feature requests may be raised as an "Ideas" discussion.

We can then decide if the discussion needs to be escalated into an "Issue" or not.

This will make sure that everything is organised properly.

lilya version: 0.8.0 Python version: 3.12.3 OS: Linux Fedora 40 Platform: x86/x64

I have run hello-world project in both lilya and blacksheep with Granian instead of uvicorn. For testing i have used oha (rust library).

Requests/sec: blacksheep: 10597 lilya: 2047

tarsil commented 2 months ago

@NobinKhan thank you for this but what was the measurements used? We need to use those and to make sure we actually improve these, we would also appreciate where the bottlenecks were found and we could probably work together to improve those?

Backsheep is known for being very fast, perhaps the fastest in python due to their internals and possible C api implementation.

NobinKhan commented 2 months ago

@NobinKhan thank you for this but what was the measurements used? We need to use those and to make sure we actually improve these, we would also appreciate where the bottlenecks were found and we could probably work together to improve those?

Backsheep is known for being very fast, perhaps the fastest in python due to their internals and possible C api implementation.

Sorry to say but i don't know about what is the bottleneck and what is measurement. I am not good at programming or understanding high level concepts. I just ran them with basic intro found in docs.

tarsil commented 2 months ago

@NobinKhan thank you. Let us run on our side and come back to you with proper insights

NobinKhan commented 2 months ago

@tarsil Thanks to you for such a great framework. I mostly liked it's architecture and modular system.

tarsil commented 2 months ago

@NobinKhan we are the ones thank you for the preference. We designed exactly with that in mind. To be elegant, modular, simpler and pluggable. So glad you enjoy

tarsil commented 2 months ago

@NobinKhan can you share the oho command you use? By this, I mean parameters used to run the bench?

tarsil commented 2 months ago

@NobinKhan we found one bootleneck that is already addressed that will improve the performance again, it was a newly introduced middleware for the settings but that is already being merged. In terms of performance both are really really fast but we want to make lilya extremely fast :D

I hope you enjoy

NobinKhan commented 2 months ago

@tarsil sorry I was not available for my job and project works. The oha command i used is oha -n 300000 -c 500 http://127.0.0.1:8000/ Thanks for your great work and i am really happy to hear that it's already fixed. I can't wait to try this.. Thanks again.

tarsil commented 2 months ago

@NobinKhan fixed yes but not yet deployed (released) but bare in mind that blacksheep uses c bindings and Lilya does not so ultimately it will be a bit slower (depending on what you want) that BSheep but Lilya does different things than blacksheep anyway and its design is also different.

tarsil commented 2 months ago

@NobinKhan is it all good?