Earlier quoted context omitted.
> Surely the database would be the bottleneck here? The idea that "it doesn't matter which language you use because DB would be your bottleneck" might have been true 10 years ago but it's definitely not true anymore. Latest versions of MySQL and Postgresql are extremely fast. They are written in C/C++ and heavily optimized. MySQL serving data from RAM can easily do 500K+ rps on a commodity server. Even if you need to…
Ok, but say we use vanilla Python WSGI with a psycopg2 (C Python PostgreSQL extension) directly. Will this come close to the performance of the C++ framework thing?
flask (on Gunicorn): 6,138
flask (on PyPy): 8,167
Django + ORM : 4,026
cpoll-cppsp : 114,711
So while a light weight Python app without ORM might be 50% faster than a full-blown Django app, it's still almost 20 times slower than a C++ app.
That shouldn't be surprising, by all accounts Python is at least an order of magnitude slower than C++.
You could speed up your Python program by running PyPy. According to the benchmark that gives it a 30% speed boost, which is in line with my experience. Another way is to deploy on uWSGI or Meinheld instead of Gunicorn.
No matter what you do, Python will not be close to the speed of C++. But what really matters is: is it fast enough for your need?