OversizedPayloadException Akka

266 Views Asked by At

This is the exception if the payload sent is greater than a threshold set. Is there a way I can know the size of the cluster message(not just the json size) being exchanged and handle this case before passing the cluster message to the sender?

1

There are 1 best solutions below

0
On

It's not possible to say the exact overhead in general, since the envelope contains the sender and receiver system addresses which in turn contain the host names of the systems, actor system names and the actor paths, additionally it contains the string manifest from the serializer used to serialize the actual payload, all of these may be of different sizes.

For reasonably short strings - ip based hostname, top level actor with short name, single character serializer string manifest the overhead is something around 120 bytes.

Note that this is for the current stable remoting, in the next-gen remoting, "Artery", we have compression implemented for actor refs making those as small as an index into a cache.