Performance Tuning

Tuning the Plugin Settings

The code for NextGEN Facebook (NGFB) is highly optimized — it doesn’t use a bloated framework, it doesn’t load or execute modules that aren’t required, and NGFB makes full use of all WordPress caching techniques. As-is, NGFB is very fast and light, but you can fine-tune some options to gain a few milliseconds here and there.

  1. If you’ve saved a few posts and pages without any duplicate meta tag warnings, you can disable the “Check for Duplicate Meta Tags” option in the NGFB > Advanced > Theme Integration settings. This will prevent NGFB from fetching the front-end webpage when editing posts and pages.
  2. If your website content does not use any embedded videos, or if you prefer not to include embedded videos in your Open Graph and Twitter Card meta tags, set the “Maximum Number of Videos” to “0” in the NGFB > General > Videos settings. This will prevent the plugin from searching your content for embedded videos.
  3. If you want to limit which video service APIs are supported, enable/disable one or more of the “Check for Embedded Media” options in the NGFB > Advanced > Content and Filters settings.
  4. 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).
  5. If no excerpt / summary 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 WordPress Content Filters” option in the NGFB > Advanced > Content and Filters settings.
  6. You can increase the “Head Markup Array Cache Expiry” option under the NGFB > Advanced > Cache Settings tab from the default of 259200 seconds (3 days). NGFB removes outdated cache objects when posts / pages are updated, so increasing the default value should not create any issues.
  7. If you don’t use the NGFB sharing buttons, you can disable all sharing button features by adding the following constant to your wp-config.php:

    Alternatively, you may want to update from NGFB to WPSSO. WPSSO is a fork / child of NGFB — both plugins have the same author, the same core features and code-base, but WPSSO is distributed without the sharing buttons and their related features (making WPSSO about 20% smaller than NGFB). Additional extension plugins are also available for WPSSO, including two different types of sharing button extensions.

Optimize WordPress

If you have not installed an opcode and/or transient object cache, you really should. There are many great articles on optimizing WordPress, which cover the subject of opcode and object caching. 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.

The MySQLTuner script by Major Hayden from http://mysqltuner.com/ is also excellent for general database tuning.

Full-Page Caching (Plugins or Services)

NGFB allows you to customize a few Open Graph meta tag and Schema markup values specifically for the Pinterest crawler. If you use a caching plugin (or front-end caching service), it should detect the Pinterest user-agent an bypass its cache (for example, look for a “User-Agent Exclusion Pattern” setting and add “Pinterest” to that list). In order to provide the most up-to-date information for social and search crawlers, you may also consider adding the following user-agents to your caching plugin / service exclusion list:

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 mysqlfragfinder.sh 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: