Cachebox Questions

We are using the standalone version of Cachebox and just launched it on our production site, my client is so thrilled with the additional caching we were able to put in place and the cool monitoring tool we are wishing we did it sooner! I have a bunch of questions though.

  1. I have been playing around with the getOrSet method that was new in v. 1.6, really love how streamlined it makes the code. But the Jira ticket mentions locking, but nothing about how or if that was ever resolved or if it is needed. Can anyone clarify if there are concerns in that regard?

  2. If you are using the standalone (actually we are using the wirebox-cachebox combination) is there any need to upgrade to 2.0? It looks like it was mainly for Coldbox support.

  3. We want to get a couchbase server set up to do distributed cache. Wondering what most people prefer for this…AWS? Or running your own server? Anyone have experience doing it through AWS? We’re thinking of going that route but not really sure how to figure out what instance etc. to use.

I have some more questions but that’s enough for tonight!

Mary Jo Sminkey
Senior Web Developer
CFWebtools, LLC

Not that I have much experience with AWS, but I would probably stick with any cloud based offering over running your own server, I think it is going to be a lot more cost effective long term if you go the cloud route.

As for the locking I will leave that for Brad, as I am not aware of that issue myself.

> my client is so thrilled

I’m glad to hear that! Now might be a good time to raise your development rates :slight_smile:

> the Jira ticket mentions locking

The locking was implemented inside the getOrSet() method. You can open up the CacheBoxProvider.cfc to see the code. Basically, if you look for an item in the cache and it exists ,no locks are obtained which keeps things running fast. However, if a call to getOrSet() needs to stop and create the item in cache, an exclusive lock is obtained to ensure that only the first thread to reach the code performs the operation. You don’t need to do any locking yourself as it’s all taken care of inside the provider.

> is there any need to upgrade to 2.0

I don’t think so. The only change was removing the XML config support. Here is the “What’s New” guide for CacheBox 2.0.
http://wiki.coldbox.org/wiki/WhatsNew:CacheBox-2.0.0.cfm

> We want to get a couchbase server set up to do distributed cache

That’s great. If you choose to go with the Enterprise version of Couchbase, please contact Ortus as we are working to become a reseller. Also, I assume you’ve seen our blog entry on setting up Couchbase: http://www.ortussolutions.com/blog/couchbase-cachebox-integration

> AWS? Or running your own server?

For best performance, I’d recommend having your Couchbase cluster on the same network as your web servers. While you can certainly host it elsewhere, the network latencies might be slower than the content you’re caching. Network-wise you want there to be as few hops as possible, even if that means hosting the cluster behind your load balancer so it’s on the same switch.

Of course the availability of this network is important, but I assume whatever it is, it’s good enough for you to run your web servers on it already and it doesn’t do any good if your web servers are down, but your Couchbase cluster is still up on AWS. So I’d say keep them together, wherever that is.

> not really sure how to figure out what instance etc. to use

here is a nice blog that is part of a series on how to size a cluster as well as what RAM and CPU requirements to allow for.
http://blog.couchbase.com/how-many-nodes-part-3-hardware-considerations

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Great information, Brad, thanks!

Mary Jo

Well, we work with their web guy, not the CEO who pays the bills. :wink: But he actually got what we are calling a “love letter” from one of their regular customers praising how much faster the site is. Woohoo! Not that we weren’t using caching before, but with how easy cachebox makes it to monitor the usage of cache, I felt more confident about loading a lot more stuff particularly the stuff that was our biggest performance killer but that I knew would also be the biggest memory hit to cache. Not to mention making it so much easier to clear items from cache and set up different cache sections. It just really is the bomb.

One thing that does confuse me, and maybe I just don’t understand how each of these cache providers works. But when I switch the report to different caches, the JVM pie chart changes considerably. That seems odd to me, why would the memory usage show differently for each?

Also, the one thing we don’t like with the report is if you turn on the automatic polling, each time it refreshes it reverts back to the default cache…which I currently am not even using. Is there a way to get the polling to stay on your currently selected report?

Mary Jo

the JVM pie chart changes considerably

That’s because the heap usage on your JVM changes constantly. The more traffic your server processes, the more pronounced the “sawtooth” pattern is. Basically the heap will fill up and then a major garbage collection will run and it will drop way down. This can happen as often as every few minutes. Your JVM also has minor collection on the younger generation spaces which can happen every few seconds.

So the graph can give you a good idea of what things look like, but it’s just a snapshot. I would highly recommend also using a tool such as Fusion Reactor which can show you a graph of your usage over time which will paint a better picture.

> reverts back to the default cache

Sounds like a bug to me. I opened this ticket for it:
https://ortussolutions.atlassian.net/browse/CACHEBOX-26

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com

Ah okay thanks... yeah I see now if I refresh them and change immediately I
get closer to the same results. Make sense, thanks.