Hot answers tagged performance
26
Hi @googletorp:
Clearly nothing scales as well as static files served by a fast web server and any CMS that has to figure out what to load and then load it will not perform as well, WordPress or otherwise. One of the issues is the number of database queries required per URL request and my 2 prior years experience working exclusively with Drupal and now 2+ ...
26
Yep, this is nasty issue that to have full WordPress environment you need to spend considerable time loading it.
I've needed much better performance (for very dynamic incremental search feature) for work and what I went with is:
Custom file as Ajax handler.
SHORTINIT constant for limited WP core load.
Very selectively loaded parts of core, only those ...
20
You could install WordPress on Nginx. There are a number of resources to help:
nginx Compatibility plugin
HOWTO: Install WordPress On
Nginx-
Slicehost discussion
How To Speed Up WordPress With Nginx And WP Super Cache
WordPress on nginx + lighttpd + FastCGI + php
Nginx as a front-end proxy cache for WordPress
Some performance information from that last ...
19
On shared hosting plans your caching options are limited.
You will only be able to statically cache the html output from your pages. This is the fastest way to serve pages but you loose the dynamic aspects of WordPress like making comments and seeing the latest comments on posts.
There are disk caching options available for objects and database but unless ...
18
Set client-side expiries for things like css, images, JavaScript etc which don't need to be redownloaded for each page view. This, by far, made the biggest difference to my site loading times. The fastest download is the download that never happened ...
# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus ...
17
Minimize the number of plugins you run to only what you really need. Especially be aware of plugins that add javascript and CSS code on every page load, even when that code isn't being used on the page.
If you are creating your own theme from scratch, break your CSS down so that features that are only need for particular page templates or view types ...
14
My WordPress Performance and Caching Stack
This is the best WordPress performance stack for a low to mid range single server or VPS. I am classifying mid range as single core with around 1G of memory and fairly fast drives.
Server Stack
Linux - Either Debian Lenny or Ubuntu
Nginx - Configured as reverse proxy static file cache
Apache - Apache will ...
11
Except in unusual cases having deactivated plugins only affects the performance of the plugin page in the admin, and only then a trivial amount (unless you have hundreds of plugins.) During the plugin admin page load WordPress scans all the plugins and then stores the list of active plugins in the database. Then on all other page loads WordPress inspects ...
11
Assuming all the installs are on the same instance and thus can have the same files shared between them, then the main thing you need to do is to have all the custom content stuff live outside of the main WordPress folders.
So first, you're going to want a fresh copy of WordPress somewhere, untouched (and untouchable, the whole point is to have a single ...
9
Run memcached and use an object cache to reduce the number of database queries. This caches data from the database, rather than pages. Not sure if w3-total-cache already does this.
Make sure you are running an opcode cache like APC. (There are several more available.)
8
You should be forewarned that not all plugins/themes use enqueue. When I first started dealing with all the JavaScripts and CSS files outputed I just hooked into the enqueued files. This resulted in me only getting 2 out of 10 JavaScript files and 1 out of 3 CSS files.
Here is some quick PoCs. Neither tested but meant to put you in the right direction, if ...
7
@Tal,
Generally speaking you should only be using one caching plugin. WP Super Cache, W3 Total Cache, Hyper Cache and DB Cache Reloaded all drop files directly in your wp-content directory and they would conflict with each other and cause errors if you were using more than one.
I would recommend using W3 Total Cache because it gives you the option of ...
7
A few answers off the top of my head:
1) Minimize the number of HTTP requests the browser has to make to your host by concatenating JavaScript and CSS where possible/practical.
2) Offload as much of your image/media serving to 3rd party CDNs as possible, particularly if you're using shared hosting.
3) Try reducing the number of posts you're displaying on ...
6
In addition to using a disk caching plugin like wp-cache, put your blog on a host volume that has the "noatime" property set on it. Otherwise, SSH into your host (if your webhost provides that) and routinely run this command on your files every few days:
chattr -R +A ~/*
The ~/* means "my files under my home directory". You can change that path as you ...
6
If possible get your PHP updated to the latest version 5.3.8.
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 ...
6
You can meassure Plugin performance with the P3 Plugin pretty well. It will show you, which one of your plugins is the one that takes the most time and costs you the most resources.
6
As cool as infinite scalability would be, it is not really necessary to code into most projects.
That limit of 100000000000000 is high enough that you could run a single WordPress Network for all the inhabitants dyson ring 1000 km wide at Earth's orbit with current population density to still have 7 accounts each. Or in another way thats about 15000 posts ...
6
If INT is set to UNSIGNED, allowing only non-negative integers, your value range is from 0 to 4294967295.
Thats...
4,294,967,295 (4 billion +).
...for the given table. Just to put things into perspective.
Only through poor management and unnecessary incrementation would you exhaust that range, say for your posts table as an example.
That said if you ...
6
The size of the table isn't really the issue, the queries you're running on that table might be.
For example, if you're selecting users based on data stored in the user-meta table, then that query will be highly unoptimized, because meta_value is not an indexed field. In which case you may need to add extra indexes or consider storing that particular data ...
5
Well, get_posts() actually instantiates a new WP_Query object, so if you're comfortable using WP_Query directly, don't even bother with get_posts(); get_posts will only return the results from the database, whereas WP_Query gives you the whole functionality of the class.
5
A lot of this is very subjective and hard to answer because of different server environments, themes, size of database etc.
In your experience, when is the time one needs to start thinking about scaling up?
If you are concerned with your users experience you should already be practicing sound front end performance techniques. When is it time to scale up? ...
5
Styles and scripts are always set up by the functions wp_enqueue_script() and wp_enqueue_style(), which have to be tied to a particular action hook in order to function. I took a peek inside Contact Form 7, and it looks like it's using action tags of wpcf7_enqueue_scripts and wpcf7_enqueue_styles to add them to the wp_print_scripts and wp_print_styles ...
5
Use a database class that is trimmed for optimization. We made good experiences with own code to reduce memory usage and database access speed. Next to that, you can optimize the database structure itself by some small changes that do a lot as well.
Part of the database class code can be found in the wordpress trac, it did not made it into core (Ticket ...
5
@Tal,
In terms of performance an unmanaged VPS will be better than a managed one. A Managed VPS will almost always come with CPanel which is great for shared hosting and for hosting companies to easily manage your VPS for you.
You can still install any of the Opcode caching tools (APC, eAccelerator, XCache, MemCached) on a managed VPS with CPanel but ...
5
late answer
From a brief look:
You'd have to use
include( admin_url().'load-scripts.php' );
and include( admin_url().'script-loader.php' );
Then jump into $GLOBALS['wp_scripts']:
Use…
$wp_scripts->default_dirs( array_merge(
$wp_scripts->default_dirs
,array( '/themes/your_theme/js/' )
);
…to extend it.
And then ...
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 ...
5
Souljacker,
I would first take a look at your plugins. Star Ratings for Reviews hasn't been updated for over 3 years and looks like its real heavy on the db. I saw some raw sql with some INNER JOINS that look troublesome.
On the server side you should implement some object caching. APC is the defacto standard and will give you the best results.
Once ...
5
There are several factors that will make your Wordpress site slugish. One of the largest gains can be made with the W3 cache plugin, along with several other smaller fixes. Also choosing a well made theme can help with CSS & PHP bloat.
Guide on Wordpress
http://wp.tutsplus.com/tutorials/the-ultimate-quickstart-guide-to-speeding-up-your-wordpress-site/
...
5
This is nonsense. Almost all URL getters are a result of get_option(), eg. get_option('stylesheet_root'), get_option('template') and so on.
These options are loaded very early during the request, they are cached and not fetched again.
Since the options are fetched anyway, all you can improve is processing time. Nanoseconds. This isn’t worth the trouble. ...
5
Filter option_active_plugins. You can change the result of get_option() here without actually changing the database.
if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
add_filter( 'option_active_plugins', 'disable_plugins_temporary' );
function disable_plugins_temporary( $plugins )
{
// unset plugins you don't need, then
return $plugins;
}
...
Only top voted, non community-wiki answers of a minimum length are eligible