I’m building a Python web application with CherryPy and I keep reading that it’s better to put a web server like nginx or apache in front of it. But when I ran some performance tests on my app that does database queries and serves both static files and dynamic pages, I got surprising results.
CherryPy by itself was actually 2x faster than using nginx with memcached, and about 1.5x faster than lighttpd. I made sure both nginx and lighttpd were properly set up to handle static files directly.
I didn’t test apache because I’m planning to deploy on a small VPS with limited resources.
Given these results, I have two questions:
- Is it okay to run CherryPy standalone for now since I won’t need multiple servers anytime soon?
- When I do need to scale to multiple servers later, which reverse proxy gives the best performance?
Interesting results! What load did you test with? Did you try any SSL termination scenarios? How did memory usage compare between setups?
Running CherryPy standalone is totally fine for what you’re doing. I ran a CherryPy app straight in production for three years without problems, handling decent traffic on a similar VPS setup. Those performance gains you’re seeing are real - you’re cutting out proxy overhead and fewer processes fighting over your limited resources. For scaling later, nginx usually beats CherryPy as a reverse proxy since it’s event-driven and uses memory more efficiently. But your benchmarks show your app works better with CherryPy handling requests directly than dealing with proxy overhead. I’d focus on optimizing database queries and caching first - you’ll get way bigger performance wins there than changing your architecture at this point.
yeah, cherryPy can def work solo, especially on smaller setups like yours. that reverse proxy talk is kinda overhyped if you ain’t needing those advanced features. you already showed cherryPy can handle it, so keep it simple for now, and scale later if you need!