Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have read every wordpress solution and tried them all (at least most), but I CAN NOT get my site to run faster. I am using the couponpress theme, which is a coupon listing theme where users can list different offers and coupons. I'm finished customizing it but I'm having real speed issue!

I included a query count and load time function in the footer of my site and the site runs 40-52 queries and loads in 4-8 seconds (depends on page), too many queries and too slow for comfort. I would like to get the speed to down to at least 2 seconds. I looked into the queries being ran and one in particular, the "wp_schedule_event," is generating an extremely large query, but not sure how to reduce it or eliminate it. I searched for any references to this function but I don't know what to do.

I have tried different plugins and either they don't work as expected or they crash my site.

Main plugins Ive tried:

  • W3 Total Cache (Didn't work as expected)
  • WP Super Cache (Didn't work as expected)
  • Autoptimize (crashed)
  • WP Minify (crashed)

W3 Total Cache had the best results, but I couldn't understand the cache settings and some of my changes to the site were not being applied, so I deactivated it. I know that I have to clear the cache for changes to take effect, but since users to my site will be always be adding new listing, I don't know if the cache settings will allow their listings to display properly or at all for that matter. WP Super Cache didn't crash my site at first, but when I changed some settings I did not see any increase in speed. The other two seemed promising but for one reason or another crashed my site. There are probably conflicts between plugins and with some existing code, but I can't pin point the cause.

Using firefox, I ran firebug and used the net console to see what processes are being ran on the different pages and the initial load to the domain is taking a long time to load, average 7-9 seconds. Most of this time is the "waiting" part of the process. I researched solutions to reducing this waiting time but can't increase the speed.

I really want to speed up my site and I need some major help with this. I have been struggling for the past week trying different options but nothing seems to make it faster. If you need to check out the site here it is.

Thanks a lot, I appreciate any advice with this.

share|improve this question

migrated from stackoverflow.com Feb 28 '11 at 16:00

This question came from our site for professional and enthusiast programmers.

1  
I've found Wordpress can be very slow on certain servers. I had a Grid Server from MT and it really struggled with Wordpress –  seengee Feb 28 '11 at 15:50
    
Such questions might make more sense on wordpress.stackexchange.com (flag for moderator to have it moved) - As for the SQL queries: long statements are not necessarily slower. Run some timing code on them and individually try EXPLAIN –  mario Feb 28 '11 at 15:54
    
@seengee: Yes, Im aware that my server can be the cause, but I would like that to be that last resort. Thanks, I'll do it when I have to. –  gdinari Feb 28 '11 at 15:57
    
@mario: Thank you, I will flag this to be moved. –  gdinari Feb 28 '11 at 15:58
    
7-9 seconds? Something is seriously wrong here. Although I think this might be more suitable for serverfault.com –  Pekka 웃 Feb 28 '11 at 16:12

5 Answers 5

I could be wrong, but I don't think your queries are the problem here. Seeing the result "36 queries in 8.291 seconds" is scary, but that only measures the time in between the start of the first query and the completion of the last query. There are a lot of other things in there slowing your page loads down. If you want to see how much time your queries are actually taking up, try this:

Add this line to your wp-config.php:

define( "SAVEQUERIES", true );

And output the actual query history in your footer:

echo "<!--- \r\n";
global $wpdb;
var_dump( $wpdb->queries );
echo "\r\n--->";

Then you can view the source of your page and see if any of the queries are actually taking an inordinate amount of time.

Looking at your page with Yslow enabled, it looks to me like the biggest time-consumer is the image resizing that's being done on all of the post images. On my load of the site, it looks like each of those images is taking between .3 and 1.25 seconds to load, and you have 6 of them on your home page.

Plus, it looks like they're being generated dynamically in your theme files, with the query string argument ?&w=300, which will prevent them from being cached. And - on top of that - they're being resized again in the browser to 115x80, adding a further slowdown.

My advice is: start by tweaking the image display functions of your theme. Add an additional image size to your theme, so that the image is being resized when its initially uploaded, instead of being resized on every pageview. If that doesn't help, install Yslow and go through the prompts it gives you. Tweaking the headers and etags on images (through htaccess) can allow images to be cached that are otherwise force-loaded on every page view.

UPDATE

Also - you're loading several different versions of jquery - the one bundled with WordPress (probably called by one of your plugins), one from google API, and one bundled with your theme. You'll have to untangle all of that mess and make sure all your various components use proper procedure for enqueueing scripts etc... I don't envy you

share|improve this answer

This probably deserves a much longer answer, but in a nutshell:

You need to determine what is making your site 'slow'

Is it a simple a badly designed theme? You can figure this out by using http://developer.yahoo.com/yslow/ to find out which parts of the HTML/JS can be optimised. This is the most visible effect of speed, simply spending time cleaning this up can make the site render pages much much quicker.

Once you've fixed up your theme (aim for A grade) you can next look towards the server.

Are you allowing browsers to cache resources so they don't have to request them again? Simply setting the correct headers ensures that CSS and JS don't have to be re-downloaded for each pageview,

Is it generating the pages which is taking a long time or getting the information to serve those pages. Is your server at high load, does it have available memory?

For example, it might be that your server is too slow to generate the pages quickly, you might want to install APC Cache which will cache the output from the page, so it can be quickly regenerated next time.

Second it might be the database which is really slow, so you might want to look at using Memcached so speed up reads. Once a SQL query has been done one, it is stored in memory so it can easily be read.

W3 Total Cache is the better out of those plugins as it allows you pick different solutions to solving those problem, anything from file based storage, to APC and Memcached.

You might also want to look at geographically placing your server closer to where your users are or you might want to look at using a cache server in front of your site to speed things up like Varnish.

In short: There are lots of different ways to 'fix' this problem, there is no magic bullet, you need to take measurements, do investigations and fix each problem one by one. Start with the HTML, then look towards the server.

share|improve this answer
    
He already said, that he tracked the time for the queries, so it's not the theme. –  kaiser Feb 28 '11 at 18:17
1  
I'm talking about the HTML and CSS which make up the theme, a few JS files which block rendering the browser can have a bigger effect on perceived speed, than queries back to the DB. –  Tom Mar 1 '11 at 9:37
    
forget yslow, it requires firefox and plugins and they over promote CDNs better use siteloadtest.com –  user3664 Mar 3 '11 at 6:55
    
@Kiddy, yes the default config does promote CDNs but you can adjust the setting to use 'Small site or blog' which have much more reasonable defaults. –  Tom Mar 4 '11 at 10:14
    
@Kiddy I just installed yslow on chrome... and it seems pretty cool to me... although most of its suggestions are either obvious or not really relevant –  Zach L Nov 8 '11 at 21:35

I'm no expert but using the permalink structure you have on a large site can cause problems (you should start the permalink with date or postid etc) rather than something text based. Do you have many posts?

share|improve this answer
    
Yes, I do. I would like to include the name in the post links for search engine purposes. –  gdinari Feb 28 '11 at 15:50

Another one to try is hyper cache. Also, perhaps try DB Cache, which is supposed to cache the queries. I've used hyper cache successfully, but I wasn't in your situation. I've never tried DB Cahe.

share|improve this answer

Try changing your permalink structure to: /%post_id%-%postname%

I think this may speed things up and still includes keywords for SEO.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.