13

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?

Craig McQueen
  • 41,871
  • 30
  • 130
  • 181
orokusaki
  • 55,146
  • 59
  • 179
  • 257

2 Answers2

19

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
  • 10,343
  • 1
  • 41
  • 43
  • 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 Feb 10 '10 at 22:25
4

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
  • 384,516
  • 81
  • 508
  • 779
  • @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 Feb 11 '10 at 06:30
  • 1
    @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 Feb 11 '10 at 11:05