SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Please help troubleshoot site slowness

    I have a web site which is written in PHP + Zend + JQuery.

    The landing page takes 1.6 - 2 sec while it loads very little data from the DB, so no heavy DB queries.

    I see in FireBug that the main request takes 1.5 or 2 seconds, while the rest of the scripts/images/csss are loaded after this

    site hosted on hostmonster, shared hosting.

    how can I troubleshoot it at what level I have a delay?

    I can't publish the site's URL, but I will PM it to you so you can check it in FireBug

    I'll buy you a beer if you could help me seriously

    Thank you very much

  2. #2
    SitePoint Member shortcircuit's Avatar
    Join Date
    Jan 2012
    Location
    SW Arizona
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From my 20+ years as a Professional Webmaster, there's alot of things that can cause problems like that, but why would you look at it in Firebug instead of Firefox and other browsers instead? Send the URL to me in a PM and I'm quite positive I can zero in on your problem quickly and hope you have the experience / knowledge to correct the problem(s).

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by shortcircuit View Post
    ... why would you look at it in Firebug instead of Firefox and other browsers instead?
    With 20 years+ as a professional webmaster no doubt you would have heard of the Firefox extension "Firebug"? :P It's the leading website diagnostic tools for developers and has been so for 3-5 years.

    A very simple technique is to sprinkle some echo lines through your code, displaying the elapsed execution time.

    You can use PHP's microtime call() to gauge this with a little more accuracy.

    If you want to get more serious, there are libraries that assist with execution profiling, so that may be an alternative - but in your case, probably overkill at the moment.

    I've enclosed a first stab at a simple function that you can call throughout your code to show elapsed time between various parts - should make it very easy to see where most time is being used. Apologies in advance for any syntax or other errors - but it should be enough for you to get the idea!

    Although, I have to say, 1 second or so isn't that slow!

    I'd also check ping time to the web host - that may be a part of the delay.

    PHP Code:
    function log_time_elapsed($msg '')
    {
        static 
    $microtime_start null;
        list(
    $u$s) = explode(' 'microtime());    
        if(
    $microtime_start === null)
        {
            
    $microtime_start $u;
            return 
    0
        }
        list(
    $u$s) = explode(' 'microtime()); 
        
    $diff $u $microtime_start;
        
    $microtime_start $u;   
        if (! empty(
    $msg))
             echo 
    "$msg: elapsed microsecs $diff <br>\n";
        return 
    $diff
    }

    // example use:
    log_time_elapsed(); // first call initializes
    ...

    log_time_elapsed("before db access");

    // do db access ...
    // ...

    log_time_elapsed("after db access"); 

  4. #4
    SitePoint Member shortcircuit's Avatar
    Join Date
    Jan 2012
    Location
    SW Arizona
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes brianoz; I know all about Firebug and don't use it because it doesn't show everything I need to know about a website. Your suggestions and PHP code to the original poster are correct and done nicely.

  5. #5
    SitePoint Enthusiast
    Join Date
    May 2005
    Posts
    79
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yslow is another option - also Google has a speed profiling plugin ...

  6. #6
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,857
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Let us not forget that Hostmonster is a well-known overseller. Server performance tends to suffer with oversellers--all of them. You can't promise "unlimited" resources to everyone for very little money. Search for "hostmonster slow" and you'll find other similar complaints.

    http://webhostinggeeks.com/user-reviews/hostmonster/

    Frequent outages

    We have several domains with Hostmonster. We are based in Australia. During our night (USA daytime) our sites load very slowly and sometime not at all.
    Lots of bad reviews of Hostmonster. There is a reason people recommend staying away from oversellers.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •