Monday, November 18, 2013

Design Pattern - Adding Instrumentation and other metrics collection to Akka Actors

Design Pattern - Adding Instrumentation and other metrics collection to Akka Actors without polluting the business logic

Thursday, January 3, 2013

Akka Essentials Giveaway contest!

Year 2013 has begun and what better way to start then by participating in the contest organized by Packt Publishing.

The Prize

The prizes are 2 print copies and 2 ebooks of my new book Akka Essentials that was published couple of months back.

Akka Essentials will show you the current challenges with Java Scalability and concurrency model and how Akka’s Actor Model can help you design and build applications that are inherently scalable and fault-tolerant. Whether you are building new applications or want to refactor an existing application, you will learn the right techniques to build and scale up in no time.

This book is aimed at developers, architects who are building large distributed concurrent and scalable applications using Java/Scala.

What you will learn from Akka Essentials:
Scale up and out your applications using dispatchers and remoting
Build fault tolerance within your application
Handle transactions within your application
Unit test your Akka applications
Integrate your Akka applications with existing enterprise systems using Zeromq
Monitor the health of your Akka application

How to Win Akka Essentials

You can enter by writing a comment to this post explaining why you would like to have the book. The contest has already started and will end on January 31st 2013 at 11:59 PM GMT. Winners will be randomly chosen and notified by email, after termination of the contest. Please do not forget to leave your email id in the comment.

The contest is open to everybody in the world, however print copies are only available to residents of the US
and Europe.

Comments are moderated by me, so your comment will not appear immediately.

I wish all the contest participants good luck.

Wednesday, January 2, 2013

Software Transactional Memory (STM)

The Actor Model is based on the premise of small independent processes working in isolation and where the state can be updated only via message passing. The actors hold the state within themselves, but the asynchronous message passing means there is no guarantee that a stable view of the state can be provided to the calling components. For transactional systems like banking where account deposit and withdrawal need to be atomic, this is a bad fit with an Actor Model.So, if your Akka applications need to be implementing a shared state model and providing a consensual, stable view of the state across the calling components, Software Transactional Memory (STM) provides the answer.

STM provides a concurrency-control mechanism for managing access to shared memory. STM makes use of two concepts –  optimism and transactions to manage the shared concurrency control.
  • Optimism means that we run multiple atomic blocks in parallel, assuming there will be no errors. When we are done, we check for any problems. If no problems are found, we update the state variables in the atomic block. If we find problems then we roll back and retry. Optimistic concurrency typically provides better scalability options than any other alternate approaches. 
  • Secondly, STM is modeled on similar lines of database transaction handling. In the case of STM, the Java heap is the transactional data set with begin/commit and rollback constructs. As the objects hold the state in  memory, the transaction only implements the following characteristics – atomicity, consistency, and isolation.

Friday, December 28, 2012

Adding Turbchargers to JEE Apps

One of the key roles, I play is evangelizing Akka within my local community. As part of the discussions, the question/doubt usually in people's mind is how can Akka provide better scalability and concurrency against a well written Java/JEE application. Since the underlying hardware/JVM remains the same, how can the actor model ooze out more power than the traditional JEE applications. In order to showcase the skeptics we decided to do small test where we take an existing JEE Web application, remodel the business logic to make use of the actor model and run tests against the same.

DayTrader Application

DayTrader is a benchmark application built around the paradigm of an online stock trading system. The application allows users to login, view their portfolio, lookup stock quotes, and buy or sell stock shares. DayTrader not only serves as an excellent application for functional testing, but it also provides a standard set of workloads for characterizing and measuring application server and component level performance.

DayTrader is built on a core set of Java EE technologies that includes Java Servlets and JavaServer Pages (JSPs) for the presentation layer and Java database connectivity (JDBC), Java Message Service (JMS), Enterprise JavaBeans (EJBs) and Message-Driven Beans (MDBs) for the back-end business logic and persistence layer.

More information about DayTrader is available here.