Why does Kafka limit the message size by default?

  • Different sizing, configuration, and tuning required for large message handling compared to a mission-critical real-time cluster with low latency.
  • Large messages increase the memory pressure on the broker JVM.
  • Large messages are expensive to handle and could slow down the brokers.
  • A reasonable message size limit can meet the requirements of most use cases.
  • Good workarounds exist if you need to handle large messages.
  • Most cloud offerings don’t allow large messages.

There are noticeable performance impacts from increasing the allowable message size.

Hence, understand all alternatives discussed below before sending messages >1Mb through your Kafka cluster. Depending on your SLAs for uptime and latency, a separate Kafka cluster should be considered for processing large messages.