Akka Cluster in use (Part 1): What is Akka Cluster?

Reading Time: 3 minutes

In computer architecture, Amdahl’s law is a formula which tells us that how many times faster a program can be executed if it is parallelized. For example, if a program needs 20 hours using a single processor core, and a particular part of the program which takes one hour to execute cannot be parallelized, while the remaining 19 hours of execution time can be parallelized, then regardless of how many processors we devote to the parallelized execution of the program, the minimum execution time cannot be less than that critical one hour. Hence, the theoretical speedup is limited to at most 20 times. For this reason, parallel computing with many processors is useful only for highly parallelizable programs.

Now, although Amdahl’s law looks simple, and helps us in understanding how fast we can execute our programs. But for real world applications, just processing data fast is not enough. They have many integrations points, like:

  • File Storage
  • Database
  • Third party services (Mail Servers, Social Media platforms, etc.)

Out of which Database is the most used one as we need it to persist our data. Now, doesn’t matter how fast our data is processed, R/W data from/to the database will always be blocking which increases the latency of the program.

Now, one solution to this problem is to have multiple connections with the database and handle them via connection pooling. But then we get restricted by the number of parallel connections that can be opened with the database as they are limited. Moreover, database is a single point of failure for the application.

Of course, we can use a distributed database for overcoming that issue as well. But a distributed database works well only in case of well partitioned data. If we need to fetch data from multiple nodes of the database, then the performance of the database degrades drastically.

This leaves us with only one option, i.e., caching. Now there are multiple ways to cache data. Use a centralized cache like Redis or Memcache. But in this blog post we will focus only on Akka Cluster which provide in-memory cache by forming a cluster of nodes. But before we delve into Akka Cluster and its details, let’s first get to know what it is.

What is Akka Cluster?

  • Provides us a way to distribute Akka Actors across a cluster.
  • Helps in distirbuting large tasks across a cluster.
  • Reduce traffic to an overloaded database.
  • Share critical data across nodes without additional infrastructure.
  • Provides fast access to data.

Now How to create Akka Cluster? How to Manage it? And how to fix it, in case of any fault? We will get to know about that in upcoming blogs. So, stay tuned.

Refrences

Written by 

Himanshu Gupta is a software architect having more than 9 years of experience. He is always keen to learn new technologies. He not only likes programming languages but Data Analytics too. He has sound knowledge of "Machine Learning" and "Pattern Recognition". He believes that best result comes when everyone works as a team. He likes listening to Coding ,music, watch movies, and read science fiction books in his free time.