How to create topics in apache kafka?

前端 未结 6 1147
-上瘾入骨i
-上瘾入骨i 2021-01-31 17:09

What is the bestway to create topics in kafka?

  • How many replicas/partitions to be defined when we create topics?

In the new producer API, when i try

6条回答
  •  醉话见心
    2021-01-31 17:52

    The basic level of parallelism in Kafka is the partition. On both the producer and the broker side, writes to different partitions can be done fully in parallel.

    Things to keep in mind

    • More Partitions Requires More Open File Handles
    • More Partitions May Increase Unavailability
    • More Partitions May Increase End-to-end Latency

    As a rule of thumb, it’s probably a good idea to limit the number of partitions per broker to 100 x b x r, where b is the number of brokers and r is the replication factor.

    For example: If you have 9 brokers/nodes in your cluster your topic could have

    • 1800 partitions with 3 replicas, or
    • 900 partitions and 2 replicas

    EDIT: See the article How to choose the number of topics/partitions in a Kafka cluster? for further details (answer has been taken from there)

提交回复
热议问题