Hacker News new | ask | show | jobs
by rozap 4821 days ago
Not sure about ruby, but django doesn't ship with connection pooling, so that is probably why its database performance is terrible. It could be configured to use pooling.

With such a trivial request handler like the one in benchmark, only a small percentage of the execution is actually taken up in the view, so all of the time you're seeing in the benchmark is pure overhead of the framework. A longer running view across all of these frameworks would cause things to even out a bit. All that being said, however, it's not an unfair comparison. After all, a benchmark of this nature should be a measure of overhead because that's really all there is to measure.

1 comments

Correct, because we chose MySQL as the database backend, both Django and Flask are punished for not having a connection pool. We've received requests to do the test using Postgres which does have a connection pool, and we hope to eventually get to that.
What are your using for db access? If you are using SQLAlchemy or Flask-SQLAlchemy, that should automatically do connection pooling.
Flask-SQLAlchemy does not use a pool by default. This can be changed by setting the `SQLALCHEMY_POOL_SIZE` config variable though.