Please help troubleshoot site slowness

Discussion in 'PHP' started by michael190s, Jan 20, 2012.

  1. #1
    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.

    the landing page size is 553K

    HTML (59K) + CSS (53K) + JavaScript (344K) + Images (97K) = 553K
    here are more details on javasxript: jquery - 188K, jQeuery plugins - 56K

    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

    Michael
     
    michael190s, Jan 20, 2012 IP
  2. michael190s

    michael190s Greenhorn

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #2
    One more thing,
    I see in FireBug that the main request takes 1.5 or 2 seconds, while the rest of the scripts/images/css are loaded after this
     
    michael190s, Jan 20, 2012 IP
  3. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #3
    Do you have any caching enabled? That's a lot of javascript, but there shouldn't be 1.5 seconds before the content starts loading.
     
    jestep, Jan 20, 2012 IP
  4. michael190s

    michael190s Greenhorn

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #4
    how to enable caching?

    Also I set site protection using .htaccess .htpasswd maybe this might be the problem?

    It looks like javascript is being loaded already after the main get request executed...here is what I see in firebug:


    +915ms Request start time since the beginning
    Request phases start and elapsed time relative to the request start:
    0 265ms Blocking
    +265ms 0 DNS Lookup
    +265ms 0 Connecting
    +265ms 0 Sending
    +265ms 94ms Waiting
    +359ms 0 Receiving
    Event timing relative to the request start:
    +664ms DOMContentLoaded
    +2.05s load

    GET mydomain.com mydomain.com 0
    GET mydomain.com 200 OK mydomain.com 31.1 KB 74.220.215.56:80
    1.11s
    GET jquery.autocomplete.css 304 Not Modified mydomain.com 797 B 74.220.215.56:80
    265ms
    GET jquery.fancybox-1.3.4.css 304 Not Modified mydomain.com 8.3 KB 74.220.215.56:80
    265ms
    GET style.css 304 Not Modified mydomain.com 14.2 KB 74.220.215.56:80
    281ms
    GET custom.css 304 Not Modified mydomain.com 20.4 KB 74.220.215.56:80
    281ms
    GET jqtransform.css 304 Not Modified mydomain.com 8.5 KB 74.220.215.56:80
    296ms
    GET main.js 304 Not Modified mydomain.com 184.4 KB 74.220.215.56:80
    343ms
    GET jquery.autocomplete.min.js 304 Not Modified mydomain.com 14.2 KB 74.220.215.56:80
    359ms
    GET jquery.fancybox-1.3.4.js 304 Not Modified mydomain.com 27.6 KB 74.220.215.56:80
    406ms
    GET jquery.jqtransform.js 304 Not Modified mydomain.com 13.4 KB 74.220.215.56:80
    406ms
    GET cufon-yui.js 304 Not Modified mydomain.com 17.8 KB 74.220.215.56:80
    406ms
    GET Futura_500.font.js 304 Not Modified mydomain.com 46.8 KB 74.220.215.56:80
    406ms
    GET _badge.jpg 304 Not Modified mydomain.com 31.9 KB 74.220.215.56:80
    94ms
    GET like.php?href=http...nt=arial&height=21 200 OK facebook.com 6.1 KB 69.63.181.15:80
    140ms
    GET top_shadow.png 304 Not Modified mydomain.com 299 B 74.220.215.56:80
    125ms
    GET free_sign.png 304 Not Modified mydomain.com 3 KB 74.220.215.56:80
    140ms
    HeadersCache
    Response Headersview source
    Connection Keep-Alive
    Date Fri, 20 Jan 2012 22:44:58 GMT
    Etag "4e9c0d8-bdd-4b62fd7bc4280"
    Keep-Alive timeout=10, max=28
    Server Apache
    Request Headersview source
    Accept image/png,image/*;q=0.8,*/*;q=0.5
    Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
    Accept-Encoding gzip, deflate
    Accept-Language en-us,en;q=0.5
    Authorization Basic ZGVtbzpkZW1vMTIz
    Cache-Control max-age=0
    Connection keep-alive
    Cookie PHPSESSID=9n6uqjfrpqa9rpnrj2oppe2s63
    Host mydomain.com
    If-Modified-Since Tue, 10 Jan 2012 17:28:26 GMT
    If-None-Match "4e9c0d8-bdd-4b62fd7bc4280"
    Referer mydomain.com
    User-Agent Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24 (.NET CLR 3.5.30729) WebMoney Advisor
    Response Headers From Cache
    Accept-Ranges bytes
    Content-Length 3037
    Content-Type image/png
    Date Fri, 20 Jan 2012 22:44:58 GMT
    Etag "4e9c0d8-bdd-4b62fd7bc4280"
    Last-Modified Tue, 10 Jan 2012 17:28:26 GMT
    Server Apache


    GET _step1pic.jpg 304 Not Modified mydomain.com 15.6 KB 74.220.215.56:80
    140ms
    GET _step2pic.jpg 304 Not Modified mydomain.com 17.8 KB 74.220.215.56:80
    156ms
    GET _step3pic.jpg 304 Not Modified mydomain.com 14.6 KB 74.220.215.56:80
    172ms
    GET steps_shadow.jpg 304 Not Modified mydomain.com 5.4 KB 74.220.215.56:80
    203ms
    GET bottom_shadow.png 304 Not Modified mydomain.com 315 B 74.220.215.56:80
    219ms
    GET ga.js 304 Not Modified google-analytics.com 13 KB 74.125.225.128:80
    109ms
    GET bg.jpg 304 Not Modified mydomain.com 3.7 KB 74.220.215.56:80
    110ms
    GET logo.png 304 Not Modified mydomain.com 26.9 KB 74.220.215.56:80
    125ms
    GET side_shadow.png 304 Not Modified mydomain.com 155 B 74.220.215.56:80
    125ms
    GET form_area_bg.png 304 Not Modified mydomain.com 87.2 KB 74.220.215.56:80
    141ms
    GET form_bg.png 304 Not Modified mydomain.com 34.9 KB 74.220.215.56:80
    157ms
    GET psaxno_bg.png 304 Not Modified mydomain.com 3.9 KB 74.220.215.56:80
    172ms
    GET select_bg.png 304 Not Modified mydomain.com 1.3 KB 74.220.215.56:80
    219ms
    GET vrisketai_bg.png 304 Not Modified mydomain.com 2.6 KB 74.220.215.56:80
    235ms
    GET search.png 304 Not Modified mydomain.com 5.8 KB 74.220.215.56:80
    328ms
    GET show_arrow.png 304 Not Modified mydomain.com 2.1 KB 74.220.215.56:80
    297ms
    GET steps_bg.jpg 304 Not Modified mydomain.com 3.7 KB 74.220.215.56:80
    313ms
    GET steps_title.jpg 304 Not Modified mydomain.com 45.9 KB 74.220.215.56:80
    328ms
    GET step1title.png 304 Not Modified mydomain.com 2.5 KB 74.220.215.56:80
    344ms
    GET step2title.png 304 Not Modified mydomain.com 3.1 KB 74.220.215.56:80
    344ms
    GET step3title.png 304 Not Modified mydomain.com 3.2 KB 74.220.215.56:80
    391ms
    GET r_u_title.png 304 Not Modified mydomain.com 2.1 KB 74.220.215.56:80
    406ms
    GET speciality_title.png 304 Not Modified mydomain.com 2.9 KB 74.220.215.56:80
    422ms
    GET arrow_right.png 304 Not Modified mydomain.com 986 B 74.220.215.56:80
    422ms
    GET insurance_title.png 304 Not Modified mydomain.com 3.3 KB 74.220.215.56:80
    437ms
    GET q_a_title.png 304 Not Modified mydomain.com 2.9 KB 74.220.215.56:80
    453ms
    GET futurastd-book-webfont.woff 304 Not Modified mydomain.com 21.5 KB 74.220.215.56:80
    172ms
    GET futurastd-heavy-webfont.woff 304 Not Modified mydomain.com 22.2 KB 74.220.215.56:80
    187ms
    GET dropdown_arrow.png 304 Not Modified mydomain.com 1.7 KB 74.220.215.56:80
    484ms
    GET YYZrixQZaWZ.js 200 OK static.ak.fbcdn.net 49.3 KB
    154ms
    GET qmP6DVX8EqF.css 200 OK static.ak.fbcdn.net 3.8 KB
    167ms
    47 requests 833.4 KB (796.2 KB from cache)
    2.93s (onload: 2.96s)

    --------------------------------------------------------------------------------------------------------------------------

    47 requests 833.4 KB (796.2 KB from cache)
    2.46s (onload: 2.56s)
     
    michael190s, Jan 20, 2012 IP
  5. animedbsellersz

    animedbsellersz Well-Known Member

    Messages:
    276
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    123
    #5
    can you post your httpd.conf here and type top and paste the output here
     
    animedbsellersz, Jan 20, 2012 IP
  6. michael190s

    michael190s Greenhorn

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    here is top's result, see attached
    I dont think I have access to httpd.conf
     

    Attached Files:

    • top.txt
      File size:
      3.2 KB
      Views:
      35
    michael190s, Jan 20, 2012 IP
  7. michael190s

    michael190s Greenhorn

    Messages:
    22
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #7
    here is statistic for the same code but runung on another hosting (VPS) while the slow one was a standard shared hosting ($8 per month) from hostmonster

    do you think faster hosting will help me? or I need to work with code optimization?


    +546ms Request start time since the beginning
    Request phases start and elapsed time relative to the request start:
    0 110ms Blocking
    +110ms 0 DNS Lookup
    +110ms 0 Connecting
    +110ms 0 Sending
    +110ms 140ms Waiting
    +250ms 0 Receiving
    Event timing relative to the request start:
    +319ms DOMContentLoaded
    +1.46s load

    GET anotherdomain.com 200 OK anotherdomain.com 16.1 KB 50.61.226.227:80
    468ms
    GET jquery.autocomplete.css 304 Not Modified anotherdomain.com 845 B 50.61.226.227:80
    47ms
    GET jquery.fancybox-1.3.4.css 304 Not Modified anotherdomain.com 8.3 KB 50.61.226.227:80
    94ms
    GET style.css 304 Not Modified anotherdomain.com 14.2 KB 50.61.226.227:80
    125ms
    GET custom.css 304 Not Modified anotherdomain.com 20.4 KB 50.61.226.227:80
    141ms
    GET jqtransform.css 304 Not Modified anotherdomain.com 8.5 KB 50.61.226.227:80
    156ms
    GET main.js 304 Not Modified anotherdomain.com 191.3 KB 50.61.226.227:80
    187ms
    GET jquery.autocomplete.min.js 304 Not Modified anotherdomain.com 14.2 KB 50.61.226.227:80
    172ms
    GET jquery.fancybox-1.3.4.js 304 Not Modified anotherdomain.com 27.6 KB 50.61.226.227:80
    297ms
    GET jquery.jqtransform.js 304 Not Modified anotherdomain.com 13.4 KB 50.61.226.227:80
    250ms
    GET cufon-yui.js 304 Not Modified anotherdomain.com 17.8 KB 50.61.226.227:80
    250ms
    GET Futura_500.font.js 304 Not Modified anotherdomain.com 46.8 KB 50.61.226.227:80
    282ms
    GET badge.png 304 Not Modified anotherdomain.com 8.6 KB 50.61.226.227:80
    203ms
    GET like.php?href=...nt=arial&height=21 200 OK facebook.com 6.1 KB 69.171.228.14:80
    328ms
    GET city_search_top.png 304 Not Modified anotherdomain.com 5.4 KB 50.61.226.227:80
    47ms
    GET top_shadow.png 304 Not Modified anotherdomain.com 299 B 50.61.226.227:80
    63ms
    GET laptop.png 304 Not Modified anotherdomain.com 36.1 KB 50.61.226.227:80
    78ms
    GET free_sign.png 304 Not Modified anotherdomain.com 3.9 KB 50.61.226.227:80
    78ms
    GET step1pic.png 304 Not Modified anotherdomain.com 36.8 KB 50.61.226.227:80
    94ms
    GET step2pic.png 304 Not Modified anotherdomain.com 12.3 KB 50.61.226.227:80
    109ms
    GET step3pic.png 304 Not Modified anotherdomain.com 40.2 KB 50.61.226.227:80
    172ms
    GET steps_shadow.jpg 304 Not Modified anotherdomain.com 5.4 KB 50.61.226.227:80
    188ms
    GET bottom_shadow.png 304 Not Modified anotherdomain.com 315 B 50.61.226.227:80
    203ms
    GET credits_logo.png 304 Not Modified anotherdomain.com 2.3 KB 50.61.226.227:80
    219ms
    GET ga.js 304 Not Modified google-analytics.com 13 KB 74.125.225.143:80
    109ms
    GET bg.jpg 304 Not Modified anotherdomain.com 3.7 KB 50.61.226.227:80
    234ms
    GET heart.png 304 Not Modified anotherdomain.com 15.2 KB 50.61.226.227:80
    250ms
    GET athina_btn.png 304 Not Modified anotherdomain.com 5.2 KB 50.61.226.227:80
    266ms
    GET thessaloniki_btn.png 304 Not Modified anotherdomain.com 8.1 KB 50.61.226.227:80
    281ms
    GET patra_btn.png 304 Not Modified anotherdomain.com 4.5 KB 50.61.226.227:80
    297ms
    GET hrakleio_btn.png 304 Not Modified anotherdomain.com 6.4 KB 50.61.226.227:80
    313ms
    GET larisa_btn.png 304 Not Modified anotherdomain.com 5.2 KB 50.61.226.227:80
    328ms
    GET side_shadow.png 304 Not Modified anotherdomain.com 155 B 50.61.226.227:80
    344ms
    GET logo_area_bg.png 304 Not Modified anotherdomain.com 12.4 KB 50.61.226.227:80
    359ms
    GET logo.png 304 Not Modified anotherdomain.com 7.2 KB 50.61.226.227:80
    375ms
    GET form_area_bg.png 304 Not Modified anotherdomain.com 87.6 KB 50.61.226.227:80
    391ms
    GET form_bg.png 304 Not Modified anotherdomain.com 34.9 KB 50.61.226.227:80
    406ms
    GET psaxno_bg.png 304 Not Modified anotherdomain.com 3.3 KB 50.61.226.227:80
    422ms
    GET select_bg.png 304 Not Modified anotherdomain.com 1.3 KB 50.61.226.227:80
    438ms
    GET vrisketai_bg.png 304 Not Modified anotherdomain.com 1.5 KB 50.61.226.227:80
    453ms
    GET search.png 304 Not Modified anotherdomain.com 7.3 KB 50.61.226.227:80
    469ms
    GET show_arrow.png 304 Not Modified anotherdomain.com 2.1 KB 50.61.226.227:80
    484ms
    GET steps_bg.jpg 304 Not Modified anotherdomain.com 3.7 KB 50.61.226.227:80
    500ms
    GET steps_title.jpg 304 Not Modified anotherdomain.com 17.9 KB 50.61.226.227:80
    516ms
    GET step1title.png 304 Not Modified anotherdomain.com 2.1 KB 50.61.226.227:80
    531ms
    GET step2title.png 304 Not Modified anotherdomain.com 2.9 KB 50.61.226.227:80
    547ms
    GET step3title.png 304 Not Modified anotherdomain.com 2.7 KB 50.61.226.227:80
    563ms
    GET characters.png 304 Not Modified anotherdomain.com 36.9 KB 50.61.226.227:80
    578ms
    GET r_u_title.png 304 Not Modified anotherdomain.com 1.2 KB 50.61.226.227:80
    594ms
    GET speciality_title.png 304 Not Modified anotherdomain.com 2 KB 50.61.226.227:80
    609ms
    GET arrow_right.png 304 Not Modified anotherdomain.com 986 B 50.61.226.227:80
    625ms
    GET insurance_title.png 304 Not Modified anotherdomain.com 2.4 KB 50.61.226.227:80
    672ms
    GET q_a_title.png 304 Not Modified anotherdomain.com 2.9 KB 50.61.226.227:80
    688ms
    GET futurastd-book-webfont.woff 304 Not Modified anotherdomain.com 21.5 KB 50.61.226.227:80
    141ms
    GET futurastd-heavy-webfont.woff 304 Not Modified anotherdomain.com 22.2 KB 50.61.226.227:80
    156ms
    GET dropdown_arrow.png 304 Not Modified anotherdomain.com 1.7 KB 50.61.226.227:80
    703ms
    GET YYZrixQZaWZ.js 200 OK static.ak.fbcdn.net 49.3 KB
    21ms
    GET qmP6DVX8EqF.css 200 OK static.ak.fbcdn.net 3.8 KB
    234ms
    GET __utm.gif?utmwv=5....(none)%3B&utmu=qB~ 200 OK google-analytics.com 35 B 74.125.225.143:80
    94ms
    59 requests 930.7 KB (908.4 KB from cache)
    1.89s (onload: 2.01s)
     
    michael190s, Jan 20, 2012 IP
  8. animedbsellersz

    animedbsellersz Well-Known Member

    Messages:
    276
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    123
    #8
    this issue here i think is you need to optimize httpd.conf ,

    if you got access to etc/httpd/conf/httpd.conf

    try lessening your start server and min/max clients by 40%

    but first of all if you dont use caching,

    try installing php module like apc,memcached can help you reduce cpu load
     
    animedbsellersz, Jan 20, 2012 IP