Through almost one year of using Akka I have familiarized myself with its API. I have learned its strong sides and its quirks. But the internals, the way Akka achieves its nonblockingness and amazing performance, remained in the realm of unicorns and sun.misc.Unsafe. Finally, I decided to have a look under the hood. Three main questions bothered me:
Guess what I’ve found inside Akka: lots of sun.misc.Unsafe! But once I’d found my answers, it turned out they are much simpler than I expected (and they don’t contain the word Unsafe). In fact, the basic principles of implementing an actor system in Java/Scala turned out to be so simple, that I could do it myself. And that’s exactly what I did!
Furthermore, I decided to share it with my colleagues during our weekly Knowledge Sharing session, where I conducted two hours long live coding session – enough to implement Neo and Mr Smiths as actors. If you have a few spare hours for learning, I encourage you to try implementing a simple actor system from the ground up yourself. If you don’t, you can have a look at what we wrote. Just check it out from github (the actor system is less than 150 LOC !).