Why was a manual commit offset used instead of auto-commit?
Asked at
AI answer
With manual offset commits, the consumer confirms its position in Kafka only after the message has been successfully processed and, if necessary, the result has been reliably written. This reduces the risk of losing a message: if a failure occurs before confirmation, it will be delivered again.
Auto-commit is simpler, but the offset may be confirmed before processing finishes—in that case, a failure will cause the message to be skipped. Manual commits are especially important for processing with side effects or long-running operations. In Go, it is important not to commit the offset before a successful result and to account for possible redelivery: it is best to make the handler idempotent. This typically provides “at least once” semantics, rather than guaranteeing exactly-once processing for arbitrary external systems.
Also asked at Вайлдберрис
- How does the garbage collector work in Go, and what are its implications for application performance? Explain how Go’s garbage collector operates at a high level, including the main phases of its work, how it interacts with application goroutines and memory allocation, and what runtime behavior it is responsible for managing. Then discuss the practical performance implications for real applications, such as effects on latency, throughput, CPU and memory usage, and how a developer should reason about these trade-offs when writing and tuning Go services.
- What synchronization primitives do you know in Go?
- [name] tell us about yourself and your experience.
- What did you do at your last job? What was the project?
- If the EXPLAIN estimate significantly differs from EXPLAIN ANALYZE — what does it mean?