So you have your brand new cluster! You keep feeding it with your dialplans and start moving some customers there. All good so far! 

Wait! You have to modify a dialplan; some servers get it while others don't. What is happening?

FusionPBX Caching Engines Explained

Memcache Engine

Since release 4.2 (maybe before), FusionPBX has supported Memcached. Memcache is a fantastic caching engine with the following features:

  • LRU algorithm,
  • Auto-expiring objects,
  • 100% memory, zero I/O,
  • Outsourcing is possible, and
  • Key based.

However, the biggest challenge that Memcached presented (until today) was the difficulty of reading what was inside it.

File Engine

Since release 4.4, FusionPBX introduced field-based caching and made it its default engine. Yes, it resolved the issue of an easy way of knowing the cache content, with a trade of the following:

  • objects won't auto-expire,
  • there is always I/O, and
  • cache can't be outsourced (as it writes into a local directory).

Where is the issue? If your deployment is a low-volume stand-alone server, none. If your deployment is a medium to high-volume cluster, you will notice that when you make a change in the UI, one server may take it but the rest nodes won't. The only workaround for this is flushing all the content in the /var/cache/fusionpbx directory. You will find that the more nodes you have, the more tedious this becomes (especially when debugging).

Why Don't We Have the Best of Both Caching Engines?

That is a good question, and frankly, I have no idea why this hasn't happened until now. My solution is as next:

  • Switch back to the Memcache caching engine,
  • Install memcache-fs (if you are under Memcached 1.4) or memcached-fs (if you are under Memcached 1.6), and
  • Mount the memcache(d) FUSE filesystem on /var/cache/fusionpbx.

You will get the best of both worlds:

  • You can outsource the Memcached (by default is localhost),
  • No I/O at all,
  • Auto-expiring objects (all nodes will get the changes),
  • Easy way to sync all the servers by triggering a flush cache from the UI, and
  • You can see the cached content.

memcachedfs mounted

Good luck! 

";