I am running amazon aws ec2 micro instance on Ubuntu 14.04 with apache 2.4.9. The reason for having this instance is just to test and to solve some bugs before rolling up the project. Currently there are only few people (< 10) who are using the project irregularly (< 20 times per day). In my project I am using minification, so I have only few static content there: like 1 css file and may be 3 js files. They are not really big and the sum of all files is below 300Kb.

Reviewing the waterfall diagram, from loading of my project, enter image description here

I have noticed that was amount of time is spent on waiting phase (if I will remove it, most probably the web-site will be loaded more than 2 times faster). Also I known what each of these phases corresponds to (I even answered highly relevant question here), I do not know what exactly can I do to decrease waiting time. In my case big waiting time is added for static resources like css/js/img, so it has nothing to do with writing more efficient code.

I also found another highly relevant question here (which is actually the same question I have) and tried to follow the advice by switching of HostnameLookups Off but it has not changed anything at all.

I do not have /etc/httpd/conf/httpd.conf, therefore I added it into /etc/apache2/sites-available/000-default.conf. Also I do not have anything like LogFormat in my config, therefore I skipped this part.

So is there anything I can do to reduce this time? When I review the same diagram collected from the location of the server, I see small improvement in waiting time, but the situation is still the same.

I do understand that I can move to a better server, with better HDD/RAM/CPU, but this is obvious. Knowing that there are so many configuration parameters for apache, I think that may be there is something there for tuning.

P.S. thanks to JakeGould I looked into apache2.conf and modified it (not 000-default.conf as I mentioned before). I also modified KeepAliveTimeOut to 3 and MaxKeepAliveRequests to 20 which is more suited to my site.

  • Have you considered using a caching system if it's purely static contest you could try optimized code using html tidy etc . Personally my site runs WordPress so I use w3 total cache with php-apc , nginx, cloudflare and varnish which running a gtmetrix test turned my site from 8 seconds load speed to 1 second it will advise you I'd code changes are required aswell for free. May 5, 2014 at 22:53
  • I think it is more suited for a comment, not an answer. Moreover optimizing html has nothing to do with waiting time. It will reduce receiving time because it decreases size of file. Php-apc has also nothing to do with this because this is js/css/img files. May 5, 2014 at 23:12
  • 1
    Also, I wrote an answer that addresses the multiple issues that can cause web server slowness here. The general message is you need to performance tune MySQL & Apache to get things working nicely. serverfault.com/questions/551727/… May 11, 2014 at 5:21
  • 1
    @SalvadorDali /etc/apache2/apache2.conf May 11, 2014 at 6:40
  • 1
    Do a ping to check how long round trip traffic is taking. This number is the minimum you can get waiting down to.
    – Brian
    May 11, 2014 at 10:13

2 Answers 2


According to the Chrome documentation, the waiting time is "Time spent waiting for the initial response." - but you already knew that.

There doesn't seem to be any further explanation available, but according to the timeline below, the "waiting" stage would logically appear to be either network latency or web server processing - i.e. the time between sending the request for the resource and receiving the first byte of the response.

Chrome timing detail

You've said you're using Amazon EC2, but you haven't said which instance type you're using. Amazon instances are absolutely not created equal, and some have lower storage priority than others, likewise for CPU and network traffic, so you would do well to analyse your bottlenecks - your disk doesn't have to be being thrashed for it to be a bottleneck. You can try moving to an SSD-backed instance such as the m3.medium or m3.large.

To measure your iowait, use the iostat command (contained within the sysstat package on Ubuntu) with a suitable time period while you're making your test requests.

One other contentious resource could be RAM. Linux is usually pretty good with caching files in memory, but if you don't have enough 'free' RAM, Apache will be going to disk for all of the files.

  • I updated my question with more detailed info about my project. I am running micro instance. Thank your for your suggestions. May 11, 2014 at 9:42
  • A micro instance would almost certainly be your bottleneck. They are extremely low priority for all resources. You will get much better performance with an m3.medium instance. May 11, 2014 at 10:08

This is a hard disk problem. Most likely the disk you run on is under heavy load and it just takes time to get the data from the disk.

I don't think there is a way to control this on Amazon. You can try to keep the most important content in cache maybe by creating a small ramdisk with the most important static content.

But the best advise for any problems on Amazon EC2 is to get the fuck out there and use your own dedicated own server. It's bad quality (remember the crashs - cloud my arse amazon), it's unsave, it's CIA+NSA accessible and it's very expensive.

  • “This is a hard disk problem.” Not necessarily. You can tune Apache to perform better & make better use of resources. May 11, 2014 at 5:17
  • 1
    The disk is not even close to being under a heavy load, because I just rolled a testing server to check for bugs in my small project. So basically no one except me is using it. I agree about expensiveness and crashes. May 11, 2014 at 5:58
  • With huge crashs in 2011 and 2012 even killing many terabyte of data ("a cloud is not a backup" Amazon Statement) your comment is just ROTFL.
    – Lothar
    May 12, 2014 at 0:48
  • I don't know how the disks are attached. Maybe each has its own local disk but i think it's more reasonable that its on a NAS. Did you check this, are you able to extract the disk data to be sure.
    – Lothar
    May 12, 2014 at 0:54
  • nydailynews.com/news/national/…
    – Lothar
    May 12, 2014 at 0:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.