2

I've recently been facing hugely increased server response time for some of my web pages (response time in the range of 10-20 seconds).

For example, for the page http://www.edmhunters.com/afrojack/ - Google Page Speed Test says the server responded quickly (meaning it's under 200 ms).

For another page with the same view and template - http://www.edmhunters.com/skrillex/ - Google Page Speed Test says the server response time is 10.3 seconds.

Is it safe to assume that the fault lies somewhere in my server configuration and has nothing to do with the code itself?

My website is a Django application using Nginx, Gunicorn, PostgreSQL and Memcached hosted on DigitalOcean(1GB Ram, 30GB SSD Disk, Ubuntu 14.04 x64).

Following are some of my configuration settings for Nginx

worker_processes 4;

events {
    worker_connections 768;
}

http {
    sendfile on;
    tcp_nopush on;
    tcp_nodelay on;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    gzip on;

    server {
        listen 80;
        client_max_body_size 4G;
        server_name www.edmhunters.com;

        keepalive_timeout 5;
    }
}

For Gunicorn i've set the number of workers to 3. Any suggestions on what could be wrong here? I'm pretty much a noob when it comes to server hosting and this thing has kept me baffled for quite some time now.

0

1 Answer 1

1

Is it safe to assume that the fault lies somewhere in my server configuration and has nothing to do with the code itself?

No.

The problem is most likely your code. Or your database. Or the interaction between the two.

4
  • Then how come the same code works ok for 1 database object and is faulty for another object?
    – Yin Yang
    Jan 19, 2015 at 15:19
  • Also I have a Debug Toolbar installed on my local setup which shows the SQL queries take 2.5 ms and the cache calls take 17.8 ms for the 'faulty' page. I'm totally confused.
    – Yin Yang
    Jan 19, 2015 at 15:21
  • 1
    Doubt it is faulty, rather somehow inefficient.. The pages are loading, just very slowly. Debug the code - determine where the delay is. Otherwise you're just left guessing. Jan 21, 2015 at 3:03
  • 1
    Turned out to be an issue within the code itself. Found it and fixed it.
    – Yin Yang
    Jan 22, 2015 at 12:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .