Using memcached as a Grails cache

Thanks to Ray Krueger’s hibernate-memached plugin, I have PatriotRoom.com using memached as a 2nd level and query cache.

Why use memached instead of the standard OSCache provider? Two reasons.

One, I’m not overly fond of taking up memory heap for the cache when it can be used for the application itself. This should reduce GC usage as well, and unless I’m missing something the cache should survive application restarts. Giving the amount of cache hits the application gets this would be a big help.

Two, I plan on clustering the application pretty soon, if I can get terracotta working, (that’ll be another post) and having the memached cache means I have a cache that can be used across the two servers.

Yes, I could have done this via clustering OSCache, but this is much simpler.

Ray has some pretty good documentation and the only thing that wasn’t clear was a couple of jars needed (the slf4j ones), but it wasn’t too big of a deal.

5 Total TweetBacks: (Tweet this post)


Don’t miss anything, subscribe!

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

Thanks for the comment Jordan. After taking a quick look, one thing sticks out for me and that is that it is an in-process cache. If I wanted that I would have stuck with OSCache which is the default cache provider for Grails.

I wanted an external cache for the two servers to talk to. I haven’t used, or heard of, sccache, but memcached is a very lightweight and fast cache server, exactly what I wanted. Also, there was a hibernate cache provider for it already, making it just a config change along with a few jars.

Actually, sccache has both in-process and external caching. Each is optional so you can use sccache as an external cache only.

I really should work on a Hibernate wrapper for it. People seem to like that.

Odd – I posted a comment and now it’s gone.

Anyway, sccache has both in-process and external caches (both are optional). I’ve been meaning to add a Hibernate wrapper. If I write it, would you mine giving it a quick test? I’m not a Hibernate user.

Thanks for the feedback! Let me know how things work out for you :)

So far Ray, everything is working great. My app gets about 4 million cache hits in a 24 hour period and I haven’t seen any issues.

Great post! My firm does internet marketing for companies and so a lot of my e-newsletter, blog and seminar content revolve around for promotion. Thanks!!!

[...] this page was mentioned by Murali R (@myparu), webmogul (@webmogul) and others. [...]

This PowerPoint Video converter can easily convert PowerPoint to video in all popular video and audio formats with excellent quality.
iPod Ripper provides an ideal solution for you to manage, rip, copy, backup, restore your iPod/iPhone on personal computer no matter iTunes installed or not
This powerful Capture Streaming Video supports comprehensive video sharing websites, online TV channels, Internet radio station, online movie, live sport, live news report and other streaming video websites
iPhone To Computer Transfer is a powerful converter, mutually trasferring playlists, songs, pictures between iPhone and computer

Great post!

Every time some people have tasks to compose the custom written essay related to this post. But lots of them are not experienced research paper writers. Therefore, what should they do in this situation? We instantly suggest to order an essays from the writing and editing services.

This free PDF Converter is the most powerful PDF converting tool to convert PDF files to all popular file formats. Adopting professional technology, all elements in PDF files can be perfectly preserved to the output files. And comprehensive file formats are supported.

There are rich flexible settings provided in this pdf converter to help you convert PDF to Word, Excel, image files, Flash videos, HTML, etc. and get the exact output file as you want.

PDF Editor | PDF Creator

good good good

Interesting blog. It would be great if you can provide more details about it. Thanks you
Interesting blog. It would be great if you can provide more details about it. Thanks you

really good, nice
.Very informative and trustworthy blog. Please keep updating with great posts like this one. I have booked marked your site and am about to email it to a few friends of mine

that I know would enjoy readingwedding dresseswholesale wedding dress
custom wedding dresses
wedding dresses custom

If you don’t know where you can pick up your jimmy choo outlets items, you can see this website: jimmy choo outlets I have find some this website very good, I
think you will also find some fit for you.
and how do you think of this website ?
can you let me know ?

Hi,Dear friend.
I”m gold to make friends with you .Please add me two links to your website ,Thankswedding dresses,
wedding gowns,
bridal dresses

Leave a comment

(required)

(required)