Apache , uwsgi , django lookup time

389 views Asked by At

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
1

There are 1 answers

0
pedrotorres On BEST ANSWER

For those who face a similar problem: I figured out that my problem was with cookies. I was keeping track of the browsing history inside my site as an array. Still didn't figure out the technical reason why it was slowing my request, but that was the problem.