Thursday, March 15, 2012
Processing 10 million messages with Akka
When I ran the program on my iMac machine with an intel i5 - 4 core, 4 Gb RAM machine and JVM heap at 1024Mb, the program processed 10 million machines in 23 secs. I ran the program multiple times and the average time was in the range of 25 secs. So the through put I received was almost in the range of 400K messages per second which is phenomenal.
The below picture explains the flow used to simulate the load generation scenario.
Caveat: Each message sends a response after 1 second which is not the right simulation for a real world scenario. The message processing will consume some resources on the heap and gc activity which are not accounted for, in this scenario.
The program uses overall direction from the post Akka actors : 10 millions messages processed (1s / message) in 75 seconds ! although without any messages throttling.
The code base for the program is available at the following location - https://github.com/write2munish/Akka-Essentials
The ApplicationManagerSystem creates the actors and pumps in the traffic to the WorkerActor
Once the messages are received by the WorkerActor, the responses are scheduled to be send after 1000 milli secs
The response messages from the WorkerActor are send across to the JobControllerActor, that collects all the responses.