[Fixed]-Django and mysql on different servers performance

1👍

It depends how well the application is written.

Poorly written django will generate a lot of queries so maybe it’s beneficial to have it on the same server. Well written Django should leverage the database to do the heavy lifting, in which case its better to have it on a separate server, so the server can be tuned for a database. (In general having a separate database server is the way to go).

The best thing to do would be to add Django debug toolbar to your application and see if it is generating a lot of queries or not, and tune the application from there.

0👍

You have couple of options but let’s stick to these two.

  1. One server for everything

Good for setting up an application quickly, as it is the simplest setup possible, but it offers little in the way of scalability and component isolation.
There are a lot of pros, it’s fast, simple to work with. It does not meet latency problems. From cons: you cannot horizontally scale.

  1. Server for web application and server for database.

First of all, I would recommend to use Postgres, since the latest version (9.6) can now work on multiple cores, which makes it way faster than mysql.

It is good for setting up an application quickly, but keeps application and database from fighting over the same system resources.

From pros it does not fight over resources (RAM / CPU / I/O).

It may also increase security by removing database from DMZ.

From cons, it is harder to setup and when high-latency is going on, the queries might take longer to execute.

To sum up. I would use first option for small and medium applications which does not require a lot of requests.
I would consider moving DB to another server/servers, whenever the application hosts thousands of users per day.

👤sebb

Leave a comment