Open Source Projects:

Use Case

Memcached Upgrade

Pricing
Chat
Contact
Overview

Use Hazelcast as a drop-in replacement for Memcached, with the added benefits of elastic scaling (much larger cache sizes), ultra-fast performance, high availability, and easy maintenance. No changes are required in your apps/clients to upgrade to Hazelcast other than pointing to the Hazelcast cluster. Hazelcast has been used in production as an alternative to Memcached as well as a plug-in enhancement.

Solution

Replacing Memcached with Hazelcast is easy.

To replace Memcached with Hazelcast you only need to point your Memcached code to your Hazelcast cluster. No additional code or configuration changes are needed. To walk through an example:

Let’s say your cluster’s members are:

Members [5] {
Member [10.20.17.1:5701]
Member [10.20.17.2:5701]
Member [10.20.17.4:5701]
Member [10.20.17.3:5701]
Member [10.20.17.5:5701]
}

And you have a PHP application that uses PHP Memcache client to cache things in Hazelcast. All you need to do is have your PHP Memcache client connect to one of these members. It doesn’t matter which member the client connects to because Hazelcast a cluster looks like one giant machine (Single System Image). PHP client code sample:

$memcache->set('key1','value1',0,3600);
$get_result = $memcache->get('key1'); //retrieve your data
var_dump($get_result); //show it
?>

Notice that Memcache client is connecting to 10.20.17.1 and using port 5701. Java client code sample with SpyMemcached client:

MemcachedClient client = new MemcachedClient(AddrUtil.getAddresses("10.20.17.1:5701 10.20.17.2:5701"));
client.set("key1", 3600, "value1");
System.out.println(client.get("key1"));

An entry written with a Memcache client can be read by another Memcache client written in another language.

Advantages of Using Hazelcast Instead of Memcached

Elastic Clustering
Elastic Clustering

Add more nodes (or remove nodes) without touching your clients and increase or decrease cluster capacity on demand.

Flexibility for Developers
Flexibility for Developers

Go beyond Memcached and write smarter apps by using listeners, locks and more. Hazelcast APIs are very similar to JDK’s, which makes it easier for developers to easily understand the technology and develop robust and scalable applications with minimal code changes and development efforts.

More than Just Caching
More than Just Caching

Hazelcast is a complete IMDG solution that, along with distributed caching, provides features for in-memory distributed computing and messaging. Hazelcast supports many data structures such as Queue, Topic, Distributed ExecutorService, EntryProcessor, Distributed RingBuffer, ReliableTopic, etc.

Replication
Replication

Memcached has only one copy of each object at one node whereas Hazelcast allows you to have up to 6 copies for each entry. This allows you to configure higher levels of availability. Replication in a Memcached cluster relies on using external libraries and deployment for replication (Repcached).

Smart Clients
Smart Clients

Client nodes (application nodes) connect with all the server members to send/receive requests/responses as opposed to Memcached where all the requests from a client are routed through a particular server member. This makes server members a bottleneck in cases of large concurrent transactions.

Reliable HA
Reliable HA

Data is never lost in a Hazelcast cluster, whether a node leaves or joins the cluster or the cluster faces a split brain scenario. A Memcached cluster is likely to lose data when a node leaves the cluster for a short while and come back in (all the updates are lost during this time).

Free Hazelcast Online Training Center

Whether you're interested in learning the basics of in-memory systems, or you're looking for advanced, real-world production examples and best practices, we've got you covered.