11

I want to use Akka Remoting to exchange message over network between actors, but for large String message i got the following error:

akka.remote.OversizedPayloadException: Discarding oversized payload 
sent to Actor :: max allowed size 128000 bytes
, actual size of encoded class scala.

How can i fix this limitation?

Saeed Zarinfam
  • 9,818
  • 7
  • 59
  • 72

1 Answers1

18

I add the following configuration and now everything is ok:

akka {

  actor {
    provider = "akka.remote.RemoteActorRefProvider"
  }

  remote {
    maximum-payload-bytes = 30000000 bytes
    netty.tcp {
      hostname = "127.0.0.1"
      port = 2552
      message-frame-size =  30000000b
      send-buffer-size =  30000000b
      receive-buffer-size =  30000000b
      maximum-frame-size = 30000000b
    }
  }
}
Saeed Zarinfam
  • 9,818
  • 7
  • 59
  • 72
  • just be careful increasing this limit too high. your sockets could get blocked and your heartbeats might fail. – Oofpez Jul 28 '20 at 11:31
  • 1
    With Artery this setting is now `akka.remote.artery.advanced.maximum-frame-size` – David Nov 29 '21 at 16:51