Current time: 06-21-2018, 08:22 PM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Big gap between Initial Connection and TTFB
12-07-2011, 06:00 PM
Post: #1
Big gap between Initial Connection and TTFB
I've always been into optimizing page load time. I joined Webpagetest to learn more on optimizing techniques. Anyways, here is my test result:

http://www.webpagetest.org/result/111207...1/details/

HTTP server: lighttpd/1.4.28
PHP version: 5.2.17
XCache Enabled
MySQL version: 5.1.39-log
Application: Invision Power Board v1.3.1 Final

I notice there is a 250ms gap between initial connection and TTFB. Is it because the Start Offset is 0.326s ? If so, is there something I can do to reduce this start offset time? I am on a 300MB VPS with very light CPU load (0.05~0.15) on a 100Mbps line. Where should I start looking? This has been bugging me for a long time, I just feel my site isn't loading as fast as it should be. I even went through the code line by line.
Find all posts by this user
Quote this message in a reply
12-08-2011, 12:19 AM
Post: #2
RE: Big gap between Initial Connection and TTFB
I think you're in good shape. That gap is driven by the actual test machine and it's performance (disk, antivirus, etc). Try again from Dulles where the testers are running on SSD's and you'll see that behaving much better.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-08-2011, 04:26 AM
Post: #3
RE: Big gap between Initial Connection and TTFB
Thanks pmeenan for the quick response! The results from Dulles really are much better and similar to the tests I've seen here. The connections are much more continuous.

I ran into another problem while testing.
http://www.webpagetest.org/result/111207...1/details/

The application I use seem to have a loading problem when a topic/thread gets big (>5000 replies) It would hang for 5 or 6 seconds before it does anything. Then within one second, everything is displayed. I've been benchmarking and it seems all subsequent pageloads are super fast. Looking at the waterfall, it seems the site is hanging after the Initial Connection for 5 seconds. I've already profiled the PHP codes and MySQL queries. All MySQL Queries only took roughly 200ms to complete and the PHP microtime only took about 400ms to complete the whole page.

Could it be a server configuration that caused the huge delay between Initial Connection and TTFB? I've been trying to figure out this problem for several months and to no avail. Here's something for reference: http://www.webpagetest.org/result/111207_A5_2E9DE/ This is a test on a topic with only 50 replies. And it seems to load fairly quickly even on first view.

All indications seem to point to threads with large amount of replies as the culprit, but I just don't know where to start. I even tried stepping through the code line by line to see if there's anything that seem to put the thread in a big loop, but I didn't find anything significant enough to cause such a delay.

Any idea would be appreciated! Thanks guys!
Find all posts by this user
Quote this message in a reply
12-09-2011, 12:08 AM
Post: #4
RE: Big gap between Initial Connection and TTFB
How did you do the profiling? It's possible that by the time you instrumented it the database queries were in the mysql memory cache already and they returned a lot faster than they would on a cold hit. If you can, I'd recommend enabling slow query logging and then look at the logs.

Web server configuration issues would generally show up regardless of the size of the thread. It's going to be in the actual query or the code that parses it (my bet is on the query itself).

You can give New Relic a shot (it has a free level but for the first 14 days you actually get the full pro product for free to try it out). It will profile the php and database calls and tell you where the time is going.
Visit this user's website Find all posts by this user
Quote this message in a reply
12-10-2011, 02:53 PM
Post: #5
RE: Big gap between Initial Connection and TTFB
Oh my goodness, thank you so much pmeenan. I signed up at New Relic and checked out their service. I figured out what was causing the lag and fixed it. Now big threads with 5000+ replies load instantly! You are a life saver!
Find all posts by this user
Quote this message in a reply
12-10-2011, 04:51 PM
Post: #6
RE: Big gap between Initial Connection and TTFB
Here is the result after some patches: http://www.webpagetest.org/result/111210_ZN_2FAZY/

Thanks again!
Find all posts by this user
Quote this message in a reply
12-11-2011, 12:12 AM
Post: #7
RE: Big gap between Initial Connection and TTFB
Very nice. Should be a huge win for your users.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)