Put another way - when you think of python for web applications / services - do you think rapid development and speed, or just rapid development and you would go somewhere else for speed?
Put another way - when you think of python for web applications / services - do you think rapid development and speed, or just rapid development and you would go somewhere else for speed?
At reddit we solved the problem by writing the most often called parts in C and using c extensions. There is definitely more work to do there, but overall I think Python gets a bad rap as far as speed is concerned.
It's certainly not the quickest, but it isn't a dog either.
I'm wondering if anyone has solved these sorts of problems with Cython in the real world. It looks like a great solution for a large set of problems in terms of Python performance, since it becomes a CPython extension, but I never hear anyone talk about it. Can anyone chime in?
The entire scientific Python ecosystem has basically moved on to Cython. Its use is quite prevalent, and it's basically displacing SWIG as the preferred wrapping tool of choice.
The whole web application is not CPU bound. The parts which are CPU intensive are rewritten in performant language. For eg, if you are twitter, you still render templates in Rails, and write CPU bound services in Java/Scala. Replacing the whole app with Scala/Java will be pointless.
That doesn't mean that every time you need a service, you can't use Ruby/Python. If all your API server does is check cache for data, load data if there is a cache miss, encode json and return it, Python/Ruby will do just fine.
Why? The apps are mostly IO bound, and any large site is going to be caching, deferring slow operations, and sharding/breaking into tiers, cdns, etc, etc. The amount of time a web framework actually runs is relatively small.
Others have already mentioned what to do when performance is a problem.