4

This WordPress-based website i just released is dead slow.

I've optimised my theme a lot and get a pagespeed of 91/100 but the first time to byte is the culprit: it takes 8 up to 20 seconds.

I've installed W3 Total Cache, memcache, APC, eAccelerator, xCache, but the site keeps being super slow.

Server: CentOS 5.7 (x86_64), 2G RAM, CPU: 1 Intel(R) Celeron(R) CPU 2.80GHz Mysql 5.1 PHP: 5.2.7 Apache 2.2

2
  • What happens if you drop some short index.html into the webserver's root for testing purposes? Is wordpress involved in this at all, or does the testsite need as much time? Dec 2, 2011 at 14:44
  • Good point, tried that. Even a simple phpinfo(); loads perfectly fast. So it's wordpress related.
    – pixeline
    Dec 3, 2011 at 1:27

11 Answers 11

7

If possible get your PHP updated to the 5.4.x branch.

Before you add your caching layer you need to determine whats slowing down MySql and PHP.

You need to enable WP_Debug and eliminate any PHP errors. Look for undefined indexes, syntax errors and deprecated functions.

That 20 second to first byte is all PHP, MySql and or WordPress related. It sounds like a bad memory leak from poorly written code or extremely long query times. Do you have any expensive queries, e.g. meta_query?

I would recomend installing the Debug Bar and Debug Bar Extender plugins. Enable profiling and set check points at various parts of your templates like before and after any special queries.

To set a checkpoint use the function: dbgx_checkpoint( $note="" ) Use the $note variable to list where the checkpoint is installed.

The profiler will you record the run times and memory usage to pinpoint any problems.

It will also give you a clear picture of the object cache if your using a WordPress object cache plugin.

Also APC, eAccelerator, xCache will not all work at the same time and blow up your site if you try it (I'm sure you probably meant you tried each of them).

0
1

If you realize that the issue is not sever-related, but rather consists of errors or bad-code inside of your (custom) theme, I strongly suggest you run a check on it:

Set your WP_DEBUG to true and install this plugin. It is just a pleasure to use, and it will list all the major (and even minor) snippets, selectors, functions, etc. that should or must be modified.

1

And have you done a yahoo Yslow - see how many http requests are loaded first off (nothing cached)

It will also help identify what u could do - eg smush images etc

0

I was in a similar situation. In my case it was the custom-made theme that was not updated for a while. I figured it out by changing the theme to default TwentyTen theme (on a test environment), then made the developer to fix/update the theme code.

0

In addition to utilizing all the debug information already list try disabling your plugins and turning them back on systematically to help find any one plugin that may need to be refactored. This also goes for the themes. Try switching to a clean copy of wp's 2011 theme.

0
0

Plugins are often the culprit

Have you tried disabling all plugins and testing your speed there? Usually the inefficient code that can affect a site this significantly is in a poorly coded plugin. If you are still seeing problems, disable all and see if you get a significant change in performance.

Since you are using good caching tools (make sure you have them set up correctly and they aren't fighting each other), the culprit for your main issue is almost always going to be in a bad query somewhere. The folks who code the core of quality CMS's like WordPress and Drupal typically do a great job - not perfect, no code ever is, but core CMS code is going to be superior to plugin code 9 times out of 10.

Sometimes too many cache schemes/tools can work against you

Try Varnish, but not at the same time you have memcached eAccelerator, or xcache enabled. APC should be fine but be mindful. Varnish is a reverse proxy cache that intercepts a request before it gets to the application if that page has already been loaded, and it has given me some fantastic performance increases.

You may want to go into your W3 Total Cache settings and instead of just enabling all of the options try some different combinations. DB caching is usually quite helpful, and APC opcode cache is almost always good for a 35% performance boost but only for the php side of the LAMP stack.

Get your static files on a CDN (Content Distribution Network).

W3 Total Cache has a setting for CloudFlare and I gave it a shot on a slow site. There is a free tier and it still does the job very well for me. They will ask you to change your DNS servers to theirs, that isn't a big deal. It will simply allow them to host your media files and other types of content on a blazing fast server that has geographically distributed access points, reducing the number of hops. It's not precisely applicable to your database issue, but I will use any cost effective (aka free) improvement I can find, and it make a difference.

To use CloudFlare, simply create a free account or upgrade to a higher service level (adds features, not speed) and then all you need to do is follow the directions and plug your API key into the appropriate box in the W3 Total Cache settings page.

PS I have no stake or interest in cloudflare, I'm sure there's plenty of other services, but the integration with W3 Total Cache makes it pretty darn simple, and I was very impressed with the results.

0
  • You dont need memcache, APC, eAccelerator, xCache all together.. select one and use it only.
  • Unless you using FCGId, i suggest APC. Dont forget to increase apc's default size. its only 32Mb and you need more for WordPress.. Example: apc.shm_size=256M
0

I run multiple sites, some having had 4 or 5 3rd party themes run at different times and I've had similar issues. The problem for me was, most of the time, theme/plugin conflicts.

Example: One site had over 30 plugins running and a 3rd party theme and ran fast. Changed to a new theme and the one site started eating up VPS power (I run most sites on a single VPS) and all the sites started slowing down. Amazing really that a theme/plugin conflict could down the whole system. So all the advice about checking plugins is good advice in my opinion. I only run 13 plugins on the site now (bbpress/buddypress and other essentials).

If you can do it yourself or get the developer to do it, modify the theme to do what your plugins did before and you'll have a much more efficient system.

0

Use mod_deflate in your htaccess and you can manually make your content cachable. CDN is good if you want to serve static content based on visitors location.

Those plugins are not good at all. If you are familiar with code and optimization you don´t use them. P3 Plugin Scanner is what shows you which plugins are too heavy ;)

0

Yes, I have faced the same problem for my website, where I have launched a tutorial. I have used the detailed analysis report generated from PageSpeedOptimizer.com and I came to know that the most problem my website was facing was due to the heavy images and render blocking. Even the cache leverage issue was there but I removed it. So you may also check it and can resolve the issues as mentioned in the report.

-1

Provide url it will help to investigate in detail in many cases.

Running wordpress with heavy theme or many plugin make site damn slow. I had same issue and remove some plugin and speed increased drastically. If you are using many plugin try to remove some of them which are not important.

Before removing plugin you can try to disable all plugin and check what speed you are getting. Than you can try one by one plugin. Wordpress plugins are fine to use but drawback is adding each plugin affect website speed.

If you are using any analytic plugin like Wassup or Whos online etc those plugin also make your site little slow. W3 Total if found sometime make site heavy.

Also check your theme javascripts if you have multiple and heavy javascripts that also make trouble. Some cool portfolio theme having bunch of js and causing site slower. Also loading video, images and audio file from other server like Vimeo or youtube etc make site slower. Vimeo is always gives nice trouble if you check in firefox while loading embedded vimeo video it will keep loading n loading.. these all small small things make site slower.

Try to start from disabling plugin and turning on one by one. Than check js, multiple css. even you can check some dynamic php code for e.g. if you have use bloginfo(); in many pages which has to convert into html during rendering that also you can change to html code but its up to you. check embedded data from other server etc..

2
  • bloginfo(); is loaded automatically on each page load and makes no difference if you are using it 2 times or 30 times.
    – Chris_O
    Dec 2, 2011 at 16:33
  • That was just an example wasn't talking about that particular code. :) Idea to say that use html code instead dynamic php whenever possible. Dec 2, 2011 at 16:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.