The Wayback Machine - https://web.archive.org/web/20120628044138/http://cloudcomputing.sys-con.com:80/node/2301408

Welcome!

Cloud Expo Authors: Pat Romanski, Adrian Bridgwater, Greg Ness, Roger Strukhoff, Liz McMillan

Related Topics: Virtualization, Cloud Expo

Virtualization: Blog Feed Post

Adding LevelDB Store For Your In-Memory Cache?

The store is based on GridGain swap space

Recently, at one of the customer meetings, I was asked whether GridGain comes with its own database. Naturally my reaction was – why? GridGain easily integrates pretty much with any persistent store you wish, including any RDBMS, NoSql, or HDFS stores. However, then I thought, why not? We already have cache swap space (disk overflow) storage based on Google LevelDB key-value database implementation, so why not have the same for data store.

Here is how easy it was to add LevelDB based data store implementation for GridGain cache – literally took me 20 minutes to do, including unit tests. The store is based on GridGain swap space, but since swap space is based on LevelDB, you essentially get LevelDB local store for your cached data.

public class GridCacheSwapSpaceStore<K, V>
    extends GridCacheStoreAdapter<K, V> {
    private ClassLoader dfltLdr = getClass().getClassLoader();

    @GridInstanceResource
    private Grid g; // Auto-injected grid instance

    @Override
    public V load(String cacheName, GridCacheTx tx, K key)
        throws GridException {
        return g.readFromSwap(spaceName(cacheName), key,
            classLoader(key));
    }

    @Override
    public void put(String cacheName, GridCacheTx tx, K key, V val)
        throws GridException {
        g.writeToSwap(spaceName(cacheName), key, val,
             classLoader(val, key));
    }

    @Override
    public void remove(String cacheName, GridCacheTx tx, K key)
        throws GridException {
        g.removeFromSwap(spaceName(cacheName), key, null,
            classLoader(key));
    }

    private String spaceName(String cacheName) {
        return cacheName == null ?
            "gg-st-default" : "gg-st-" + cacheName;
    }

    private ClassLoader classLoader(Object... objs) {
        ClassLoader ldr = null;

        for (Object o : objs) {
            if (o != null) {
                ldr = U.detectClassLoader(o.getClass());

                if (ldr != dfltLdr)
                    break;
            }
        }

        return ldr;
    }
}

Quite easily done in my view. Plenty of more examples of different GridGain cache store implementations can be found on GitHub here.

Read the original blog entry...

More Stories By Thomas Krafft

Thomas Krafft heads marketing and communication efforts for GridGain Systems, makers of leading in-memory solutions used by customers to make their big data faster. He brings over 15 years of experience, helping companies connect with their customers, and driving highly successful efforts for Fortune companies including Intuit and Veritas, internet startups (both acquired), and hundreds of clients he served through his own consulting firms, including NASA and The Internet Archives. Thomas has spent the past several years working within the emerging NOSQL (“Not Only SQL”) space, and helping to promote and increase overall awareness around the entire marketplace of new and alternative data technologies, Big Data, and components enabling critical enterprise, government, web and mobile software systems.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Cloud Expo Breaking News
SYS-CON Events announced today that ActiveState, whose software enables developers and enterprises to innovate from code to cloud, has been named “Bronze Sponsor” of SYS-CON's 11th International Cloud Expo, which will take place on November 5–8, 2012, at the Santa Clara Convention Center in Santa Clara, CA. ActiveState empowers innovation from code to cloud smarter, safer, and faster. ActiveState’s cutting-edge solutions give developers and enterprises the power and flexibility to develop in Ja...
SYS-CON Events announced today that BoogarLists has been named “Media Sponsor” of SYS-CON's 11th International Cloud Expo, which will take place on November 5–8, 2012, at the Santa Clara Convention Center in Santa Clara, CA. With a qualified directory of more than 2,000 Venture Capital and Mid-Market/LBO private equity firms, BoogarLists is an excellent place for entrepreneurs to begin their search for investment capital. Whether starting a new company or striving to take an early stage company...
Want to understand in just hours what experts have spent many hundreds of days deciphering? The new, "super-sized" four-day Cloud Computing Bootcamp is a brief introduction to cloud computing carefully created and devised to help you keep up with evolving trends like Big Data, PaaS, APIs, Mobile, Social and Data Analytics. Solutions built around these topics require a sound cloud computing infrastructure to be successful while helping customers harvest real benefits from this transformational c...
"It was my first time at a Cloud Expo show, so I wasn’t sure what to expect. But man, what a blast it turned out to be. Great exhibits, great audience, great floor traffic, great conversations with IT leaders and folks in the channel." With those words, Tom Gaydos - Director, Marketing & Sales Operations at Evolve IP - begins a blog post on the "Cloud IQ" blog in which he reports on Evolve IP's experiences at the 10th International Cloud Expo, which was held in New York's Javits Center June 11-1...
“One of the greatest challenges to security in the cloud is management,” noted David Meizlik, Vice President of Marketing at Dome9 Security, in this exclusive Q&A; with Cloud Expo Conference Chair Jeremy Geelan. “With cloud computing,” Meizlik explained, “the infrastructure is owned and maintained by a third party, so you can’t just walk down the hall to get to your infrastructure.” Cloud computing represents the advent of a global computing utility that transcends national boundaries. Is that w...
10th International Cloud Expo, held on June 11–14, 2012 at the Javits Center in New York City, featured four content-packed days with a rich array of sessions about the business and technical value of cloud computing led by exceptional speakers from every sector of the cloud computing ecosystem. The Cloud Expo series is the fastest-growing Enterprise IT event in the past 10 years, devoted to every aspect of delivering massively scalable enterprise IT as a service. We invite you to enjoy our ph...
“Big Data analytics will shape the form of nearly every process going forward in time, from the color of the latest fashions, what the candidates say in one town versus another to the chemical composition of the latest super drug,” noted Steve Knodl, Director of Product Management at NextIO, in this exclusive Q&A; with Cloud Expo Conference Chair Jeremy Geelan. “Whether these are considered “new” products,” Knodl continued, “or continuous improvement on previous processes is largely in the eyes o...
“Big Data is not simply code for lots of information,” observed Victoria Kouyoumjian, Sr. Business and Technologies Strategist at Esri, in this exclusive Q&A; with Cloud Expo Conference Chair Jeremy Geelan. “Instead,” Kouyoumjian noted, “Big Data refers to information in myriad different formats from varying sources – and many of these digital formats and streams haven’t existed until recently.” Cloud Computing Journal: Agree or disagree? – "While the IT savings aspect is compelling, the stronge...
“Cloud computing represents a paradigm shift for IT, transforming computing power into a utility,” observed James Weir, CTO and Co-Founder of UShareSoft, in this exclusive Q&A; with Cloud Expo Conference Chair Jeremy Geelan. “While cloud adoption remains in the early stages,” Weir continued, “this shift means that the overall market will grow massively in the coming years.” Cloud Computing Journal: Agree or disagree? – "While the IT savings aspect is compelling, the strongest benefit of cloud co...
“The definition of cloud and cloud services continues to evolve,” observed Robert Crespi, VP, CIO at Cervalis, in this exclusive Q&A; with Cloud Expo Conference Chair Jeremy Geelan. “As such it is difficult to predict the growth,” Crespi continued, “we see more and more customers migrating to a cloud model with virtualization as it core.” Cloud Computing Journal: Agree or disagree? – "While the IT savings aspect is compelling, the strongest benefit of cloud computing is how it enhances business ...