Current time: 04-23-2014, 12:59 AM Hello There, Guest! (LoginRegister)

Post Reply 
Optimising for speed
02-11-2012, 01:34 AM (This post was last modified: 02-11-2012 01:37 AM by bobocat.)
Post: #1
Optimising for speed
I'm trying to squeeze ever possible source of latency out of my app. I've done some basic benchmarking and my total page load time is roughly 555ms. I'm trying to figure out what accounts for this time:

Pinging the server takes about 167ms and there's probably very little I can do about that.

I used register_shutdown_function() at the very beginning of my init.php file and pass it the time. Then the shutdown function calculates the entire execution time and logs it to a file. Average is 23ms.

I compared load times between PHP5.3 and FastCGI and found that FastCGI was roughly 45ms faster. So I assume that the 45ms difference means the time to instantiate PHP? I don't use FastCGI because load testing has shown that I get more errors, i.e. killed processes, at high loads. I assume this is because FastCGI uses more memory, but in my simple benchmarking, it only seems to use an extra 1MB or so.

These requests are all Ajax requests, so is it safe to assume that the remaining 320ms can be explained by the JavaScript? A friend who knows much more than I has suggested that it's more likely to be latency within the DH network rather than JavaScript. So I compared the load times with an older, slower, version of the script I use now and according to Chrome's developer tools, the longer JavaScript will show up as increased receiving time, not waiting time. The 320ms that I can't account for is reported as waiting time, so maybe he's right.

Does anyone have any ideas on some part of the process which could account for some of the latency?

I know, I know. 325ms is not much. But 95+ of the requests to my site are these Ajax requests, so even a 10% increase in speed is actually beneficial. I've already cut out about 250ms and reduced DB connections to 10% of what they were previously.

Code:
167ms ping
23ms  script
45ms  load php
320ms JavaScript??? Dreamhost???
---
555ms total
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: