Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Getting Started with Hazelcast

You're reading from  Getting Started with Hazelcast

Product type Book
Published in Aug 2013
Publisher
ISBN-13 9781782167303
Pages 136 pages
Edition 1st Edition
Languages
Author (1):
Matthew Johns Matthew Johns
Profile icon Matthew Johns

Table of Contents (18) Chapters

Getting Started with Hazelcast
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
What is Hazelcast? Getting off the Ground Going Concurrent Divide and Conquer Listening Out Spreading the Load Typical Deployments From the Outside Looking In Going Global Playing Well with Others Configuration Summary Index

Chapter 8. From the Outside Looking In

In addition to the standard native client access to the cluster, Hazelcast also provides a few generic interfaces itself so that our application be powered by a technology stack that isn't necessarily Java-based, and we can still take advantage of some its capabilities:

  • Memcache compatible access to the default map

  • RESTful access to map and queue collections

What about the rest of us?


One limitation of Hazelcast is that due to being a Java-based technology it is mostly focused on supporting applications build around that stack. While we do have a degree of flexibility, in that, other JVM byte-code based languages (such as Groovy or Scala) can utilize the standard Java client driver, but that still does leave a rather large hole for other technology choices. Luckily and very thoughtfully, the cluster nodes do offer limited access to some of our data storage collections in a more compatible way using two popular standards.

Memcache


If we were building a script-based application (say in Python or PHP), and required a data caching service, probably one of the first systems we would consider would be memcache. Both incredibly fast and remarkably simple, but it is this simplicity that does come with some drawbacks. Currently to provide resilience or replication, we have to either handle it on the client side or overlay another system on top of the default memcache to provide transparent scaling or data sharing. But either way, we are exposing some consistency risks, especially in the case of node failure or fallover.

However, one of its greatest strengths is the extent of its client libraries, with no fewer than 10 different technology stacks catered for. Drawing upon these benefits

Hazelcast has sought to provide a compatible alternative, in exposing a memcache API service from each of the Hazelcast cluster nodes. As each of the nodes exposes access to the whole cluster, we can talk to any node about any key held...

Going RESTful


An alternative to memcache would be the even more generic RESTful API. Without wanting to go into too much detail, REST is a popular convention of providing HTTP access to data via resources; these are set up to provide path-like access to collections, objects, and properties. Hazelcast additionally provides a simple HTTP service built-in to each of the nodes to enable access to our standard map and queue collections via HTTP.

The structure of the API is pretty simple:

http://127.0.0.1:5701/hazelcast/rest/maps/mapName/key

http://127.0.0.1:5701/hazelcast/rest/queues/queueName

Where mapName or queueName is as configured within our application, we can then use the standard REST convention of using the HTTP method to describe the type of operation we wish to perform.

In the case of maps, we send in all cases the appropriate key as required; but using a POST method to create or update an entry, specifying an appropriate MIME type as needed.

$ curl -v -X POST -H "Content-Type: text...

Summary


We have seen that Hazelcast isn't a closed technology, while it draws from its own Java-centric background, and is best placed to support applications based on that stack; it does allow more generic access to the cluster's data. Inspired by other standards and conventions already present in the wider community, Hazelcast has avoided completely reinventing the wheel and has found an ideal mix to complement its own offering but also allow existing applications to migrate across easily.

In the next chapter we shall look at taking our application into the cloud and the differences when deploying on a public cloud infrastructure.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Getting Started with Hazelcast
Published in: Aug 2013 Publisher: ISBN-13: 9781782167303
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}