Apache HazelCast – Management Center

Apache HazelCast – Management Center

Introduction

This blog deals with the basics of HazelCast and configuration of HazelCast Management. HazelCast is an open source clustering and a highly scalable data distribution platform for Java. It has various distributed data structures, distributed caching capabilities and supports dynamic discovery. HazelCast is lightning-fast, fail-safe, dynamically scales and easy to use. It helps architects to design easily and developers to develop faster.

Use Case

Let’s have a use case that demonstrates configuration of HazelCast with two members (Node) and its management.

What we need to do:

  • Prerequisite
  • Features of HazelCast
  • Scenario to use Distributed Cache (HazelCast)
  • HazelCast Management Center

Solution

Prerequisites

Features of HazelCast

The components and features of HazelCast provide:

  • Distributed java.util.{Queue, Set, List, Map}
  • Distributed java.util.concurrency.locks.Lock
  • Distributed java.util.concurrent.ExecutorService
  • Distributed MultiMap for one to many mapping
  • Distributed Topic for publish/subscribe messaging
  • Distributed Indexing and Query support
  • Transaction support and J2EE container integration via JCA
  • Persistence for Maps
  • Java Client for accessing the cluster remotely
  • Dynamic discovery, scaling, partitioning with backups, fail-over.

Scenario to use Distributed Cache (HazelCast)

Problem Statement

  • Most End Users use web applications only for searching purposes, by providing the required information. Only 20% of the application is used for updating purpose. Example Online shopping sites:- Ebay, flipkart, Amazon etc
  • Amazon Use Case – An end-user (or buyer) searches for mobiles or laptops, and other peripherals by providing model names, and specifications.
  • Problem – The search keeps hitting the database very frequently. The Database is overloaded and too slow. 80% of the searches are read-only. These read-only transactions keep hitting the database frequently thus making the response time quite slow.

Solution

  • Deploy a distributed cache with multiple members (nodes) in the cluster mode to reduce the load on the database.
  • Cache all data in Memory from the database.
  • All Cached data is distributed between all the nodes (members).
  • By keeping expiry on cache items to avoid bulk cache, old untouched peripheral searches will expire from cache, but master data is maintained in the database.

distributed_cache

HazelCast Management Center

  • HazelCast Management Center enables us to monitor and manage HazelCast clusters. It allows us to check and keep an eye on the health of our cluster, track system throughput and update cluster configuration. Users can email their queries to the HazelCast mail group.
  • To install HazelCast, follow the below mentioned steps:
    • Download the latest HazelCast version.
    • Unzip it and deploy the mancenter.war on the web server (e.g. Tomcat)
    • Before starting your HazelCast nodes, add the following element to hazelcast.xml. (Change the URL or port if necessary).
    • Start your web server.
    • Start your HazelCast nodes.
    • Go to http://{ tomcat_server_IP}:8080/mancenter and enter admin/admin on the login screen. (You can change your credentials on the Administration page.)
  • Run the two Hazel Cast members on the same server.
  •  Verify if the HazelCast instance is running or not.

Linux console:

LINUX

Note: Red highlight – Commands to start and check HazelCast members.
Green highlight – Indicates process id (PID) of HazelCast members that are running.

  • You can also check in ${hazel_home}/logs/server1.log.
  • HazelCast Management Center 

The HazelCast management center enables us to monitor the Maps, Queues, Topics, MultiMaps, Executors capabilities and availability.

server_ip

Note: Server_IP – Hazel Member’s Host

  • In our use case, we ran both the members on the same machine with ports 5701, 5702. It is also possible to run members in two different machines which will provide high cache capabilities and scalability.

Conclusion

  • Apache HazelCast helps to build reliable applications that are highly scalable.
  • HazelCast Management center helps to monitor and manage the cluster and also enables you to monitor the capabilities and availability of distributed Maps, Queues, Topics, MultiMaps, and Executors.
  • HazelCast Community Edition is limited to a maximum of 2 nodes. In order to use more than 2 nodes, it is necessary to purchase the license.
  • The later series will focus on HazelCast using distributed cache, where we are going to load and retrieve the keys and values to/from distributed collections (List, Set, and Map) of HazelCast using Java program.

This is a three-part blog series which is broken down into the following categories:

References

5463 Views 4 Views Today