#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    Vancouver, WA, USA
    Posts
    399
    Rep Power
    190

    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
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,617
    Rep Power
    595
    I'd suspect network latency first.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    Vancouver, WA, USA
    Posts
    399
    Rep Power
    190
    Originally Posted by gw1500se
    I'd suspect network latency first.
    It happens on specific pages only.
    Thomas Tremain
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,617
    Rep Power
    595
    Does it happen on all pages and only pages using .js libraries?
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    13
    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/...d9eb2631a6642f

    Also take a look at Yahoo's YSlow project. I think it comes bundled with firebug.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Location
    Vancouver, WA, USA
    Posts
    399
    Rep Power
    190
    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.
    Thomas Tremain
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    48
    Rep Power
    3
    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-screenca...bsites-faster/
    Laterna Studio - Animation, Web Design, Video Production and Print Design

    Psalm 73: 25-26
  14. #8
  15. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Sep 2002
    Location
    Seattle, U.S.A.
    Posts
    712
    Rep Power
    13
    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/

IMN logo majestic logo threadwatch logo seochat tools logo