Performance Tuning

The code for WordPress Social Sharing Optimization (WPSSO) is highly optimized — the plugin will not load or execute code it does not have to — and unlike most plugins, WPSSO makes full use of all available caching techniques:

  • Non-persistent (WP Object Cache) object caching for rendered (filtered) Post and Page content.
  • Persitent (Transient API) object caching for the Open Graph and Twitter Card meta tags.

Tuning the Plugin Settings

You may consider the following option settings to fine-tune the plugin for optimal performance.

  1. If your website content does not have any embedded videos, or you prefer not to include embedded videos in your Open Graph and Twitter Card meta tags, you can set the “Maximum Number of Videos” to “0”. This will prevent the plugin from searching your content for embedded videos.
  2. If you want to limit which video services are supported, check / uncheck one or more of the ‘Check for Embedded Media’ options on the Advanced settings page.
  3. If you generally have a featured image for your posts and pages, you may set the “Maximum Number of Images” to “1” (the default value). This will prevent the plugin from searching your content for additional images (the featured image counts as “1” and the plugin will stop there).
  4. If no excerpt text is available, the content text will be used to create the Open Graph description value. If your content does not rely on shortcodes or plugins to render its text, you may uncheck the “Apply Content Filters” option.
  5. You can increase the “Object Cache Expiry” option from 86400 seconds (the default) to several days / weeks.
  6. If you don’t use an object / transient cache (like APC, XCache, memcache, etc.) and you have a website with thousands of posts and pages, the creation of transient cache objects may put additional / unwanted load on your database (WordPress saves transient objects to the database by default). You should install an object / transient cache, but if that’s not possible, you may turn off one or more of WPSSO’s caching features by adding the following constant(s) to your wp-config.php file:

    Start by disabling only the transient cache — the file and object caches should not affect database performance.

Optimize WordPress

If you have not installed an opcode and/or transient object cache, you should. There are many great articles on optimizing WordPress, which cover the subject of opcode and object caching. Here are a few that I’ve written, though they may be a little too technical for some. Please take the time to research opcode and transient object caching solutions – they will make a big difference to your website’s performance and maximum concurrent user capacity.

Full-Page Caching (Plugins or Front-Ends)

Pinterest’s expected article:author value is not compatible with the Open Graph standard. Depending on the Pinterest ‘Author Name Format’ option (see the SSO General settings page), WPSSO may create different Open Graph meta tags for the Pinterest crawler. If you use a full-page caching plugin (for example), you should disable caching for the Pinterest crawler or save a different cached version based on the user agent value.

For example, you could disable caching for the following user agent:

If your caching plugin supports PHP expressions to generate a cache ID, you could use:

Defragment the Database

The database tables in MySQL can become fragmented as entries are added/removed/updated, especially the options table which holds the transient cache entries. You should defragment you database tables at least daily. I use Phil Dufault’s script for my own databases.

Here is an example crontab entry:

And to prevent the script from stopping for a password, add an entry for it in the ~/.my.cnf file:

Performance Tests

And lastly, you should perform at least two types of performance tests on your website — A PHP code execution speed test using P3 (Plugin Performance Profiler), and a browser rendering speed test from the WebPageTest website (or equivalent). The first test will show you the speed penalty incurred by each active plugin. You can expect excellent results from WPSSO. As an example, here are the PHP code execution speed results from P3 (Plugin Performance Profiler), using WP Test Data and the default settings of a few popular plugins:

  • 0.0105 secs – WordPress Social Sharing Optimization (WPSSO) v2.5.2
  • 0.0117 secs – All in One SEO Pack v2.1.4
  • 0.0130 secs – MarketPress – WordPress eCommerce v2.9.2.1 (No Products)
  • 0.0164 secs – NextGEN Facebook (NGFB) v7.5.2
  • 0.0189 secs – Contact Form 7 v3.7.2
  • 0.0322 secs – WP e-Commerce v3.8.13.3 (No Products)
  • 0.0393 secs – bbPress v2.5.3 (No Forums or Topics)
  • 0.0405 secs – WooCommerce v2.1.5 (No Products)
  • 0.0572 secs – SEO Ultimate v7.6.2
  • 0.0579 secs – Facebook v1.5.5
  • 0.0656 secs – BuddyPress v1.9.2 (No Activities)
  • 0.1051 secs – WordPress SEO by Yoast v1.5.3.3
  • 0.1980 secs – JetPack by v2.9.2

Tests executed on a VPS with SSDs and 6GB ram, APC opcode/object cache, WordPress v3.8.1, P3 v1.4.1 configured with opcode optimization enabled (improves accuracy).

The second test (browser rending speed) from the WebPageTest website, is a classic test to show which elements take longer to load, etc. WPSSO’s execution time (see P3 results above) should not contribute in any significant way to these results.

Leave a Reply

Your email address will not be published. Required fields are marked *