tencent cloud

피드백

Consumer Group

마지막 업데이트 시간:2024-01-09 15:02:48

    How do I set a reasonable number of consumers?

    The relationship between consumer group and consumer is as follows:
    A consumer can subscribe to multiple topics at the same time.
    A topic can contain one or multiple partitions.
    A partition can be consumed only by one consumer at a time.
    Therefore, the maximum number of consumers in a consumer group is the total number of partitions in all topics.
    Consumer refers to a consumer object in programming. There can be multiple consumers on a server. This is because a thread contains a consumer, and if multiple threads are initiated, there will be multiple consumers as shown below:
    Properties props = new Properties();
    props.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, bootstrap);
    KafkaConsumer<String, String> consumer = new KafkaConsumer<>(props);
    consumer.subscribe(Arrays.asList(topic));
    while (true) {
    ConsumerRecords<String, String> records = consumer.poll(100);
    }
    You can configure the initial number of consumers based on the client resources and configure heap alarms for consumer groups. If messages are heaped, you can add more consumers. For more information on how to configure an alarm, see Configuring Alarm. The configuration page is as shown below:
    
    
    
    문의하기

    고객의 업무에 전용 서비스를 제공해드립니다.

    기술 지원

    더 많은 도움이 필요하시면, 티켓을 통해 연락 바랍니다. 티켓 서비스는 연중무휴 24시간 제공됩니다.

    연중무휴 24시간 전화 지원