Kafka has a reputation for being scary to configure. But if you want to write data quickly, you mainly need to understand just 2 little parameters.

First of all, what makes writing to Kafka faster or slower? Each time a producer sends data to the broker, it does a network roundtrip. That presents a problem because network calls are among the most expensive operations you can do.
The solution is to batch and send many records in each network call. Which leaves the question: how big should each batch be before you send?
Kafka producers have two parameters to control that:
linger .ms tells the producer to wait n milliseconds have elapsedbatch.size tells the producer to wait until m bytes are accumulatedThe first condition to become true triggers a network call.
Two rules of thumb:
Keep in mind that to make Kafka fast, you also need your broker to be in good shape. Things like replication factor and partition count matter just as much.