Is there anything I can do to decrease waiting time for my static http requests (in chrome's network panel)?
Solution 1:
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.
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.