I have my setup hosted in AWS EC2, on am ubuntu machine, running a django server with uwsgi and apache. I've been trying to figure out for a while why the dev env VS local env have such different performance. With local server i return my index.html page in 80ms and in dev it takes almost 1s. I have django-debug-toolbar implemented and the CPU time is 300ms but chrome says the loading time is 1.3s (Waiting (TTFB)). Other big difference is that when i open then page with the URL it takes 1s but if I enter the server's IP it loads in 300ms.
I already tried everything and can't figure why the loading difference.
My apache virtual host:
<VirtualHost *:80>
<Location />
Options FollowSymLinks Indexes
SetHandler uwsgi-handler
uWSGISocket 127.0.0.1:3031
</Location>
</VirtualHost>
uWsgi conf:
[uwsgi]
socket = 127.0.0.1:3031
chdir = /home/ubuntu/production/<mysite>
processes = 4
threads = 2
wsgi-file=<mysite/project>/wsgi.py
virtualenv=/home/ubuntu/production
venv = /home/ubuntu/production
buffer-size=32768