Class PartitionWiseKafkaConsumerService
- java.lang.Object
-
- com.linkedin.venice.service.AbstractVeniceService
-
- com.linkedin.davinci.kafka.consumer.AbstractKafkaConsumerService
-
- com.linkedin.davinci.kafka.consumer.KafkaConsumerService
-
- com.linkedin.davinci.kafka.consumer.PartitionWiseKafkaConsumerService
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
StoreAwarePartitionWiseKafkaConsumerService
public class PartitionWiseKafkaConsumerService extends KafkaConsumerService
PartitionWiseKafkaConsumerService
is used to allocate share consumer from consumer pool at partition granularity. One shared consumer may have multiple topics, and each topic may have multiple consumers. For this basic implementation, we rely on round-robin to allocate next consumer from pool to achieve efficient and balanced shared consumer partition assignment load. We can improve this allocation strategy if we need to.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.linkedin.davinci.kafka.consumer.KafkaConsumerService
KafkaConsumerService.ConsumerAssignmentStrategy
-
Nested classes/interfaces inherited from class com.linkedin.venice.service.AbstractVeniceService
AbstractVeniceService.ServiceState
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<PubSubTopicPartition,java.util.Set<PubSubConsumerAdapter>>
rtTopicPartitionToConsumerMap
Mapping from real-time topic partition to consumers.-
Fields inherited from class com.linkedin.davinci.kafka.consumer.KafkaConsumerService
aggStats, consumerToConsumptionTask, consumerToLocks, kafkaUrl, kafkaUrlForLogger, poolType, versionTopicToTopicPartitionToConsumer
-
Fields inherited from class com.linkedin.venice.service.AbstractVeniceService
logger, serviceState
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
alreadySubscribedRealtimeTopicPartition(com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer consumer, PubSubTopicPartition topicPartition)
protected com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer
pickConsumerForPartition(PubSubTopic versionTopic, PubSubTopicPartition topicPartition)
-
Methods inherited from class com.linkedin.davinci.kafka.consumer.KafkaConsumerService
assignConsumerFor, batchUnsubscribe, getConsumerAssignedToVersionTopicPartition, getIngestionInfoFor, getLatestOffsetBasedOnMetrics, getMaxElapsedTimeMSSinceLastPollInConsumerPool, getOffsetLagBasedOnMetrics, hasAnySubscriptionFor, removeTopicPartitionFromConsumptionTask, setThreadFactory, startConsumptionIntoDataReceiver, startInner, stopInner, unSubscribe, unsubscribeAll
-
Methods inherited from class com.linkedin.davinci.kafka.consumer.AbstractKafkaConsumerService
unSubscribe
-
-
-
-
Field Detail
-
rtTopicPartitionToConsumerMap
protected final java.util.Map<PubSubTopicPartition,java.util.Set<PubSubConsumerAdapter>> rtTopicPartitionToConsumerMap
Mapping from real-time topic partition to consumers. For hybrid store, different version topics from one store have same real-time topics, we should avoid same real-time topic partition from different version topics sharing the same consumer from consumer pool.
-
-
Method Detail
-
pickConsumerForPartition
protected com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer pickConsumerForPartition(PubSubTopic versionTopic, PubSubTopicPartition topicPartition)
- Specified by:
pickConsumerForPartition
in classKafkaConsumerService
-
alreadySubscribedRealtimeTopicPartition
protected boolean alreadySubscribedRealtimeTopicPartition(com.linkedin.davinci.kafka.consumer.SharedKafkaConsumer consumer, PubSubTopicPartition topicPartition)
-
-