Monday, April 22, 2013

Play : Get ride of Thread.sleep to simulate remote processing

With play/akka it is very easy to simulate a remote processing requiring several seconds to be processed and without consuming system resources such as threads. Just create a Promise, ask akka scheduler to execute a small piece of code that will fulfill the promise after the given delay, and then finish with Async instruction.

Using this approach I was able to apply a C25K load on a play server using gatling2 stress tool. With a linux 3.7.x kernel and some tuning (nproc at least), we can even reach quite higher value.