The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> PHP Development
|
Slow loading page
Discuss Slow loading page in the PHP Development forum on Dev Shed. Slow loading page PHP Development forum discussing coding practices, tips on PHP, and other PHP-related topics. PHP is an open source scripting language that has taken the web development industry by storm.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

November 12th, 2012, 05:30 AM
|
|
Contributing User
|
|
Join Date: Dec 2005
Location: Vancouver, WA, USA
|
|
|
Slow loading page
I have a client, that has an issue with a few pages that load VERY slow. (20 to 30 seconds maybe)
checking microtime() at the begining and end of the page load only shows the elapsed microseconds to be 0.14907288551331 seconds.
This leads me to believe that I should be looking more to the .js libraries being loaded, a jquery codes. Does this sound logical?
__________________
Thomas Tremain
|

November 12th, 2012, 06:50 AM
|
|
|
|
I'd suspect network latency first.
__________________
There are 10 kinds of people in the world. Those that understand binary and those that don't.
|

November 12th, 2012, 06:52 AM
|
|
Contributing User
|
|
Join Date: Dec 2005
Location: Vancouver, WA, USA
|
|
Quote: | Originally Posted by gw1500se I'd suspect network latency first. |
It happens on specific pages only.
|

November 12th, 2012, 07:24 AM
|
|
|
|
Does it happen on all pages and only pages using .js libraries?
|

November 12th, 2012, 01:33 PM
|
 |
Contributing User
|
|
Join Date: Sep 2002
Location: Seattle, U.S.A.
Posts: 712
 
Time spent in forums: 4 Days 11 h 4 m 59 sec
Reputation Power: 11
|
|
A good way to figure out whats going on is to use some sort fo browser based developer tool (Firebug, Chrome|Safari Developer Tools). You can see if there is something, like js library that is loading slowly. If you suspect its js loading you can also try and move all of your js libraries to the end of your page and see if that makes a difference or look into a js library that loads in your js last. This is a screen shot from chromes:
https://www.evernote.com/shard/s194...cd9eb2631a6642f
Also take a look at Yahoo's YSlow project. I think it comes bundled with firebug.
|

November 13th, 2012, 03:34 AM
|
|
Contributing User
|
|
Join Date: Dec 2005
Location: Vancouver, WA, USA
|
|
|
Thanks for your help folks. I was wrong on this after all.
I'd forgotten that when you view source with firefox it reloads the page instead of pulling it from memory. This means the timer figures I was looking at, were not from the original page view, and where mySQL was using cached values, therefore going a lot quicker.
|

November 13th, 2012, 12:06 PM
|
|
Contributing User
|
|
Join Date: Jun 2012
Posts: 47
Time spent in forums: 11 h 51 m 3 sec
Reputation Power: 1
|
|
Saw this presentation of Chris Coyier's the other day. It sounds like you have your issue solved, but this is still a good watch for anyone reading this thread who wants to know some simple ways to improve their load time.
http://css-tricks.com/video-screenc...ebsites-faster/
__________________
Laterna Studio - Animation, Web Design, Video Production and Print Design
Psalm 73: 25-26
|

November 13th, 2012, 12:16 PM
|
 |
Contributing User
|
|
Join Date: Sep 2002
Location: Seattle, U.S.A.
Posts: 712
 
Time spent in forums: 4 Days 11 h 4 m 59 sec
Reputation Power: 11
|
|
|
That's a great vcast. Here's a list things you can check out I compiled from my local PHP meetup group:
Tools to Help Debug:
* Firebug[1]/Yslow [2], Google PageSpeed Extension [19]
* Use a code profiling tool ( XDebug[8], Webgrind [6], MacGDBp [7] )
* use mysql explain to identify if your queries are using indexes [11]
Backend
* Use gzip to compress output
* Check that server has appropriate CPU, RAM, Disk I/O available for traffic
* Optimize db query, proper indexing, joining
* Optimize php code
* Caching: Memcache [9], APC [10]
* Load balancing: web servers, db servers
* Separate out long running queries into individual tasks that can be
run on off hours or asynchronously
* Look into optimizing server configuration (trimming unneeded PHP
extensions, tuning mysql config, etc.)
* Switching to faster web server like NGix
* Use something like PHP-FPPM to make Apache run PHP faster [18]
* Thinking about changing some of your queries into stored procedures
that mysql can compile
Front End
* Minify Javascript/CSS files [3]
* JS codes at the bottom of page
* Important CSS files at the top
* Monitor 3rd party scripts (facebook buttons, twitter buttons, ad
networks). Consider async loading these after your page has loaded.[4]
* Add appropriate Expires or a Cache-Control Header[5]
* front end caching servers e.g. Varnish [12], Squid [13]
* css/image spriting [14]
* Progressive Jpgs
* Optimize (ie make smaller) your images, check out pngcrush [15] or
jpegran [16] for batch optimization
* Use Content Delivery Networks (CDN) [17]
Resources/Articles/Tutorials
* http://developer.yahoo.com/performance/rules.html/
* http://www.html5rocks.com/en/tutorials/webperformance/basics/
[1] - http://getfirebug.com/
[2] - http://developer.yahoo.com/yslow/
[3] - http://developer.yahoo.com/yui/compressor/
[4] - http://bit.ly/P6kde8
[5] - http://developer.yahoo.com/performance/rules.html/rules.html#expires
[6] - http://code.google.com/p/webgrind/
[7] - http://www.bluestatic.org/software/macgdbp/
[8] - http://xdebug.org/
[9] - http://memcached.org/
[10] - http://en.wikipedia.org/wiki/List_of_PHP_accelerators#Alternative_PHP_Cache_.28APC.29
[11] - http://dev.mysql.com/doc/refman/5.0/en/using-explain.html
[12] - https://www.varnish-cache.org/
[13] - http://www.squid-cache.org/
[14] - http://css-tricks.com/css-sprites/
[15] - http://pmt.sourceforge.net/pngcrush/
[16] - http://jpegclub.org/jpegtran/
[17] - http://en.wikipedia.org/wiki/Content_delivery_network
[18] - http://php-fpm.org/
[19] - https://developers.google.com/speed/pagespeed/
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|