I'm wondering because CherryPy is, from my knowledge, built purely in Python, which is obviously slower than C et al. Does this mean that it's only good for dev / testing environments, or could I use it behind NGINX like I use Apache with Fast CGI currently?
views:
396answers:
2
+8
A:
CherryPy's WSGI server is about as fast as a pure-Python WSGI server is going to get. I personally use it behind Nginx in production, but even standalone on my dev machine I can load each instance with several hundred requests / sec. without problems.
Can you find a faster server? Yes. Is CherryPy a robust web server, and good enough for most people to use in production? Yes.
Michael Greene
2010-02-10 22:14:18
Yes, basically it's like this: you can't use it to run something huge like facebook, but you can run your blog on it with no problems
Earlz
2010-02-10 22:25:55
Great answer. I'll look more into it now. I like using pure Python tools. I feel like I'm helping somehow this way (when actually I'm just increasing their trunk's bandwidth usage :).
orokusaki
2010-02-10 22:31:27
@Earlz I'm not looking to run anything on the scale of "monster social app", but certainly a ton bigger than a blog (unless you mean like smashingmagazine.com or something big like that).
orokusaki
2010-02-10 22:32:19
+3
A:
You should probably consider Apache + mod_wsgi as the standard front-end for any Python-based web application.
You do not want to serve any static content (.CSS, .JPEG, etc.) from any Python-based application; you want static files served by Apache.
You want the dynamic HTML page handle separately by the mod_wsgi daemon.
S.Lott
2010-02-10 22:41:45
@S.Lott I usually only serve static files with NGINX (handles quite a bit more concurrent requests than Apache) but I proxy back to Apache with proxy_pass so I can still enjoy the benefits of a keep-alive for a few seconds. I've not tried mod_wsgi though. I'm using Flup and FCGI. I've also tried the trash that is mod_python, pfff. When you scale really big it saves you a ton of resources (but wastes a bit on smaller projects). What are some of the drawbacks of using mod_wsgi, if any?
orokusaki
2010-02-11 06:30:03
@orkuski: CherryPy is already WSGI-compatible. There's no drawback to mod_wsgi, since it allows you to either plug directly into Apache or run a separate daemon. Since you're already using a WSGI framework, it simplifies things even further. Don't proxy back to Apache, use daemon mode and have Apache do all the work for you.
S.Lott
2010-02-11 11:05:03