In my app, there are a lot of ajax calls. A user may do 50 ajax calls per session, so speed is very important. The ajax call queries the database and returns a list of records.
Doing the ajax call on my local development server takes about 400 ms. The identical ajax call on the live website takes anywhere between 1.2 - 1.8 seconds.
I checked the droplet console - there is no stress on the CPU, RAM or disk. Everything is operating at very low levels.
Why is it so much slower on the live server? What could be causing this? Everything else is the same, except the ajax call takes an extra second on the live server.
Also, this started happening only yesterday, after I added some additional records and made some minor changes to the code. Before yesterday, I did not notice any major speed differences between development and production.
I’m using Django 1.11 on Ubuntu 16.04 with Gunicorn & Nginx.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.