Skip to main content
25 Jul 2017

There was a time when scalability meant clustering the database, then came the era of component transaction servers like Jaguar CTS & Microsoft transaction servers. This was followed up by the era of J2EE application servers like WebLogic, WebSphere, JBoss which could be clustered. These application servers were clustered to provide scalability across x axis. Then came in the concept of replicating micro-services on light-weight containers like Docker and there by scaling on y axis. And now in-memory clustered environment is catching up a lot of limelight. The actor model is an architectural style that breaks down your application in Actors.
Keep reading….

Introducing the Actor Model

The actor model provides extremely powerful mechanism to distribute and share workloads across not just threads & cores but also servers running across one or more data centers. This model has emerged as a very successful tool for creating systems that run in an in-memory clustered environment across multiple machines.

The three salient features of the Actor Model are

  • Millions of actors can run in parallel with excellent performance as none of the actors share its state with other actors - so concurrency is abstracted & taken care of by the mechanics of the model itself.
  • The Actor model provides a clean and well defined error handling mechanism with its “let-it-crash” model. The model allows an actor to crash in case of an exceptional flow and also provides means to restart the Actor with its stable state. This precludes cascading failures and downtimes.
  • With actor model, one need not hand code concurrency which if not meticulously done, can have serious side effects in terms of both - performance and functionality. Using the actor model frees the developer from the burden of implementing perfect concurrency code. All the plumbing and wiring of concurrency is taken care by the implementation of Actor Model

Very importantly, it is not only about concurrency but also about parallelism. Multiple actors can run in parallel on different cores across different machines

Use Cases

Actors can be used almost everywhere. It is just that the architectural style must adhere to the principles of the actor model. Huge transaction processing systems in domains like finance,  betting, social media, telecom can be developed using the actor model which will provide excellent scale up, scale out & fault tolerance along with High Availability.
Batch processing is yet another kind of application that can leverage the actor model.
The batch workloads can be divided among actors. If AKKA is the library used then you can also integrate with Apache Camel to hook up with different data sources. I have also seen a company using the Actor Model to process REST calls asynchronously together with NETTY which enhanced the performance by tenfold on number of users served per node/server.  One of the companies in UK have used the Actor Model to implement vehicle crash repair to ensure that crash repair information is provided real time to enable the safe and cost effective repairs of vehicles.

Then, live updates on web sites (like views, likes etc.), showing live user comments, notification services etc. can all be implemented for robustness and performance using the actor model.

Libraries

The most extensively used libraries for the actor model is AKKA which has both the flavors - Scala & Java. All the aforementioned use cases are mostly implemented using AKKA (either on Scala or Java).
AKKA is state of the art library that can be used to build powerful reactive, concurrent, and distributed applications pretty much with ease. It is quite resilient by design and performs exceptionally well.

How can we help?

We have immense experience in delivering portals and enterprise applications. Scalability is one of the keys asks from our customers and we have been providing different solutions based on specific needs and budgetary constraints. We have helped our customers to scale their application across x axis (traditional clustering) & y axis scaling on services by breaking down monolith application into micro-services. We have now started helping our customers to architect and implement the actor model to scale with in-memory clustered environments using libraries like AKKA. Give us a shout in case you have scalability or performance related issues with your application.

Muhammed Shakir

The author of this article heads technology @CIGNEX. Write to us at info@cignex.com if you need to have a short discussion with him on your application scalability needs.