SDE-1 All-In Guide
Projects and options

Logsmith: an append-only event log

A small Go event log with durable appends, recovery, consumer offsets, and measured performance.

Build a small append-only event log in Go. Learn how sequential writes, durable commits, and consumer offsets behave when a process stops unexpectedly. This project is a learning system, not a Kafka replacement.

Focus: file I/O, recovery, concurrency, and delivery semantics. Plan about 55 to 65 hours across global weeks 8 to 13. The milestones below use project weeks 1 to 6.

Use the project reading in the calendar

Read the linked sources in the calendar reading slots. Do not add a separate reading block before the build.

The flow

Loading diagram…

Build spec

Scope

  • Core: append records, recover after restart, read records, and persist consumer offsets.
  • If time allows: retention, a small Go client, and benchmark comparisons.
  • Cut first: compaction, zero-copy reads, and replication. These features add substantial edge cases and are not needed to explain the core design.

Start with one process and one disk. Describe how you would partition and replicate it in the design note; do not imply that the single-node demo provides those guarantees.

Log format

  • Topic leads to partitions, which lead to segment files (0000001.log plus a sparse .index every N bytes).
  • CRC32 checksum per record, so you can tell a torn write from a good one.

Writes and recovery

  • Append path is write-ahead, with the fsync policy selectable from the CLI (always | every_100ms | never).
  • Crash recovery: truncate the partial tail record, rebuild the index on boot, and log what was repaired.
  • Optional design exercise: describe how leader epochs and fencing could prevent an old leader from accepting writes. Implement replication only if the core is complete.

Reads

  • Reads use ordinary file reads first. Treat sendfile as an optional comparison, and measure whether it helps this workload.

Consumer groups

  • Consumer groups: assign partitions to consumers and persist committed offsets.
  • Keep assignment deterministic in the first version. Add rebalance behavior only after restart recovery works.

Delivery semantics

  • Toggle between commit-then-process (at-least-once) and process-then-commit (at-most-once).
  • Tests demonstrate the exact failure of each mode.

Retention

  • Optional retention by size or age.
  • Compaction is a stretch feature. State its recovery and ordering limits if you implement it.

Client and benchmarks

  • Thin Go client library plus CLI (logsmith produce/consume/admin).
  • Benchmark harness: produce MB/s and msgs/s per fsync mode, p99 append latency, consume throughput. Document the disk type.

Milestones

Project week 1: Append records, read them back, and define the on-disk format.
Project week 2: Add checksums and recover a partial final record after restart.
Project week 3: Add consumer offsets and tests for restart and duplicate delivery.
Project week 4: Add bounded retention or replay, based on the time available.
Project week 5: Benchmark append and read behavior on a documented workload.
Project week 6: Finish the README, design note, and demo. Publish measured results.

Artifacts to publish

  • README with the record format, recovery steps, and measured benchmark results.
  • A short restart demonstration using a reproducible input.
  • Optional post explaining the design trade-offs and test results.

Interview yield

Why Kafka is fast (sequential I/O, page cache, zero-copy) · partition ordering · at-least and at-most-once first-hand · retention and compaction · consumer rebalance trade-offs.

On this page