saay, hi
동일 consumer group 데이터 취득 테스트 본문
Test 목표 | 같은 consumer group 내에 consumer가 topic을 중복 취득하는지 파악 |
Test 시나리오 | 1) consumer3개에게 topic 동시 전송 2) consumer3개에게 topic 연속 전송 3) consumer1개 데이터 취득하던 와중 다른 consumer가 데이터 가져가는지 확인 |
Test 구성 |
![]() |
[ test 방법 ]
1.producer AP 를 통해 topic 전송 ( 명령어 : java -cp ./"kafka_2.13-3.6.0/libs/*":. {producer AP name} {topic name} )
[kafka@localhost kafka]$ java -cp ./"kafka_2.13-3.6.0/libs/*":. SimpleProducer2 basic-consumer log4j:WARN No appenders could be found for logger (org.apache.kafka.clients.producer.ProducerConfig). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. START Message sent successfully END== |
2.consumer1 AP 데이터 취득 ( 명령어 : java -cp ./"kafka_2.13-3.6.0/libs/*":. {consumer AP name} )
Topic: basic-consumer, Partition: 0, Offset: 864044, Key: 4046, Value: Topic: basic-consumer, Partition: 0, Offset: 864045, Key: 4047, Value: Topic: basic-consumer, Partition: 0, Offset: 864046, Key: 4048, Value: Topic: basic-consumer, Partition: 0, Offset: 864047, Key: 4049, Value: … Topic: basic-consumer, Partition: 0, Offset: 864992, Key: 4994, Value: Topic: basic-consumer, Partition: 0, Offset: 864993, Key: 4995, Value: Topic: basic-consumer, Partition: 0, Offset: 864994, Key: 4996, Value: Topic: basic-consumer, Partition: 0, Offset: 864995, Key: 4997, Value: Topic: basic-consumer, Partition: 0, Offset: 864996, Key: 4998, Value: Topic: basic-consumer, Partition: 0, Offset: 864997, Key: 4999, Value: records:0 records:0 records:0 records:0 records:0 records:0 … |
3. consumer2 / consumer3 AP도 동시에 기동 시켜봄
[kafka@localhost kafka]$ java -cp ./"kafka_2.13-3.6.0/libs/*":. consumerTest1 log4j:WARN No appenders could be found for logger (org.apache.kafka.clients.consumer.ConsumerConfig). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. records:0 records:0 records:0 records:0 records:0 records:0 (..생략...) records:0 records:0 records:0 |
[ 결과 ]
동시에 consumer2 && consumer3은 데이터를 취득하지 않음
( 단, 데이터 양을 증량시킨 결과 가끔 consumer2가 데이터를 중간부터 취득하기 시작함 )
consumer 3개 동시 기동 시, 하나의 consumer에서만 데이터 취득 >> 데이터 증량 및 연속 전송 시 다른 consumer에서 데이터 뺏어가는 현상 발견
[ 의견 ]
topic 전송 후 consumer group내의 consumer 1개에서만 데이터 취득하는 줄 알았으나, 데이터 증량 및 연속 전송할 경우, 다른 consumer2 or 3이 데이터를 중간에 취득하는 현상 발생
( group.instance.id를 지정하지 않았기때문에 각 3개의 consumer에 대한 구별이 없었서임으로 추측. group.instance.id 지정한 이후 중간에 데이터를 취득하는 현상을 아직 발견하지 못함)
따라서 데이터를 고정적으로 취득하길 원한다면, group.instance.id를 지정하기를 권장
'kafka 테스트 > 데이터 테스트' 카테고리의 다른 글
partition 증설 후 consumer 데이터 취득 변화 테스트 (0) | 2024.06.27 |
---|---|
중복 취득 확인 테스트 (0) | 2024.06.27 |