Cloud Zone is brought to you in partnership with:

rior to joining Hazelcast, Fuad worked on J2EE projects as a technology consultant in financial and telecom industries. He was an IT architect at IBM, developing J2EE based core-banking system for one of the biggest banking transformation projects in Europe. Prior to IBM, Fuad worked on various telecom companies developing J2EE and Oracle PL/SQL applications. He has attended several Mathematics Olympiad Competitions. He won three gold medals at national Maths Olympiads and a bronze medal at 42nd International Mathematical Olympiad (IMO), USA. He joined to Hazelcast Team, with the passion of developing the best open source clustering solution. Fuad holds a BS degree in Computer Engineering from Bogazici University, Istanbul. Fuad has posted 1 posts at DZone. View Full User Profile

Running Hazelcast on a 100 Node Amazon EC2 Cluster

04.16.2010
| 47144 views |
  • submit to reddit

The purpose of this article is to give you the details of our 100 node cluster demo. This demo is recorded and you can watch the 5 minute screencast

Hazelcast is an open source clustering and highly scalable data distribution platform for Java. JVMs that are running Hazelcast will dynamically cluster and allow you to easily share and partition your application data across the cluster. Hazelcast is a peer-to-peer solution (there is no master node, every node is a peer) so there is no single point of failure. Communication among cluster members is always TCP/IP with Java NIO beauty. The default configuration comes with 1 backup so if a node fails, no data will be lost (you can specify the backup count). It is as simple as using java.util.{Map, Queue, Set, List}. Just add the hazelcast.jar into your classpath and start coding.

When you download the Hazelcast, you will find a test.sh under bin directory. The test.sh runs an application which randomly makes 40% get, 40% put and 20% remove on a distributed map. In this demo the same test application will be used to see how it performs on 100 node cluster.

Amazon EC2 and S3

An easy to use and scalable cloud environment was needed for demo so we decided to use Amazon EC2 for server instances (nodes) and S3 service to store demo application zip and configuration files. With its newly announced Java SDK, it is very simple to start/stop server instances and upload files to S3 programatically.

Hazelcast AMI & Launcher

The challenge here is that we are running an application on 100 nodes and dealing with each and every server in the cluster is a huge task. We don't want to ssh into every server and manually start the application. This part is automated by creating a special server image (AMI). The AMI contains Java Runtime and a launcher application we developed, which will download the demo application from Amazon S3, unzip it, and run the hazelcast/bin/test.sh in it. The Launcher is actually so generic that it can run any application; it doesn't care/know what test.sh contains.

Deployer

Deployment of the demo application is also automated so that we don't need to login into AWS Management Console and manually start instances. Deployer instantiates any number of Amazon EC2 servers with any AMI and also uploads the demo application zip file to S3.

So the idea here is that, the Deployer will store the application into S3 and launch 100 EC2 instances with our image. The Launcher on each instance will download the application from S3 and run it.

Demo Details.

The smallest EC2 instances (m1.small) are used to run the demo. These are the virtual instances with CPU about 1.0 GHz. Also keep in mind that EC2 platform suffers from considerable amount of network latency. That's why we increased the thread count to 250 in our application. The following steps performed during the demo

  • Download hazelcast-1.8.3.zip from www.hazelcast.com.
  • Unzip the file and move the monitoring war file into tomcat6/webapps directory.
  • Edit the test.sh under the bin directory:
    1. Add -Xmx1G -Xms1G
    2. Add -Dhazelcast.initial.wait.seconds=100 to make the cluster evenly partition on start so that migration can be avoided for better performance.
    3. Add t250 as an argument to the application to set thread count to 250. Remember the latency issue.
  • Run the Deployer from IDE.
  • Check from EC2 Management Console if 100 servers started.
  • Start tomcat.
  • Copy the public DNS name of one of the servers to connect to from monitoring tool.
  • Go to http://localhost:8080/hazelcast-monitor-1.8.3/ (Hazelcast Monitoring Tool). Paste the address and connect to the cluster.
  • Enjoy!

Results

You should always look for programatic ways of launching applications on the cloud. With these tools we were able to deploy and run the demo application on 100 servers in minutes. The entire Hazelcast cluster was making over 400,000 operations per second on the smallest EC2 instances. In our next demo we will experiment Hazelcast on large data set and even bigger cluster. Watch the screencast

Published at DZone with permission of its author, Fuad Malikov.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Ashwin Jayaprakash replied on Mon, 2010/04/19 - 6:49pm

Running an X machine cluster in stable state i.e hazelcast.initial.wait.seconds=100 doesn't mean much. It would've been nice to see new servers join or old ones leave as the data was being inserted.

Fuad Malikov replied on Tue, 2010/04/20 - 2:37am in response to: Ashwin Jayaprakash

That will be a subject to another test, where we will focus on robustness and scalability. But the purpose of the this test was to measure the maximum performance / throughput. Thanks for the feedback.

Vivek Pandey replied on Wed, 2010/04/28 - 9:57pm

Awesome!
Can you share the ec2 deployer code? I am interested to see your strategy on creating hazelcast cluster on ec2, given the fact that multicast is not supported on ec2.

Fuad Malikov replied on Mon, 2010/05/03 - 7:13am in response to: Vivek Pandey

Please e-mail me and I'll share the code. fuad [at] hazelcast.com

Fuad Malikov replied on Fri, 2011/08/19 - 6:38am

Now we have built in EC2 Auto discovery. It is as simple as a couple of lines configuration. More info is available here:

http://hazelcast.com/docs/1.9.4/manual/multi_html/ch09s02.html

Ron Sim replied on Sat, 2013/02/16 - 9:25am

 
I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!..

  Healthy Relationship with Howard Johnson

John Smith replied on Tue, 2013/02/19 - 3:33am

 I have bookmarked your blog, the   articles are way better than other similar blogs.. thanks for a great blog!      interior designs singapore

 

Ron Sim replied on Wed, 2013/02/27 - 9:01am in response to: Ashwin Jayaprakash

 Nice post! This is a very nice blog that I will definitively come back to more times this year! Thanks for informative post.

        zuma game

Ron Sim replied on Thu, 2013/02/28 - 7:16am in response to: Ashwin Jayaprakash

 Thanks for your information, it was really very helpfull..

          tantra massage singapore

Pravid Prabhu replied on Fri, 2013/08/23 - 12:15pm

I use a distributed lock so that only application instance is running at any point of time, Now if i disable network connectivity of first node, second instance which is supposed to acquire lock is still waiting to acquire lock. Pasadena personal trainers

Vishal Khandelwal replied on Sat, 2013/10/05 - 5:24am

That was really a nice piece of information. I am also interested in ec2 deployer code, can you please share it with me. I am running an seo india company that's why need help for developers.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.