feature - Technical implementation discussion of kafka to iggy bridge #3252
Replies: 4 comments 7 replies
|
Below is the proposed architecture for the version 0.01 of kafka_2_iggy bridge. My thought process is to provide a bridge for transition to iggy with the current iggy capabilities. As Iggy's new server and SDK is available, the known gaps by design will be taken care. Architecture OverviewApproach: Standalone TCP Proxy (referenced as Option 1 in discussion #3081, comment #3044) The bridge runs as a separate process that:
Key Technical Achievements1. Complete Protocol FoundationFiles: Implement a zero-copy encoder/decoder for all Kafka primitives:2. Request/Response Header Auto-detectionFile: Kafka has two incompatible header formats:
The bridge auto-detects which format to use based on a lookup table covering all 65 API keys: Impact: Clients using old versions (e.g., Kafka 2.x) and new versions (Kafka 3.x+) work seamlessly against the same bridge. 3. Kafka-to-Iggy Mapping LayerFile: The
Key Design Decision: Kafka partition IDs are ignored during produce. The bridge uses 4. Implemented API Keys (Phase 1)| API Key | Name | Versions | Iggy Integration | Code Locations:
5. Comprehensive Testing InfrastructureUnit Tests
Integration Tests
End-to-End Testing Tool
Purpose: Ensures the bridge doesn't crash or produce malformed responses when faced with any valid Kafka request. Technical Challenges To SolveChallenge 1: Flexible vs. Legacy EncodingKafka introduced "flexible" encoding (compact arrays, tagged fields) gradually across versions. For example:
Solution: Version-aware encoder/decoder that checks Challenge 2: RecordBatch FormatKafka Produce requests contain a RecordBatch (Kafka's internal message format) with:
Proposed Solution: The bridge treats RecordBatch as opaque bytes and stores them directly in Iggy. This preserves the original format but means:
Future Enhancement: Parse RecordBatch and extract individual messages, storing them as Iggy messages with metadata preserved in headers. Challenge 3: Partition MappingProblem: Kafka partitions are 0-based (0, 1, 2, ...), while Iggy partitions are 1-based (1, 2, 3, ...). Solution: The bridge ignores Kafka partition IDs during produce and uses Trade-off: Kafka clients lose control over which partition receives a message. For sticky-key partitioning (e.g., all messages for TODO: Comparison to "Built-in Listener" ApproachDiscussion #3081 mentions integrating Kafka protocol directly into Iggy server. Here's why the standalone proxy is superior:
Verdict: Standalone proxy is the pragmatic choice for MVP. Built-in listener could be considered for v2 if latency becomes a bottleneck (unlikely for most workloads). Next Steps (Phase 2 API Keys)To achieve full producer/consumer compatibility, the following API keys are required: Critical (Producer)
Critical (Consumer)
Known Limitations
|
|
I still need to do more reading, just wanted to clarify that Iggy partitions are also 0 based :) Also, what does it mean that the consumer groups aren't implemented? It's been part of Iggy since its inception (almost). |
|
I was thinking a bit more about this potential compatibility, and IMHO there are 2 ways, both of which have their pros & cons:
|
|
As the implementation plan has started (refer #3253) I am closing this discussion. |
Uh oh!
There was an error while loading. Please reload this page.
The discussion is branching out the discussion from #3081 around the architectural and design of the kafka_iggy_bridge . The design details will be added here for community discussion and sharing the implementation idea. All the implementation jira tickets will be added here.
All reactions