Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch meiheld #352

Merged
merged 1 commit into from
Sep 7, 2018
Merged

Patch meiheld #352

merged 1 commit into from
Sep 7, 2018

Conversation

waghanza
Copy link
Collaborator

@waghanza waghanza commented Sep 7, 2018

Hi,

Following bottlepy/bottle#1091, this PR patch meinheld.

Thanks @agalera 🎉

Regards,

@waghanza waghanza self-assigned this Sep 7, 2018
@waghanza waghanza changed the title Pacth meiheld Patch meiheld Sep 7, 2018
@waghanza waghanza assigned waghanza and unassigned waghanza Sep 7, 2018
@waghanza
Copy link
Collaborator Author

waghanza commented Sep 7, 2018

I use this feature also for flask

Framework (Middleware) Average 50% percentile 90% percentile 99% percentile 99.9% percentile Standard deviation Requests / s Throughput
bottle (unpatched) 22.18 ms 18.03 ms 37.88 ms 75.21 ms 324.32 ms 15796.33 48441.00 119.39 MB
flask (unpatched) 52.62 ms 37.67 ms 110.96 ms 158.00 ms 632.17 ms 41189.67 20414.67 50.18 MB
bottle (patched) 21.00 ms 13.69 ms 41.86 ms 90.58 ms 282.19 ms 18187.67 53832.67 132.67 MB
flask (patched) 54.46 ms 38.40 ms 109.36 ms 166.15 ms 394.67 ms 36173.33 19572.00 48.09 MB

For bottle this patch is 🎉 but not sure if flask should be patched

@waghanza
Copy link
Collaborator Author

waghanza commented Sep 7, 2018

@agalera @benoitc any idea about the performance diff ? any help will be ❤️

@waghanza waghanza merged commit 604906d into the-benchmarker:master Sep 7, 2018
@waghanza waghanza deleted the patch_meinheld branch September 7, 2018 20:30
@agalera
Copy link

agalera commented Sep 11, 2018

in bottle should not be patched for errors in the response (bottlepy/bottle#896).
Bottle is much faster than Flask, this is normal.

If you want to improve the performance by returning answers in json format, you can install ujson is an optional requirement that makes bottle serialize much faster.

@defnull maybe I can contribute something more

@defnull
Copy link

defnull commented Sep 11, 2018

Bottle is a lot faster than flask, this is also visible in other benchmarks. And yes, ujson is automatically picked up, if present, and used for faster json processing. That's a cheap boost for json-heavy APIs.

I'm not sure if this would be fair in a benchmark, though. Bottle is advertised as a zero-dependency framework, after all. And already faster than most ;)

@waghanza
Copy link
Collaborator Author

@defnull Why ? Flask and bottle are python framework and their are running both under gunicorn and meinheld

@waghanza
Copy link
Collaborator Author

@agalera In fact, we wan this benchmark as simple as possible, as for now we are just using 3 rules, see #221 (comment)

@defnull
Copy link

defnull commented Sep 11, 2018

Bottle does only whats necessary and is written in a very dense, minimalistic way. I have also spent a lot of time to tune the important parts. For example, bottle bundles route regular expressions and can check up to 100 routes with a single re.find call. It's carefully optimized for speed from day one.

Flask, on the other hand, is based on werkzeug, which is a great peace of software, but kind of over-engineered in many places. Lots of classes, abstractions, small functions, deep call stacks. This overhead adds up. In a compiled language, optimizers would get rid of the abstraction overhead. In Python, abstractions always come at a cost.

There are faster WSGI frameworks than Bottle, but most of them 'cheat' by implementing parts in Cython or wrapping C libraries, or do way less than Bottle and are IMHO less useful.

@waghanza
Copy link
Collaborator Author

I understand the performance gap, but it's always useful to have some figures.

aichholzer added a commit that referenced this pull request Sep 18, 2018
* patch meinheld to replace default socket by built-in code (#352)
* Code of conduct
waghanza added a commit to qti3e/web-frameworks that referenced this pull request Oct 5, 2018
waghanza pushed a commit to qti3e/web-frameworks that referenced this pull request Oct 5, 2018
* patch meinheld to replace default socket by built-in code (the-benchmarker#352)
* Code of conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants