Here is W3 Total Cache Settings for XCache & Memcache, the settings is optimized for Ubuntu Instances running on HP Cloud with Nginx PHP5-FPM. We are using optimized InnoDB. It is frequently asked, what should be the optimal settings for W3 Total Cache, when both XCache and Memcached are installed. We talked about XCache admin page and setup for WordPress. As in our case, we have no clients, we do not mind for the time that will be taken for the cache to be build. If you followed our guides to setup your infrastructure, memcache will be missing. It is easy to setup memcache :
1 2 3 | apt-get install memcached php5-memcache php5-fpm -t service php5-fpm restart |
We need to configure two files – /etc/memcached.conf
and /etc/php5/mods-available/memcache.ini
. In memcached.conf
file, you need to change the value of -m 64
to few hundred times higher. memcache.ini
should have these values :
1 2 | session.save_handler = memcache session.save_path = "tcp://localhost:11211" |
In case, you want to use a separate instance (recommended) for memcache, then localhost
should be changed to subnet mask. Zend Opcache is rightly configure. Apart from these, you can use RAM for mounting wp-content.
---
Restart memcache after changing the settings by running :
1 | service memcached restart |
W3 Total Cache Settings for XCache & Memcache
You will never face issue with XCache with our settings. We are describing what we have seen and feel as the best settings. Actually XCache after configuration, needs no further work from Dashboard. You will see from XCache Admin page – XCache is being used by W3 Total Cache.
See the screenshot in full size.
Frankly, on webpagetest.org
, if a well designed webpage loads with 4 seconds as First View, it is satisfactory. Give importance to Speed Index.
You can use memcache as Object Cache. In that case, you have to define the port from the Object Cache’s settings page of W3TC, URL is like this :
1 | /wp-admin/admin.php?page=w3tc_objectcache |
for the above reason, we mentioned that session.save_path = "tcp://localhost:11211"
part. You will use localhost:11211
in this case. There is a test button. It will pass. Then enable from General Settings. We usually keep the settings of W3TC in this way :
Page cache method > Disk Enhanced
Minify cache method > Disk
Database cache method > Disk
Object cache method > Memcached
The above settings give us a consistent result.
Page cache method > Disk Enhanced
Minify cache method > Disk
Database cache method > Disk
Object cache method > XCache
The above settings give us an inconsistent result on load but on lower load pages load faster. It has more to do with HP Cloud specific things.
Page cache method > Disk Enhanced
Minify cache method > Disk
Database cache method > XCache
Object cache method > XCache
The above settings give us an inconsistent result.
Page cache method > Disk Enhanced
Minify cache method > Disk
Database cache method > Disk
Object cache method > Disk
The above settings give us a consistent result comparable to using memcache when load is less.
You can test database caching with Memcached. Actually, when we are using Disk, then also caching is happening. With Nginx Microcache with right www.conf settings on good host (including HP Cloud, Rackspace, IBM excluding Amazon), it does not matter much if the front end is leveraged by Akamai. With Google AdSense Ads, test results can become biased. Amazon’s instances might fail on load. It possibly happens due to bad quality of hardware on Amazon. Definitely you have fastcgi_cache_use_stale
in your nginx config file :
1 2 3 4 5 | ... fastcgi_cache_key "$scheme$request_method$host$request_uri"; fastcgi_cache_use_stale error timeout invalid_header http_500; fastcgi_ignore_headers Cache-Control Expires Set-Cookie; ... |
Caching on Nginx is unique. WordPress as an App is kid in front of the progress of server side softwares. Google AdSense, Analytics etc. will tell you that your website is running faster.
Tagged With w3 total cache , configure memcached for w3 total cache , ubuntu w3tc cache , w3 total cache settings and memcache