Comments (1)
@SoundsSerious There isn't a performance suite for Klein; and at least in this configuration, this is probably "correct", in that it's fairly slow out of the box. To the extent that these benchmarks show something useful, it's that they highlight a fairly naive and poorly-performing default for the way Klein is set up.
However, looking more closely at the wild disparity between these numbers, we can see other frameworks that do advertise high performance (particularly Sanic, whose whole reason for existing is performance) doing worse than Klein, which seems odd. So if you look into the benchmark source code, you can see that by far the dominant factor in performance here is the presence or absence of a multi-process configuration that allows the framework to leverage multiple cores, both in terms of its own CPU performance and in terms of parallelism to the database.
In contrast, the Klein benchmark (in the same style as the other very poorly-performing ones) is set up as a single worker making blocking calls to a database; they're not even using an async DB driver. Now, again, the benchmarks do highlight the fact that some frameworks just give you a "workers" tunable, and Klein forces the application developer to invent their own concurrency model using primitives from Twisted, or tools like Ampoule, which is very much not obvious. So there's definitely work to do here but it's probably not "optimizing" Klein until a ton of other stuff to just utilize the hardware that you've got has been put in place. FWIW the places I've used Klein in production, we did put a multiprocess worker pool in front of it, so it's far from impossible, but yeah, a quick microbenchmark like this is probably always going to make us look bad.
I'm closing this because it's not specifically actionable on its own, but we'd love contributions of benchmarks we can regression test against, performance enhancements we could integrate, and some code that would allow users to easily configure a multi-core multi-listener setup, so please don't take this as a rejection of "performance" broadly, I just don't want to leave vague issues lying around forever without a specific plan that defines what 'done' would mean. And performance could always be better, even if we were to somehow make it to the top of this chart we wouldn't stay there automatically.
from klein.
Related Issues (20)
- Death to you garbage mainstream propaganda slaves
- Twisted fools, hope you have a tragic life and painful death.
- AttributeError: module 'OpenSSL.SSL' has no attribute 'TLS_METHOD' HOT 2
- Fix CI
- Klein does not work with Werkzeug 2.3
- Python 3.11 support
- Why "405 Method Not Allowed" ? HOT 3
- ReadTheDocs is showing old version of docs HOT 2
- release instructions as written do not actually issue a prerelease
- (maybe) put hypothesis back HOT 4
- the merge queue needs help from our status checks to actually work
- tox 4 usually hangs when I run tests locally HOT 1
- Returning a static file from a route that matches all URLs behaves unexpectedly
- Accessing the `installSignalHandlers` parameter of the `reactor.run()` method HOT 1
- Any way to do send_file like Flask HOT 1
- update to mypy 1.7 HOT 1
- spin release infrastructure out to a separate project
- version update, release, and push happen in the wrong order in release infrastructure HOT 1
- How to use ProxyFix with klein? HOT 1
- add documentation for using treq.testing to test klein applications HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from klein.