Coder Social home page Coder Social logo

I keep getting MessageSizeTooLargeError, error message gives size much bigger than actual message were given to producer. about aiokafka HOT 9 OPEN

ant0nk avatar ant0nk commented on May 26, 2024
I keep getting MessageSizeTooLargeError, error message gives size much bigger than actual message were given to producer.

from aiokafka.

Comments (9)

vmaurin avatar vmaurin commented on May 26, 2024

How do you serialize with avro ? Avro is a format where a schema is required for the producer to serialize and the consumer to deserialize, otherwise is just gibberish bytes. Usually the strategy with kafka is to store schema in some sort of central registery, then put in kafka header the reference to the schema used to produce the message. It is what confluent is doing with their schema registry.

As far as I know aiokafka doesn't provide anything avro related, so the serializer/deserializer must be from your own implementation. Depending on what you are doing, it might be that your serialized message is containing both the schema and the data

from aiokafka.

ant0nk avatar ant0nk commented on May 26, 2024

@vmaurin I'm using kafkit library for serialization and communication with schema registry.

from aiokafka.

vmaurin avatar vmaurin commented on May 26, 2024

Maybe try to dump the message you serialized before passing it to aiokafka ? Otherwise, as far as I can see, the size is checked per message https://github.com/aio-libs/aiokafka/blob/master/aiokafka/producer/producer.py#L411 (even if then messages might be batched)
The formula seems to be : overhead + len(key) + len(value)
Headers seems ignored

from aiokafka.

ant0nk avatar ant0nk commented on May 26, 2024

@vmaurin Can I specify max_request_size for producer bigger than broker's relevant value if I have compression enabled?

from aiokafka.

vmaurin avatar vmaurin commented on May 26, 2024

You mean max.message.bytes on broker/topic ? It might be then it seems to be applied after compression, but then it is also applied to a batch of message, while the check in aiokafka is just for a single message

from aiokafka.

ant0nk avatar ant0nk commented on May 26, 2024

@vmaurin yes, but I use send_and_wait() to send immediately, so I hope batch will not exceed max.message.bytes too.

from aiokafka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.