The code for NextGEN Facebook (NGFB) is highly optimized — the plugin will not load or execute code it does not have to — and unlike most plugins, NGFB 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, social buttons widget, shortcodes and content social buttons.
Tuning the Plugin Settings
You may consider the following option settings to fine-tune the plugin for optimal performance.
- 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.
- 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.
- 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.
- 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).
- 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.
- You can increase the “Object Cache Expiry” option in the NGFB > Advanced > File and Object Cache settings from the default of 259200 seconds (3 days). NGFB removes outdated cache objects when posts / pages are updated, so increasing the default values should not create any issues.
- If you don’t use an object / transient cache (like APC, XCache, memcache, etc.) and have an un-tuned database with tens / hundreds of thousands of posts and pages, the creation of transient cache objects will put additional / unwanted load on your database (by default, WordPress saves transient objects to the database). Using the database for transient objects shouldn’t be a problem unless you have a pre-existing database performance issue. Aside from making sure your database is tuned and running well, you should also install an object / transient cache. If that’s not possible, you may turn off one or more of NGFB’s caching features by adding the following constant(s) to your wp-config.php file:
12345define('NGFB_FILE_CACHE_DISABLE', true);define('NGFB_TRANSIENT_CACHE_DISABLE', true);define('NGFB_OBJECT_CACHE_DISABLE', true);
- 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:
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 Front-Ends)
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:
# defragment mysql tables
0 3 * * * export TERM=vt100; /usr/local/bin/mysqlfragfinder.sh >/var/tmp/mysqlfragfinder.log
And to prevent the script from stopping for a password, add an entry for it in the
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 NGFB. 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 v188.8.131.52 (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 v184.108.40.206 (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 v220.127.116.11
- 0.1980 secs – JetPack by WordPress.com 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).