Performance of message-passing in the Actor model [closed]

随声附和 提交于 2019-12-10 15:11:24

问题


I've seen benchmarks of Actor model implementations done in terms of their actors. For example, Akka actors are very lightweight (600 bytes per actor) and millions of them can be created. However, I've never seen a benchmark done in terms of message-passing throughput.

For example, given some number of actors, how many messages can pass between them per second?

Does anyone have a link to such a performance benchmark (in terms of message-passing throughput)?


回答1:


Here is a benchmark implemented in

  • Akka 0.8.1 (Scala)
  • Scala Actors
  • Jetlang (Java)

Also see Azul Vega 1 + Scala actors and Azul Fast Bytecodes for Funny Languages and this paper.




回答2:


When I ran a performance test with this simple actor built around my implementation of the model it had a 444773.906 message per second throughput. Clearly it is a contrived test but it gives you a general idea of how it might perform in the wild.

private class TestActor : Actor<int, bool>
{
    protected override void ProcessMessage(AsyncReplyPackage<int, bool> package)
    {
        package.ReplyChannel.Send(package.Message > 2000000);
    }
}

static void Main(string[] args)
{
    var r = false;
    using (var ts = new TestActor())
    using (var rc = new AsyncChannel<bool>())
    {
        ts.PostWithAsyncReply(0, rc);
        r = rc.Receive();

        var count = 3000000;
        var sw = Stopwatch.StartNew();
        for (int i = 0; i < count; i++)
        {
            ts.PostWithAsyncReply(i, rc);
            r = rc.Receive();
        }
        Console.WriteLine(sw.Elapsed);
    }
    Console.WriteLine(r);
    Console.ReadLine();           
}

Size

I broke out the profiler and it looks like my implementation is 944 bytes. :(



来源:https://stackoverflow.com/questions/3358044/performance-of-message-passing-in-the-actor-model

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!