3 ms·
> 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 bee
by continuations 13y ago
> 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 go to disks there are $200 SSD's that give you almost 100K IOPS. Put a few of them in a RAID and you're getting hundreds of thousands of IOPS for very little money.
In all likelihood application code written in Ruby/Python/PHP with frameworks piled on top of abstractions is going to be orders of magnitude slower than the DB server written in C that has undergone 15+ years of heavy optimizations.
- antihero 13y agoOk, 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?
- continuations 13y agoI'd say a vanilla Python application without ORM would perform similar to a flask app without ORM. According to http://www.techempower.com/benchmarks/#section=data-r6&hw=i7&test=db http://www.techempower.com/benchmarks/#section=data-r6&hw=i7... 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?