"According to the Sanic author’s benchmark, uvloop could power this beast to handle more than 33k requests/s which is just insane (and faster than node.js)."
I keep looking for excuses to focus on Python instead of Go and claims like this one make me happy. However, when I check the benchmarks I get confused:
But, even if in the request/second area Python might be doing great now, won't there be problem down the line with the GIL? That is, isn't async/await an island of good performance?
So rarely is speed actually needed. If you need the speed though, just write a library in C/Fortran/Go and call it from Python. That way you can do all your business logic where it's easy and very fast (Python) and still have room for crazy fast (Go, C) if you need it. Most real applications bottleneck in the database though, not the language.
That's certainly one way to interpret "pure Python" but many people use that phrase to describe code that is using only builtins and standard library as opposed to community-supplied C extensions.
The TechEmpower benchmarks should be taken with a grain of salt because, in the specific case of Python, and last year at least, they didn't seem to take into account real-life deployments (i.e., they're benchmarking raw scripts instead of a WSGI app running inside gunicorn or uwsgi, either of which has its own threading model and performance improvements).
However, Go and Java will handily beat Python any day, even with uvloop -- all you need to do is try to do a little more processing inside your HTTP handler, aaaaannnnddd thiiiingggsss willl sloooowww dooooowwwwnnnn....
TechEmpower uses gunicorn/nginx [1] for Python frameworks, and has since 2014.
>> all you need to do is try to do a little more processing inside your HTTP handler
Unless you're working with an external service like a relational database, in which case performance between Go/Java and Python will be comparable [2]. If you don't need to leave your process, Go/Java will flatten Python.
For simple API things it definitely is significantly faster than anything else python has to offer. I am not sure where the author got the node comparison from, but all the python benchmarks are provided https://github.com/channelcat/sanic with the code used to run them. These are also single process benchmarks on a AWS medium (not sure what type). And I believe (best I can tell) those techempower benchmarks are run on a 40 core bare metal machine.
I've been using sanic+uvloop+aiozmq (current public draft: https://github.com/rcarmo/newsfeed-corpus) and am quite pleased with this setup for building fast (for Python) asynchronous apps.
The async/await thing is still a bit half-baked (I can't wait for 3.6 to arrive with more bits, including async generators), but I can see myself using this more and more -- just don't expect Go-like performance from this setup for anything but simple processing, since Python is still slow (and 3.x all the more so until PyPy 3 becomes a reality).
As to the rest of the libraries mentioned, I can't really fault the selection. I'm still using Python largely because of the ecosystem and sane deployment options, so I'm always happy to find new, decent libraries.
Couple of reasons: it's new, it's shiny, it holds the promise of doing super awesome stuff, it's really hard to get right and if you've explored the language enough, it's one more facet to explore.
I don't get a lot out of those awesome lists. Not enough is done to filter them...what would greatly help is to arrange the list as a table, with Github stars, number of issues, committers, and weeks since last update.
There are a bunch of apps who can manage your github stars (i can't remember which one i use, something like "night sky" maybe? Am on mobile). I periodically review and tag them so they're easy to find when i start a new project. Then I check my Pinboard.
I wish someone would make an app that merged Github, Bitbucket, Gitlab, Pinboard and similar dev-oriented collections.
> Is that an issue for anyone else -- that you can't remember all these libraries exist when you need them?
Yep. I just star them on github and hope that when I need one, I can remember that I starred something like that some time ago. It has worked a few times. But surely there must be better ways?
> I guess that what awesome-{python, PHP, golang, etc} are for, right?
Not sure. There are some cool ones but plenty of them are pretty crappy dump of links of very varying quality for the internet points (i.e. github stars) :/ (no offense to people who publish them!)
Thanks, quite a lot of libraries I wasn't aware of (probably coz I haven't needed them yet! I still prefer perl for quite-n-dirty scripts, but one of these days I should try to do the same with python instead).
hug is great fun to work with, and with just a little abuse works great for a normal website frontend too - but provides you with a canonical endpoint list, and decent typing.
hug (like Falcon) has way lot of "magic". It seems to be a trend (at least in python webdev world). I have mixed feelings about this.
Hug appears to be one of those things that is great when all you're doing is very simple but quickly turn into morass of fighting the opinions and magic of framework when doing anything "real".
Also (good) CLI is so different than HTTP that I see only sadness in mashing them into same interface. like having to repeat large amounts of boilerplate decorators to get it to do what you need. The chaining seems it would help with boilerplate at least.
Still, I hope I'm wrong. I want to have a hug. Falcon's lack of validation and documentation means it solves only about 10% of the problem.
I keep looking for excuses to focus on Python instead of Go and claims like this one make me happy. However, when I check the benchmarks I get confused:
http://www.techempower.com/benchmarks/#section=data-r13&hw=p...
Of course this looks amazing:
https://magic.io/blog/uvloop-blazing-fast-python-networking/
But, even if in the request/second area Python might be doing great now, won't there be problem down the line with the GIL? That is, isn't async/await an island of good performance?