Akka.Net Sending huge messages (maximum-frame-size)

北城以北 提交于 2019-12-06 03:14:48

In general it's a bad idea to push big portions of data over the wire at once. It's a lot better to split them into smaller parts and send one by one (this also makes a retry policy less expensive, if it's necessary). If you want to keep your actor logic unaware of transport details, you may abstract it by defining a specialized pair of actors, whose only job will be to split/join big messages.

Also as Aaron - creator of Helios (socket server used by Akka.NET) - mentioned you should not use to big messages since they stretch server's buffer pool size, but once it's stretched, it won't be reduced again.

You should cut up your messages into much smaller pieces and reconstitute the object on the receiving end. It will make your retries much easier, and also not "hog" the socket (e.g. if you're sending 100mb through a socket, you're tying it up so heartbeats can't get through from remote systems).

I wrote an in-depth post about what goes on w/ large messages and sockets in Akka.NET that you may find useful. But the short answer is cut up your messages into small pieces and rebuild it on the receiving end, or better yet, process them in a streaming fashion.

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