title: What's the best way to design message key in Kafka?
body: <p>I have a partitioned topic, which has <code>X</code> partitions.</p>
  
  <p>As of now, when producing messages, I create Kafka's <code>ProducerRecord</code> specifying only <code>topic</code> and <code>value</code>. I do not define a <code>key</code>. 
  As far as I understand, my messages gonna be distributed evenly amongst partitions using default built-in partitioner.
  On the other hand, I have a thread pool of Kafka consumers. Each Kafka consumer will be running in its own dedicated thread consuming messages from the topic. Each of those consumers is given the same <code>group.id</code>. This will allow consuming messages in parallel. Every consumer will be assigned its fair share of partitions to read from.</p>
  
  <p>I want my messages to be consumed in an orderly fashion. I know that Kafka guarantees the order of messages within a partition. So, as long as I come up with a proper key structure, I will have my messages partitioned in a way that they will end up in the same partition. In a way, message key groups messages and stores them in the partition.</p>
  
  <p>Does it make sense?</p>
  
  <p>Q: Is there a chance that due to a badly designed key I will get uneven partitions? One may receive way more records than the others. Can it impact in a bad way performance of my Kafka cluster? What are the best practices for message key design?</p>