SlideShare una empresa de Scribd logo
1 de 46
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
세션 3
Kafka
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
목차
1 WhatisKafka?
2 Architecture
3 Producer
4 Broker
table of contents
5 Consumer
6 T
opic&Partition
7 Replication
8 비교및사례
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
1
What is Kafka?
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 1
WhatisKafka?
오픈소스
Pub-Sub Messaging Platform
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 1
WhatisKafka?
분산 스트리밍
실시간 스트리밍
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
2
Architecture
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 2
Architecture
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
3
Producer
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
- 브로커에 특정 토픽을 지정하여 메세지를 전달하는 역할 담당.
- Kafka Producer API와 이로 구성된 Application.
Part 3
Producer란?
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 3
Producer-메세지구조
토픽
파티션위치
메시지생성시간
메세지키
메시지값
Topic
Partition
Timestamp
Key
Value
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 3
Producer-메세지전달과정
>> >> >>
직렬화 파티셔닝 압축 메세지 배치 >> 전달
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 3
>> >> >>
직렬화 파티셔닝 압축 메세지 배치 >> 전달
Producer-메세지전달과정
* org.apache.kafka.clients.producer.KafkaProducer class
doSend 메서드 - 직렬화 파트
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 3
>> >> >>
직렬화 파티셔닝 압축 메세지 배치 >> 전달
Producer-메세지전달과정
* org.apache.kafka.clients.producer.KafkaProducer class
partition 메서드 - 파티셔닝 파트
 토픽의어떤파티션에저장될
지결정
 키가없는경우Round-Robin
방식으로결정
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 3
>> >> >>
직렬화 파티셔닝 압축 메세지 배치 >> 전달
Producer-메세지전달과정
* org.apache.kafka.common.record.CompressionType enum
압축 타입 파트
 압축이설정된경우,포맷에맞춰메세지압축
 Accumulator가buffer에append하기전에압축
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 3
>> >> >>
직렬화 파티셔닝 압축 메세지 배치 >> 전달
Producer-메세지전달과정
 지정된만큼메세지를저장했
다가한번에브로커로전달.
 RA는각토픽파티션에대응하
는배치큐(deque)를구성하고,
메세지들을레코드배치형태
로묶어큐에저장
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 3
>> >> >>
직렬화 파티셔닝 압축 메세지 배치 >> 전달
Producer-메세지전달과정
* org.apache.kafka.clients.producer.KafkaProducer class
doSend 메서드 - 배치 파트
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 3
>> >> >>
직렬화 파티셔닝 압축 메세지 배치 >> 전달
Producer-메세지전달과정
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
4
Broker
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
 프로듀서로부터 메세지를 전달 받아 저장하고,
컨슈머로 전달.
 Kafka 서버 1대가 1대의 브로커
Part 4
Broker란?
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 4
Broker-
Controller
 컨트롤러는 하나의 클러스터에서 하나의 브로커에 부여되는 역할.
 브로커들의 생존 여부(liveness)를 체크
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 4
Broker-Controlled
shutdown
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 4
Broker-메세지저장과파일관
리
 메세지를 로그(log) 자료구조 형태로 디스크에 저장.
 로그 자료구조: 새로운 쓰기 작업이 중간에 삽입되지 않고
끝에서만 되는 append-only 특징을 가짐
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 4
Broker-Zerocopy
 Zero Copy
브로커가 세그먼트 파일로부터 메시지를 읽고, 이를 네트워크로 전달하는 과정에서
context switch가 없도록 하는 기술 (CPU 작업을 메모리로 대체)
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
5
Consumer
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
 파티션에 연결하여 메세지들이 쓰여진 순서대로
메세지를 읽음.
Part 5
Consumer란?
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 5
Consumer-Offset
 메세지의Offset을추적하고,소
비한메세지를저장.
 ConsumerApplication에서는자
