[coldbox-3.5.0-BE] CacheBox, Clustering, Terracotta, memcacheD

Right, I can tell this could be a long question, so you might wanna grab a snack :slight_smile:

I’m trying to setup some sort of distributed external cache. My current setup is 3 load balanced “non-sticky” servers – running on Amazon EC2 with an elastic load balancer. At present, session information (or more accurately user information), is stored in a central database, much like client cookies (or more accurately, my own adaptation of them). In effect, sessions are disabled, and an encrypted cookie identifiers the logged-in user, and their object struct (preferences etc.) are stored in the database as a json object which I serialize/deserialize to get/set their info. Template caching is on an NFS FileServer which is accessible by each web server – providing a central cache for all three servers to access.

Ideally, I’d like to scrap my “database client cookie adaptation”, and store user information in maybe the coldbox flash ram, setup to be a central cache node – either memcacheD or terracotta. I’d also like for the template cache to be stored in this cache node too – and ditch the CacheBox FileStore Object Store. So in effect, everything – from cached events/views through the coldbox flashram which will hold the equivalent of session information, is stored on this caching server (which may eventually become an array of cache nodes).

Initially, I tried to setup terracotta, but I must have searched all day for any tutorials online, and everything was a about getting terracotta working on the same server as CF – which isn’t what I want. (localhost:9509). I did kinda get it working by changing that to my remote terracotta server, although each server still had their own “cache” somehow (i.e when I visited each server, the timestamps were cached, but they were all different). So I’m not convinced it was actually working properly. The reason I started with terracotta, is that Luis says on the CacheBox docs “but using EHCache with Terracotta is definitely easy to setup”. Well, clearly it wasn’t easy for me! :slight_smile:

So I abandoned that temporarily, and I’ve sat-down and actually written a CacheBox objectstore for memcacheD, based on cfmemcached.

What I don’t really understand – and you’ll have to forgive my naivety here – is the difference between a Cachebox provider, and a CacheBox object store. It sounds as though I really need to write a memcacheD provider – not an object store? It seems as though what I may have done, is store the objects in memcacheD, but the cache “index” is still “local”? Does that make sense?

I guess I need a little more explaining on exactly how to do this – as I said, it kinda seems to be working(!), but I don’t feel like it should be!!!




My understanding is that Providers are responsible for caching behavior, while the store, actually is responsible for persistence. You should be able to continue using the provider of your choice and make a custom Store to handle the persistence to the Amazon Elasticache which uses the Memcached Interface.

I just found out I’m going to have to relocate a large ColdBox application from dedicated servers to Amazon over the summer. Please share your store!