Share
Embed
When an innocent-looking ListOffsets Call Took Down Our Kafka Cluster
Troubleshooting Case Study in a large-scale Kafka deployment operation at LY
LINEヤフーTech (LY Corporation Tech) PRO
March 04, 2026
Transcript
19 slides
-
© LY Corporation Haruki Okada When an innocent-looking ListOffsets Call
Took Down Our Kafka Cluster LY Corporation LYMQ Division -
© LY Corporation 2 Self introduction • Haruki Okada (X/GitHub:
@ocadaruma) • Technical lead of IMF team at LY Corporation • The team is responsible for providing company- wide Kafka platform • Interests • Distributed Systems, Formal methods, … -
© LY Corporation 3 Apache Kafka at LY Corporation •
Kafka is widely adopted by many services for various purposes • We provide multi-tenant large scale Kafka cluster -
© LY Corporation 4 Apache Kafka at LY Corporation: Scale
• Peak Messages Throughput: • 33.6 million messages / sec • Daily incoming messages: 1+ trillion messages • Daily In/Out Bytes: 3 petabytes -
© LY Corporation 5 Operating Kafka at scale • Kafka
is mature, battle-tested software • However, at this scale, we sometimes hit issues that no one have encountered before -
© LY Corporation 6 Agenda • Overview of the phenomenon
• Investigation • Key Takeaways -
© LY Corporation 7 Phenomenon • One day, we restarted
one broker in the cluster to rollout a patch, as usual • Right after that, entire cluster’s performance got degraded -
© LY Corporation 8 Phenomenon • Even worse, on the
restarted broker, all request handler threads were almost exhausted and unable to process any request => Availability damaged -
© LY Corporation 9 Why request handlers got busy? •
Typical cause we can imagine is too many API calls => Not the case. Request rate was stable -
© LY Corporation 10 Next step: Check the profile •
Very fortunately, all our brokers have continuous async-profiler profiling enabled! • As a countermeasure to the past another performance issue… • Refs: “Time travel stack trace analysis with async-profiler” @JJUG CCC 2019 Fall -
© LY Corporation 11 The Surprising Finding • Surprisingly, the
flame graph told that request handlers are almost occupied by ListOffsets API handling -
© LY Corporation 12 ListOffsets API • A simple API
to query partition’s offsets: • Earliest offset • Latest offset • Offset for specific timestamp • Usually considered harmless • Doesn’t touch to actual data • Only requires DESCRIBE permission for the topic -
© LY Corporation 13 Which part was time consuming? •
Most of time, threads were blocked by lazy time-index materialization -
© LY Corporation 14 How ListOffsets works • When ListOffsets
is called with “maxTimestamp” specified, it internally queries the “largest timestamp” of ALL log segment to identify the log segment that contains the target offset -
© LY Corporation 15 Index files are lazily loaded •
In Kafka, time indexes are implemented as memory-mapped file • Since creating mmap has certain overhead and we don’t need opening it for inactive segment usually, they are “lazily” loaded on-demand • Refs: KIP-263: Allow broker to skip sanity check of inactive segments on broker startup -
© LY Corporation 16 Suspect: ListOffsets against large partition •
Large partition has many log segments • To query the offset corresponding to the timestamp, we may need to open many log segment files • Since the broker was just restarted, none of them are opened yet -
© LY Corporation 17 The hypothesis proved! • We dumped
ListOffsets request content into logs and found that a single client was sending ListOffsets with “max-timestamp” query against many partitions, over 50K+ segments at total -
© LY Corporation 18 How we handled • Handling: Contacted
the client and asked stopping it • Permanent Solution: • Not trivial to address fundamentally • Prevent by Authorization => ListOffsets only requires Topic-Describe permission, which we can’t deny • ListOffsets optimization => We have to store another on-disk data only for logging ”largest timestamp”, which is not optimal • Our current strategy (implementation underway): • Detect potentially-risky ListOffsets calls earlier, and to contact the client manually -
© LY Corporation 19 Key Takeaways • ListOffsets is innocent-looking
but actually it might take down the broker easily depending on the usage • Continuous profiling is very useful for troubleshooting • Without this, we would suffer for this issue for much longer