동/수동으로Offset을커밋한다.
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 5
Consumer-Group
 파티션내의메세지는그룹내의
Consumer중하나에의해서만소비되
는것을보장.
 병렬적으로메세지소비
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
6
Topic & Partition
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
 이벤트(메세지) 스트림이 저장됨.
 Producer는 Topic에 메세지를 저장 => Push
 Consumer는 Topic의 메세지를 읽음 => Pull
Part 6
Topic이란?
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
 토픽에 속한 레코드를 실제 저장소에 저장하는 가장
작은 단위
 Append-Only
Part 6
Partition이란?
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 6
Partition이란?
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 6
Partition-Offset
 파티션내에서는순서가보장되지만,
파티션간에는순서가보장되지않음.
=>순서보장X
 레코드가항상맨뒤에쓰여지고,다
음순서의Offset값을갖게된다.
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 6
Partition-분배방식
 Partition Key (Hash)
 Round-Robin
 Customer Partitioner
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
7
Replication
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 7
Replication
 Replication Factor
토픽에 파티션의 복제본을 몇 개 생성할 것인지 설정
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 7
Replication-Leader&Follower
 Read/Write
Topic으로 통하는 모든 데이터의 Read/Write는 Leader로 수행
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 7
Replication-ISR(In-SyncReplication)
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 7
Replication-ISRBreakdown
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 7
Replication-ISRBreakdown(1node)
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 7
Replication-ISRBreakdown(2node)
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 7
Replication-ISR규칙
 Leader
자신보다 일정 기간 뒤쳐진 팔로워가 발생 => 해당 팔로워가 리더가 될 자격이 없다고 판
단 => ISR 에서 제외
 Follower
리더와 동일한 내용을 유지하기 위해 일정 주기마다 리더로부터 데이터를 가져온다.
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
8
비교 및 사례
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 8
KafkaVSRabbitMQ
 Kafka는 대용량의 분산 로그 트래픽을 처리한다는 점이 유리
 RabbitMQ는 높은 처리량 대신 지정된 수신인에게 원하는 방식으로 메세지를 신뢰성 있게 전
달하는데 초점.
요약
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 8
활용사례
Data Pipe Line - Netflix
 데이터 버퍼링 - Kafka는 복제된 영구 메시지 대기열 역할을 함
 데이터 라우팅 - s3, Elastic, 보조 kafka 데이터 이동하는 역할을 합니다.
비디오 시청 활동 / 사용 빈도 / 에러로그 등 모든 이벤트는 데이터 파
이프라인을 통해 전달
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Part 8
Reference
 https://ggop-n.tistory.com/m/91
 https://always-kimkim.tistory.com/entry/kafka101-producer?category=876258
 https://www.linkedin.com/pulse/kafka-producer-overview-sylvester-Daniel
 https://developer.ibm.com/articles/j-zerocopy/
Reference links
 https://github.com/sapcy/kafka-example
Sample code
ⓒSaebyeol Yu. Saebyeol’s PowerPoint
Thank you.

Más contenido relacionado

Último

A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)Tae Young Lee
 
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionKim Daeun
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Kim Daeun
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Wonjun Hwang
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Wonjun Hwang
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스
 

Último (6)

A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)A future that integrates LLMs and LAMs (Symposium)
A future that integrates LLMs and LAMs (Symposium)
 
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution DetectionMOODv2 : Masked Image Modeling for Out-of-Distribution Detection
MOODv2 : Masked Image Modeling for Out-of-Distribution Detection
 
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
Continual Active Learning for Efficient Adaptation of Machine LearningModels ...
 
Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)Merge (Kitworks Team Study 이성수 발표자료 240426)
Merge (Kitworks Team Study 이성수 발표자료 240426)
 
Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)Console API (Kitworks Team Study 백혜인 발표자료)
Console API (Kitworks Team Study 백혜인 발표자료)
 
캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차캐드앤그래픽스 2024년 5월호 목차
캐드앤그래픽스 2024년 5월호 목차
 

Destacado

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Destacado (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Kafka 알아보기

  • 1. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 세션 3 Kafka
  • 2. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 목차 1 WhatisKafka? 2 Architecture 3 Producer 4 Broker table of contents 5 Consumer 6 T opic&Partition 7 Replication 8 비교및사례
  • 3. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 1 What is Kafka?
  • 4. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 1 WhatisKafka? 오픈소스 Pub-Sub Messaging Platform
  • 5. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 1 WhatisKafka? 분산 스트리밍 실시간 스트리밍
  • 6. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 2 Architecture
  • 7. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 2 Architecture
  • 8. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 3 Producer
  • 9. ⓒSaebyeol Yu. Saebyeol’s PowerPoint - 브로커에 특정 토픽을 지정하여 메세지를 전달하는 역할 담당. - Kafka Producer API와 이로 구성된 Application. Part 3 Producer란?
  • 10. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 3 Producer-메세지구조 토픽 파티션위치 메시지생성시간 메세지키 메시지값 Topic Partition Timestamp Key Value
  • 11. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 3 Producer-메세지전달과정 >> >> >> 직렬화 파티셔닝 압축 메세지 배치 >> 전달
  • 12. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 3 >> >> >> 직렬화 파티셔닝 압축 메세지 배치 >> 전달 Producer-메세지전달과정 * org.apache.kafka.clients.producer.KafkaProducer class doSend 메서드 - 직렬화 파트
  • 13. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 3 >> >> >> 직렬화 파티셔닝 압축 메세지 배치 >> 전달 Producer-메세지전달과정 * org.apache.kafka.clients.producer.KafkaProducer class partition 메서드 - 파티셔닝 파트  토픽의어떤파티션에저장될 지결정  키가없는경우Round-Robin 방식으로결정
  • 14. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 3 >> >> >> 직렬화 파티셔닝 압축 메세지 배치 >> 전달 Producer-메세지전달과정 * org.apache.kafka.common.record.CompressionType enum 압축 타입 파트  압축이설정된경우,포맷에맞춰메세지압축  Accumulator가buffer에append하기전에압축
  • 15. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 3 >> >> >> 직렬화 파티셔닝 압축 메세지 배치 >> 전달 Producer-메세지전달과정  지정된만큼메세지를저장했 다가한번에브로커로전달.  RA는각토픽파티션에대응하 는배치큐(deque)를구성하고, 메세지들을레코드배치형태 로묶어큐에저장
  • 16. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 3 >> >> >> 직렬화 파티셔닝 압축 메세지 배치 >> 전달 Producer-메세지전달과정 * org.apache.kafka.clients.producer.KafkaProducer class doSend 메서드 - 배치 파트
  • 17. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 3 >> >> >> 직렬화 파티셔닝 압축 메세지 배치 >> 전달 Producer-메세지전달과정
  • 18. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 4 Broker
  • 19. ⓒSaebyeol Yu. Saebyeol’s PowerPoint  프로듀서로부터 메세지를 전달 받아 저장하고, 컨슈머로 전달.  Kafka 서버 1대가 1대의 브로커 Part 4 Broker란?
  • 20. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 4 Broker- Controller  컨트롤러는 하나의 클러스터에서 하나의 브로커에 부여되는 역할.  브로커들의 생존 여부(liveness)를 체크
  • 21. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 4 Broker-Controlled shutdown
  • 22. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 4 Broker-메세지저장과파일관 리  메세지를 로그(log) 자료구조 형태로 디스크에 저장.  로그 자료구조: 새로운 쓰기 작업이 중간에 삽입되지 않고 끝에서만 되는 append-only 특징을 가짐
  • 23. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 4 Broker-Zerocopy  Zero Copy 브로커가 세그먼트 파일로부터 메시지를 읽고, 이를 네트워크로 전달하는 과정에서 context switch가 없도록 하는 기술 (CPU 작업을 메모리로 대체)
  • 24. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 5 Consumer
  • 25. ⓒSaebyeol Yu. Saebyeol’s PowerPoint  파티션에 연결하여 메세지들이 쓰여진 순서대로 메세지를 읽음. Part 5 Consumer란?
  • 26. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 5 Consumer-Offset  메세지의Offset을추적하고,소 비한메세지를저장.  ConsumerApplication에서는자 동/수동으로Offset을커밋한다.
  • 27. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 5 Consumer-Group  파티션내의메세지는그룹내의 Consumer중하나에의해서만소비되 는것을보장.  병렬적으로메세지소비
  • 28. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 6 Topic & Partition
  • 29. ⓒSaebyeol Yu. Saebyeol’s PowerPoint  이벤트(메세지) 스트림이 저장됨.  Producer는 Topic에 메세지를 저장 => Push  Consumer는 Topic의 메세지를 읽음 => Pull Part 6 Topic이란?
  • 30. ⓒSaebyeol Yu. Saebyeol’s PowerPoint  토픽에 속한 레코드를 실제 저장소에 저장하는 가장 작은 단위  Append-Only Part 6 Partition이란?
  • 31. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 6 Partition이란?
  • 32. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 6 Partition-Offset  파티션내에서는순서가보장되지만, 파티션간에는순서가보장되지않음. =>순서보장X  레코드가항상맨뒤에쓰여지고,다 음순서의Offset값을갖게된다.
  • 33. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 6 Partition-분배방식  Partition Key (Hash)  Round-Robin  Customer Partitioner
  • 34. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 7 Replication
  • 35. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 7 Replication  Replication Factor 토픽에 파티션의 복제본을 몇 개 생성할 것인지 설정
  • 36. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 7 Replication-Leader&Follower  Read/Write Topic으로 통하는 모든 데이터의 Read/Write는 Leader로 수행
  • 37. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 7 Replication-ISR(In-SyncReplication)
  • 38. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 7 Replication-ISRBreakdown
  • 39. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 7 Replication-ISRBreakdown(1node)
  • 40. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 7 Replication-ISRBreakdown(2node)
  • 41. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 7 Replication-ISR규칙  Leader 자신보다 일정 기간 뒤쳐진 팔로워가 발생 => 해당 팔로워가 리더가 될 자격이 없다고 판 단 => ISR 에서 제외  Follower 리더와 동일한 내용을 유지하기 위해 일정 주기마다 리더로부터 데이터를 가져온다.
  • 42. ⓒSaebyeol Yu. Saebyeol’s PowerPoint 8 비교 및 사례
  • 43. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 8 KafkaVSRabbitMQ  Kafka는 대용량의 분산 로그 트래픽을 처리한다는 점이 유리  RabbitMQ는 높은 처리량 대신 지정된 수신인에게 원하는 방식으로 메세지를 신뢰성 있게 전 달하는데 초점. 요약
  • 44. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 8 활용사례 Data Pipe Line - Netflix  데이터 버퍼링 - Kafka는 복제된 영구 메시지 대기열 역할을 함  데이터 라우팅 - s3, Elastic, 보조 kafka 데이터 이동하는 역할을 합니다. 비디오 시청 활동 / 사용 빈도 / 에러로그 등 모든 이벤트는 데이터 파 이프라인을 통해 전달
  • 45. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Part 8 Reference  https://ggop-n.tistory.com/m/91  https://always-kimkim.tistory.com/entry/kafka101-producer?category=876258  https://www.linkedin.com/pulse/kafka-producer-overview-sylvester-Daniel  https://developer.ibm.com/articles/j-zerocopy/ Reference links  https://github.com/sapcy/kafka-example Sample code
  • 46. ⓒSaebyeol Yu. Saebyeol’s PowerPoint Thank you.