Getting started with Akka.net
Feb5Written by:
2017/02/05 06:50 PM
Computers have come a long way since the early 1960's, 1970's and even the 1980's. Where at one time personal computers were never heard of, and any real computer that could do anything substantial took up a whole room or even a whole floor of an office building.
My first computer I had was in the early 1980's. It was a Sinclair ZX spectrum, with, wait for it, a grand total of 48k ram. I first learned to program using Sinclair Basic. Programming primarily games and some business projects posted in computer magazines which I got from the UK.
Computers were a life saver to many, doing monotonous and various other tasks very fast and very accurate. But no matter how fast computers were, they still only processed one instruction at a time. Admittedly the time to process that instruction was very, very small.
Parallel programming is hard
As more and more people got to use computers, they tried to squeeze as much power out of the computers as they can. But because computers only process one thing at a time, the idea of multi-tasking and multi-threading was a pipe dream. Not only had the hardware not been able to support it, but not many if any programming languages could.
For example, parallel programming was only available to C# programmers from version 5.0. Yes, there were ways to work around the problem and pseudo-multi-tasking options were available, but not true multi-threading.
So one of the ways to make computers faster, work harder and do more was to increase the power and speed of the hardware. Faster CPU's, faster memory, faster Hard Drives, multiple CPU's etc. But still computers are only able to process one thing at a time.
They were smart at it though. Various methods were employed to mimic parallel computing. Like time slicing, time sharing, scheduling, etc.
When so called multi-tasking eventually become main stream, it was very hard. It was hard to understand grasp and hard to execute. You had to worry about things like dead locks, race conditions, memory leaks, memory corruption, synchronisation issues. The list goes on.
But many will argue saying that multi-threading is easy or should be. If it were that easy, then why is it not our go to happy place in programming.
Alas, there is a simpler and better way of doing things. Especially for simple programmers like most of us. I prefer to leave the difficult stuff to guys who have already solved the problem.
A case for Akka.net to solve.
Enter Akka.net. A concurrent, distributed computing framework using the Actor and messaging model.
The actor model is an old technology, originating in 1973 as an approach to parallel computing.
The Actor model is used across many different industries solving the problem of Processing Everything Right Now. Nowadays if you cannot process something in a Nano second, then you might as well give up.
Akka.Net is a port to .Net of Akka. Akka is a framework for developing scalable, fault tolerant and concurrent applications. Its aim is to abstract away the difficult part of multi-threading and parallel programming. Akka.NET is an open-source library for building concurrent, fault-tolerant and scalable systems using the actor model.
Akka.net gives you and I, the programmer some useful benefits.
- Simple high level abstraction for concurrent and parallel programming
- Asynchronous, non-blocking, high performing event-driven object orientated programming model
- Very light weight objects and processes. several million actors per GB of heap memory
Along with this, you also get fault tolerance with a "let it crash and we will recover" attitude. Akka.NET actors give you the ability to build self-healing systems that can recover from failure
Also, you get location transparency. Everything in Akka is designed to work in a distributed environment: all interactions of actors use pure message passing and everything is asynchronous. So it matters not if your computing power is on your laptop at home, or on some PC on the other side of the world. It's all the same to Akka.net.
Actors are like "micros processors". Multiple actors can all execute concurrently on multiple cores built into a laptop or server.
image from https://petabridge.com/blog/akkadotnet-business-case/
Getting started.
Over the next few blog posts we will get into more detail on how to use Akka.net. But here are a few things to whet your appetite and get you started.
- Use the nugget package to install the Akka.net dependencies into your project. To install Akka, run the following command in the Package Manager Console. Install-Package Akka.
- Download or clone the Akka.net source from github. https://github.com/akkadotnet/akka.net
- Complete Akka.NET Bootcamp, which will get you off to a fast start with the actor model's concepts and Akka.NET's implementation.
- Read and learn more at Akka.net
blog comments powered by