---
title: "Challenge #5c: Efficient Kafka-Style Log"
---

# Challenge #5c: Efficient Kafka-Style Log

In this challenge, you’ll need to take your [Multi-Node Kafka system](https://fly.io/dist-sys/5b) and make it more efficient. Storing data in `lin-kv` has a drawback in that with multiple leaders and a high request rate, you’re likely to see frequent compare-and-swap errors due to contention on shared keys.

## Specification

Using the Lamport diagrams (`messages.svg`) and network stats (`results.edn`) as your guide, reduce the probability of CaS failures and improve overall efficiency. Your solution should exchange significantly fewer messages per operation. Improve your latency & availability.

All correctness checks should still pass.

## Evaluation

Build your Go binary as `maelstrom-kafka` and run it against Maelstrom with the following command:

```
./maelstrom test -w kafka --bin ~/go/bin/maelstrom-kafka --node-count 2 --concurrency 2n --time-limit 20 --rate 1000
```

This challenge has a looser definition of success. See how much you can improve your performance and availability. Post your results or swap notes with folks on the [Fly.io Community forum](https://community.fly.io/)

Once you’re done, then you’ve completed the Kafka challenge! Continue on to the [Totally-Available Transactions challenge](https://fly.io/dist-sys/6a).

1. **Echo**
   Get the hang of working with Maelstrom in Go by creating a node which is a binary that receives JSON messages
   
   [Read More About Echo](https://fly.io/dist-sys/1)
2. **Unique ID Generation**
   Implement a globally-unique ID generation system that runs against Maelstrom's unique-ids workload
   
   [Read More About Unique ID Generation](https://fly.io/dist-sys/2)
3. **Broadcast**
   Implement a broadcast system that gossips messages between all nodes in the cluster. Gossiping is a common way
   
   [Read More About Broadcast](https://fly.io/dist-sys/3a)
4. **Grow-Only Counter**
   Implement a stateless, grow-only counter which will run against Maelstrom's g-counter workload. This
   
   [Read More About Grow-Only Counter](https://fly.io/dist-sys/4)
5. **Kafka-Style Log**
   Implement a replicated log service similar to Kafka. Replicated logs are often used as a message bus or
   
   [Read More About Kafka-Style Log](https://fly.io/dist-sys/5a)
6. **Totally-Available Transactions**
   Implement a key/value store which implements transactions. These transactions contain micro-operations
   
   [Read More About Totally-Available Transactions](https://fly.io/dist-sys/6a)
