...
In offset commit protocol, we always have a topic partition → offset mapping to remember our progress. In fact if suppose we build a consumer with multi-threading access, we could actually do the rebalance assignment of key ranges to workers and let those mappings returned and stored on broker side. In this way, say if we have two workers A and B sharing the same consumer, they should be able to commit their progress individually by (worker-id, offset) pairs. Adding the group assignment message which has key range mapping, we could easily do the client side filtering for the first generation if possible. This work also unblocks the potential later if we want consumer level scaling by defining their individual key ranges, so that we could allow concurrent commit.
Public Interfaces
Briefly list any new interfaces that will be introduced as part of this proposal or any existing interfaces that will be removed or changed. The purpose of this section is to concisely call out the public contract that will come along with this feature.
A public interface is any change to the following:
Binary log format
The network protocol and api behavior
Any class in the public packages under clientsConfiguration, especially client configuration
org/apache/kafka/common/serialization
org/apache/kafka/common
org/apache/kafka/common/errors
org/apache/kafka/clients/producer
org/apache/kafka/clients/consumer (eventually, once stable)
Monitoring
Command line tools and arguments
- Anything else that will likely break existing users in some way when they upgrade
Concurrent RocksDB access
To make sure we have predictable amount of state, threads will be accessing a shared state store which means the task assignment pointing to the stream thread will be shared between background threads. To make a fair assignment and avoid concurrent access as much as possible, we take an iterative approach. Based on the parallelising factor, we would determine the task assignment
Public Interfaces
Parallelising factor.
Proposed Changes
Describe the new thing you want to do in appropriate detail. This may be fairly extensive and have large subsections of its own. Or it may be a few sentences. Use judgement based on the scope of the change.
...
If there are alternative ways of accomplishing the same thing, what were they? The purpose of this section is to motivate why the design is the way it is and not some other way.
Second part
Add parallelism on producing. Right now producers use customized partitioners to choose to write to different partitions. We could add a key-range to producer as well to split the batches to write different keys concurrently. The offset of each split phantom partitions will be strictly larger than the log end offset when doing the split, and during the split producers will temporarily restrict access until the split is finished.
To merge a split, one has to first move the partition leaders to co-locate on the same broker. Any produce request going to the primary partition broker will be written to the primary partition log instead of fan-out partition log. The fan-out partitions also have a consumed offset which means there are still data that are not consumed. Either way, we will advance the partition offset with this batch while adding a range commit to the offset log.