Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Lightweight and Fault-tolerant: Using compacted topics as a source of truth

Lightweight and Fault-tolerant: Using compacted topics as a source of truth

Deck presented at the June 2018 Toronto Kafka meetup

Elizabeth Giles

June 14, 2018
Tweet

Other Decks in Technology

Transcript

  1. Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service

    Processing Service Event Event Event Event Event Event Event Event Event Event Event Event Event Event Event
  2. Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service

    Processing Service Event Event Event Event Event Event Event Event Event Event Event Event Event Event Event Processing Service Ingestion Service HELP!!!
  3. Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service

    Processing Service Event Event Event Event Event Event Event Event Event Event Event Event Event Event Event Processing Service Ingestion Service Customer: Acme Age: 5 minutes Customer: Acme Age: 0 minutes Throttle: Customer: Acme For: 10 minutes To: 20 events/minute
  4. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10 1 byte
  5. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 4 bytes segment.bytes=4, roll.ms=10
  6. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 10 ms segment.bytes=4, roll.ms=10 4 bytes
  7. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 10 ms segment.bytes=4, roll.ms=10 10 ms 4 bytes
  8. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 Current Segment segment.bytes=4, roll.ms=10 10 ms 10 ms 4 bytes
  9. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10 S4 S3 S2 S1
  10. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.bytes=4 S4 S3 S2 S1
  11. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.bytes=4 S4 S3 S2 S1
  12. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.bytes=4 S4 S3 S2
  13. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.ms=10 S4 S3 S2 S1
  14. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.ms=10 S4 S3 S2 S1
  15. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=delete, retention.ms=10 S4
  16. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1
  17. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Clean Dirty Uncleanable Cleanable
  18. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Clean Key Last Offset “a” 7 “d” 6
  19. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
  20. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
  21. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
  22. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
  23. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
  24. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S3 S2 S1 Key Last Offset “a” 7 “d” 6
  25. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S1
  26. Offset 1 2 3 6 7 Key “b” “f” “c”

    “d” “a” Value 2 3 4 7 8 Time 1 2 3 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact S4 S1
  27. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.compaction.lag.ms=20 S4 S3 S2 S1
  28. Offset 0 1 2 3 4 5 6 7 Key

    “a” “b” “f” “c” “d” “a” “d” “a” Value 1 2 3 4 5 6 7 8 Time 0 1 2 3 4 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.compaction.lag.ms=20 S4 S3 S2 S1
  29. Offset 1 2 3 5 6 7 Key “b” “f”

    “c” “a” “d” “a” Value 2 3 4 6 7 8 Time 1 2 3 25 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.min.compaction.lag.ms=20 S4 S3 S1
  30. Offset 0 1 2 3 4 5 6 7 8

    9 Key “a” “b” “f” “c” “f” “d” “a” “c” “d” “a” Value 1 2 3 4 null 5 6 null 7 8 Time 0 1 2 3 4 5 25 6 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.delete.retention.ms=20 S4 S3 S2 S1
  31. Offset 0 1 2 3 4 5 6 7 8

    9 Key “a” “b” “f” “c” “f” “d” “a” “c” “d” “a” Value 1 2 3 4 null 5 6 null 7 8 Time 0 1 2 3 4 5 25 6 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.delete.retention.ms=20 S4 S3 S2 S1
  32. Offset 0 1 2 3 4 5 6 7 8

    9 Key “a” “b” “f” “c” “f” “d” “a” “c” “d” “a” Value 1 2 3 4 null 5 6 null 7 8 Time 0 1 2 3 4 5 25 6 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.delete.retention.ms=20 S4 S3 S2 S1
  33. Offset 1 7 8 9 Key “b” “c” “d” “a”

    Value 2 null 7 8 Time 1 6 36 37 segment.bytes=4, roll.ms=10, cleanup.policy=compact, cleaner.delete.retention.ms=20 S4 S3 S1
  34. Ingestion Service Processing Service Ingestion Service Ingestion Service Processing Service

    Processing Service Event Event Event Event Event Event Event Event Event Event Event Event Event Event Event Processing Service Ingestion Service Customer: Acme Age: 5 minutes Customer: Acme Age: 0 minutes Throttle: Customer: Acme For: 10 minutes To: 20 events/minute
  35. Requirements: 1. Processing service can create throttles 2. Ingestion service

    can use throttles 3. Resilience to loss of throttle data
  36. Requirements: 1. Processing service can create throttles 2. Ingestion service

    can use throttles 3. Resilience to loss of throttle data