Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Why is the site slow?

  • 28-02-2011 10:49am
    #1
    Registered Users, Registered Users 2 Posts: 1,657 ✭✭✭


    Hi folks

    What are good ways of finding out why a site is slow?

    I have a Wordpress site that is quite slow. It doesn't have too much media on it (images, etc.) so how can I figure out how much of that is down to the server's speed and how much is the actual processing and then the page rendering?

    I've already put in code that displays measurements (in microseconds) at various points throughout the php processing and it seems to vary between 1.2 seconds to 6 seconds... Sometimes a lot longer than that. (30 seconds in one case - for the same page, after I cleared the cache)
    And even if it reports 1.2 seconds, the page takes a bit longer than that to load, even if you start timing from when the title is first displayed.

    What are the different parts of a page loading? Presumably first the server receives the request, then the code runs and begins displaying and then the page completes the rendering. Anything else?

    Also, pressing reload, what is drawn from the cache and what's processed again on the server?

    Thanks for any help!


Comments

  • Registered Users, Registered Users 2 Posts: 2,426 ✭✭✭ressem


    Each of the common browsers have tools that might help in finding why your page is taking so long to download and display.

    If using Firefox, you can get the Firebug add-on. A small icon of a bug will appear in the bottom right of your browser, in the status bar. Clicking on the bug, and choosing the 'NET' menu will let you see the component elements of the page, how long each took to be 'DNS lookup'ed, requested, download and displayed.
    Handy as it doesn't require a reload or 'start profiling'.

    Chrome has similar tools built in. Right click on a page, choose inspect element, then reload the page. It explicitly notes what was retrieved from cache.

    IE has the F12 developer tools. I don't find it as convenient as the others but your mileage may vary.


  • Registered Users, Registered Users 2 Posts: 40,038 ✭✭✭✭Sparks


    There's also a wordpress plugin that helps with this called wptuner. And, at the risk of tooting my own horn, this might help too.


  • Registered Users, Registered Users 2 Posts: 1,657 ✭✭✭komodosp


    Great thanks! I had Firebug but didn't realise it could be used to do that... So I have a new question!

    I have noticed there are several CSS files that take a few seconds to load. This seems to be holding up the page load. This is despite the fact that said files are of the order of only hundreds or thousands of bytes each.

    I am assuming they are cached. I'm getting a 304 (Not Modified) response code for them, but it seems to take about 3 seconds just to get that response. There also seems to be one or two JS files with the same problem. One JS file takes ages (about 3 secs again) in the connection phase.

    The funny thing is it's always the same few CSS files.... The other thing is if I look (in Firebug) at the cache information, it shows that the last updated time was the time I loaded the page. Would defragmenting the disk help here or something (not that I know whether I'll be able to do that!)

    The rest of the CSS only take at most a few hundred miliseconds to load / get the 304 response.

    I was hoping the files being cached would mean it doesn't even bother looking to the server and just loads the CSS straight from the cache, but it seems that it does to get the headers & the 304 response code... meaning the same number of HTTP requests... Is there anyway to cache in such a way that it doesn't even bother doing that?

    Thanks for any help!


  • Closed Accounts Posts: 1,150 ✭✭✭Ross


    If it's just on-connect that you have the problem (And it's not a routing issue) then you can try setting the CSS files, etc, to cache for a year (for example).

    Can usually do with a .htaccess file if you're running apache and have mode_expires installed:
    ### turn on the Expires engine
    ExpiresActive On
    
    ### expires after a month in the client's cache
    ExpiresByType image/gif A31104000
    ExpiresByType image/png A31104000
    ExpiresByType image/jpg A31104000
    ExpiresByType image/x-icon A31104000
    ExpiresByType application/x-javascript A31104000
    ExpiresByType text/plain A31104000
    

    This means the browser, upon a revisit (most of the time), won't look up the file at all.

    That said, first time visitors will still get a pretty poor experience. w3-total-cache should fix up a bunch of these things more or less automatically.

    Just sounds like an underpowered/overloaded server. Shared hosting?


  • Registered Users, Registered Users 2 Posts: 21,263 ✭✭✭✭Eoin


    One simple way to help narrow it down might be to save the HTML source of the page as a static HTML page, and upload it to the server - then compare the load times for the static page versus the live one.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 7,521 ✭✭✭jmcc


    Eoin wrote: »
    One simple way to help narrow it down might be to save the HTML source of the page as a static HTML page, and upload it to the server - then compare the load times for the static page versus the live one.
    A good suggestion but one that could give deceptive results. With a static webpage, the files will be read from the harddrive and unless the number of files in the directory is large, it will be faster. The numbers of queries made to the database in the course of a building a webpage will slow down the page generation. And if the queries are not optimised, then it could be slow. The other factor is that the database server could be a shared one and a pile of applications could be contending with these queries.

    The other factor in page rendering is the use of site analytics and other gadgets. While these are external to the website, relying on a call to Google, Sitecounter, Amazon etc, they can have the effect of making the page slower to render for the user. Google Webmaster Tools is very misleading on site and page load times.

    The first thing to do would be to strip out all the external calls and widgets, test, and then reinclude them one at a time and retest. It is a process of elimination that should identify problem widgets.

    Regards...jmcc


  • Registered Users, Registered Users 2 Posts: 1,657 ✭✭✭komodosp


    Thanks for the help guys... Yeah it's shared hosting. I ended up caching the css, js and jpg files using the .htaccess file as these never change, except when a user changes his avatar image. (I've overridden the caching in the .htaccess in the dir with the images)

    This made a difference... as I said before some of those css's and one of the images were taking an unusually long time to load - like 3 seconds. Most of them are repeated throughout the site, so upon first visit, the user will have to wait but as they navigate through it they should be ok.


  • Registered Users, Registered Users 2 Posts: 15,065 ✭✭✭✭Malice


    There's a plugin for Firebug called YSlow that might be of some use.


  • Registered Users, Registered Users 2 Posts: 2,781 ✭✭✭amen


    you could also download fiddler 2. I've found it very useful


  • Registered Users, Registered Users 2 Posts: 7,740 ✭✭✭mneylon


    Check how many MySQL queries are being run per page.
    If you haven't done so already, install one of the caching plugins for Wordpress (http://ocaoimh.ie/wp-super-cache/ )
    External widgets and graphics can slow a site down a LOT, so remove them unless they're really needed


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,657 ✭✭✭komodosp


    Had problems with wp-super-cache before. Was caching stuff I didn't want to cache... Also, my site is having slow problems on the back end. I don't really think we can be caching that - though when I think of it there are a couple of plugins not being used (but still active).


Advertisement