This article is a mirror article of machine translation, please click here to jump to the original article.

View: 7190|Reply: 2

【Practical Combat】Kafka parameter tuning solves the problem of too large message body

[Copy link]
Posted on 12/13/2021 4:25:11 PM | | | |
When sending messages using Kafka, the producer max.request.size defaults to:1048576(1M) in size.



If the producer message body exceeds 1MB, the following error is reported:

The message is 18685640 bytes when serialized which is larger than 1048576, which is the value of the max.request.size configuration.



solution

For example, in the spring project, set the maximum request size in the project's configuration file20MBAs follows:

After the setup is completed, restart the project, and you can see that the settings have been successful, as shown in the figure below:



When the message sent exceeds 1MB, a new error will be reported, as follows:

The request included a message larger than the max message size the server will accept.

solution

Log in to the Kafka server and modifyserver.propertiesfile, add the following configuration:

Default: 1000012, close to 1M, the maximum size of messages that the server can receive.

Restart the Kafka service and the issue is resolved.

There are no other settings for consumersFor example:

(End)





Previous:CentOS builds Kafka message middleware
Next:JS intercepts the response information for all requests for XMLHttpRequest
 Landlord| Posted on 12/13/2021 4:31:31 PM |
Note: This parameter does not work on the created topic after it is adjusted

Adjust the created topic parameters: bin/kafka-configs.sh --zookeeper localhost:2181 --alter --topic topicName --config max.message.bytes=62914560

Perfect solution
Posted on 12/26/2021 5:16:30 PM |
Learn to learn...
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com