Is CherryPy a robust webserver (ie, is it reliable under a huge load like Apache)?
Asked Answered
T

2

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?

Thomson answered 10/2, 2010 at 22:7 Comment(0)
C
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.

Conservatory answered 10/2, 2010 at 22:14 Comment(1)
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 problemsVauban
M
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.

Mayfair answered 10/2, 2010 at 22:41 Comment(2)
@Mayfair 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?Thomson
@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.Mayfair

© 2022 - 2024 — McMap. All rights reserved.