简体   繁体   English

Kafka多个制作人写同一主题 - 消息和数据突发的排序

[英]Kafka multiple producer writing to same topic - Ordering of message and data burst

I am trying to learn about Kafka. 我想了解卡夫卡。 Say I have multiple producer each writing to same Topic. 假设我有多个制作人,每个人都写同一个主题。 (Cant have more topics because of design and we using avro for serialization) Because our message is too big, we need to divide it into small parts and we send it to kafka. (由于设计和我们使用avro进行序列化,因此无法拥有更多主题)因为我们的信息太大,我们需要将其分成小部分并将其发送给kafka。

In this scenario - Can mesages from different Producers can intermix ? 在这种情况下 - 来自不同生产者的消息可以混合吗? How can I avoid this scenario ? 我该如何避免这种情况? any ideas 有任何想法吗

Also , we have huge databurst, like there will be 1000s of message in 2 minutes, then very few message for next 5 to 7 minutes, what can we do in such scenarios 此外,我们有巨大的数据库,就像在2分钟内会有1000条消息,然后在接下来的5到7分钟内消息很少,在这种情况下我们可以做些什么

Because our message is too big, we need to divide it into small parts and we send it to kafka. 因为我们的信息太大,我们需要将其分成小部分,然后将其发送给kafka。

Do you? 你呢? You runned basic tests and had some issues? 您运行了基本测试并遇到了一些问题? Have you tried to adjust buffers? 你试过调整缓冲区吗? I'm pretty sure that kafka can handle relatively big messages (tens of megabytes) without much hassle. 我很确定kafka可以毫不费力地处理相对较大的消息(数十兆字节)。 In fact, you will likely get a better throughput, comparing to the huge number of tiny messages. 实际上,与大量微小消息相比,您可能会获得更好的吞吐量。

Also , we have huge databurst, like there will be 1000s of message in 2 minutes, then very few message for next 5 to 7 minutes, what can we do in such scenarios 此外,我们有巨大的数据库,就像在2分钟内会有1000条消息,然后在接下来的5到7分钟内消息很少,在这种情况下我们可以做些什么

Single kafka broker on a modern server machine can easily handle ~20k-40k messages/ per second (batched of 1000 messages, each 2k size, sync mode). 现代服务器机器上的单个kafka代理可以轻松处理每秒 ~20k-40k消息(批量处理1000条消息,每个2k大小,同步模式)。 I don't see a problem there. 我没有看到问题。

Can messages from different Producers can intermix ? 来自不同生产者的消息可以混合吗?

Yes, they might intermix. 是的,他们可能是混合的。 In fact, this moment is not well defined by the kafka protocol and particular implementation may change this behaviour, so for stable solution take a look at the below section. 实际上,kafka协议并没有很好地定义这一时刻,特定的实现可能会改变这种行为,因此对于稳定的解决方案,请看下面的部分。

How can I avoid this scenario? 我该如何避免这种情况?

Kafka has a concept of partitions: each topic by default has 1 partition, each partition can be thought as a unit of parallelism. Kafka有一个分区的概念:每个主题默认都有1个分区,每个分区都可以被认为是并行的一个单元。 Setup appropriate partitioner, such that each producer writes to it's own partition, in isolated manner. 设置适当的分区程序,以便每个生成器以隔离的方式写入它自己的分区。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 卡夫卡多个制片人写同一主题? - Kafka multiple producer writing to same topic? Kafka Producer(具有多个实例)写入同一主题 - Kafka Producer (with multiple instance) writing to same topic Kafka - 编写同一主题和消息顺序的多个制作人很重要 - Kafka - Multiple producers writing to same topic and order of message is important Kafka 在同一主题和分区上与多个生产者进行排序 - Kafka ordering with multiple producers on same topic and parititon 在kafka上写相同的话题 - Writing to same topic on kafka 如果我有多个生产者向 Kafka 生产相同的数据,为每个生产者配置一个主题或为所有生产者配置一个主题是否有效 - If I have multiple producers producing same data to Kafka,Is it efficient to configure one topic for each producer or one topic for all producers 生产者重试时分区中的Kafka消息排序 - Kafka message ordering in partition while producer retry Kafka Producer、Broker 和 Topic 中的相同配置 - Same configuration in Kafka Producer, Broker and Topic 多个 Kafka 生产者写入同一主题 - 如何负载平衡消费 - Multiple Kafka Producers writing to the same topic - how to load balance consumption 如何在多个主题的同一主题上使用多个kafka消息? - How to consume multiple kafka message at same topic with multiple ack?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM