SlideShare une entreprise Scribd logo
1  sur  27
A Look into the Mirror
Patterns and Best Practices for MirrorMaker2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 1
Cliff Gilmore
Principal Solutions Architect – Streaming Data
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 2
Agenda
• MirrorMaker2 Overview
• Live Migration
• Active Passive
• Hub and Spoke / Aggregation
• Active Active
• Capacity Planning
• Best Practices
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 3
Key MirrorMaker2 Features
• Multi-cluster data replication engine based on Kafka Connect framework
• Detects new topics and partitions in self-discovery mode
• Automatically synchronizes topic configuration & ACLs
• Supports “active/active” cluster pairs, as well as any number of active clusters
• Provides new metrics including end-to-end replication latency across multiple clusters
• Emits the offsets required to migrate consumers between clusters and tooling for offset
translation (in Apache Kafka 2.7, offset sync is also automated)
• Configuration file for specifying multiple clusters and replication flows in one place
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 4
MirrorMaker2 Core Concepts
• Connectors
• MirrorSourceConnector
• MirrorSinkConnector
• MirrorCheckpointConnector
• MirrorHeartbeatConnector
• Replication Policies
• Controls naming of replicated topics
• DefaultReplicationPolicy
• <source>.<topic> convention
• CustomReplicationPolicy
• Create your own policy based on preferences (IE, no prefix for migration/active-passive)
• Configuration Parameters
• topics lets you control which topics are replicated
• Groups lets you control which consumer groups have offsets replicated
• More configuration for options, connectivity and topology defined at
• https://cwiki.apache.org/confluence/display/KAFKA/KIP-382%3A+MirrorMaker+2.0
Live Migrations with MM2
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 5
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 6
Live Migration Pattern (Initial State)
Source
Cluster
Destination
Cluster
Consumer
Producers
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 7
Live Migration Pattern (Enable Replication)
Source
Cluster
Destination
Cluster
Consumer
Producers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Replication for
Topics and Offsets
Replication for
Topics and Offsets
Source Cluster
Heartbeats
Topic Names stay consistent via CustomReplicationPolicy
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 8
Live Migration Pattern (Stop Consumer, Update Offsets)
Source
Cluster
Destination
Cluster
Producers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Replication for
Topics and Offsets
Replication for
Topics and Offsets
Source Cluster
Heartbeats
Note: OffsetSync can be Automated with the MirrorMaker2 version part of Apache Kafka 2.7 release
RemoteClusterUtils to
update offsets
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 9
Live Migration Pattern (Start Consumer on Destination)
Source
Cluster
Destination
Cluster
Producers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Replication for
Topics and Offsets
Replication for
Topics and Offsets
Source Cluster
Heartbeats
Consumer
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 10
Live Migration Pattern (Point Producers to Destination)
Source
Cluster
Destination
Cluster
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Replication for
Topics and Offsets
Replication for
Topics and Offsets
Source Cluster
Heartbeats
Consumer
Producers
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 11
Live Migration Pattern (Shut Down Source/Connect)
Destination
Cluster
Consumer
Producers
• The source cluster can now be safely shut
down
• This leaves us with our clients migrated to
the new cluster
• Very little delay is introduced with just the
restart time of each topic’s producers and
consumers being the disruption
Active – Passive Replication with DR Failover/Back
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 12
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 13
Active-Passive (Normal State)
Source
Cluster
Destination
Cluster
Consumer
Producers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Replication for
Topics and Offsets
Replication for
Topics and Offsets
Source Cluster
Heartbeats
Datacenter/Region #1 Datacenter/Region #2
topic1
topic1
region1.topic1
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 14
Active-Passive (Cluster Failure, Bounce clients)
Source
Cluster
Destination
Cluster
Consumer
Producers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Datacenter/Region #1 Datacenter/Region #2
topic1
region1.topic1
RemoteClusterUtils to
update offsets
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 15
Active-Passive (Datacenter Failure)
Source
Cluster
Destination
Cluster
Consumer
Producers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Datacenter/Region #1 Datacenter/Region #2
Copy of
Producers
Consumers with
same group ID
topic1
region1.topic1
RemoteClusterUtils to
update offsets
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 16
Active-Passive (Reverse Replication)
Source
Cluster
Destination
Cluster
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Datacenter/Region #1 Datacenter/Region #2
Copy of
Producers
Consumers with
same group ID
topic1
region1.topic1
topic1
region2.topic1
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 17
Active-Passive (Reverse Replication)
Source
Cluster
Destination
Cluster
Kafka Connect
MirrorSinkConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Datacenter/Region #1 Datacenter/Region #2
Copy of
Producers
Consumers with
same group ID
topic1
region1.topic1
topic1
region2.topic1
Replication for
Topics and Offsets
Replication for
Topics and Offsets
Dest Cluster
Heartbeats
RemoteClusterUtils
to
update offsets
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 18
Active-Passive (Failback Producer/Consumer)
Source
Cluster
Destination
Cluster
Kafka Connect
MirrorSinkConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Datacenter/Region #1 Datacenter/Region #2
topic1
region1.topic1
topic1
region2.topic1
Replication for
Topics and Offsets
Replication for
Topics and Offsets
Dest Cluster
Heartbeats
Consumer
Producers
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 19
Active-Passive (Resume Normal Replication)
Source
Cluster
Destination
Cluster
Consumer
Producers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Replication for
Topics and Offsets
Replication for
Topics and Offsets
Source Cluster
Heartbeats
Datacenter/Region #1 Datacenter/Region #2
topic1
region2.topic1
topic1
region1.topic1
Hub and Spoke aka Aggregation Pattern
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 20
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 21
Hub and Spoke/Aggregation
Destination
Cluster
Consumer
Producers
Kafka Connect
MirrorSourceConnector
Replication for
Topics
Consumer
Producers
Consumer
Producers
Consumer
Local Datacenter/Region #2
Local Datacenter/Region #1
Local Datacenter/Region #3
Central Datacenter/Region
region1.topic1
region2.topic1
region3.topic1
Active – Active also useful for Cloud Bridging
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 22
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 23
Active-Active
OnPrem
Cluster
Cloud
Cluster
Consumers
Producers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
Datacenter
Cloud Region
topic1
cloud.topic1 topic1
datacenter.topic1
Producers
Consumers
Kafka Connect
MirrorSourceConnector
MirrorCheckpointConnector
MirrorHeartBeatConnector
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 24
Capacity Planning Considerations
• Run Kafka Connect in distributed mode
• Mainly size based on network throughput
• Always consider the impact of a downed worker in capacity planning
• Remember to measure impact on source cluster (extra consumer)
• Follow general task to CPU core ratio of 8-16 tasks per core
• Avoid SMTs and type conversion
• Use CPU/Network optimized instances/VMs/machines as disk or high amounts of RAM are not needed
• Increase the Heap size to something between 6-12GB
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 25
Best Practices / Observations
• Keep partitions per connect task ratio <=10:1
• There can be issues with offset replication when > 10:1
• https://issues.apache.org/jira/browse/KAFKA-12558
• Set consumer.task.id in the connect configuration manually
• This allows for client quotas to be set to control replication max throughput for balancing with other
producers/consumers
• Monitor task status vs Connect REST interface
• Monitor JMX metrics to ensure latency and throughput are as expected
• You can’t measure consumer lag due to the way MM2 consumes from the source assign() vs subscribe()
• Negative lag on replication destinations can occur if replication is pending or behind and offset sync is
enabled
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 26
Monitoring Metrics
• MirrorSourceConnector
• record-count
• record-age-ms
• record-age-ms-min
• record-age-ms-max
• record-age-ms-avg
• replication-latency-ms
• replication-latency-ms-min
• replication-latency-ms-max
• replication-latency-ms-avg
• byte-rate
• MirrorCheckpointConnector
• checkpoint-latency-ms
• checkpoint-latency-ms-min
• checkpoint-latency-ms-max
• checkpoint-latency-ms-avg
Thanks!
Twitter : @cwgdata
LinkedIN: https://www.linkedin.com/in/cliffgilmore
© 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 27

Contenu connexe

Tendances

Tendances (20)

Fundamentals of Apache Kafka
Fundamentals of Apache KafkaFundamentals of Apache Kafka
Fundamentals of Apache Kafka
 
Securing Kafka
Securing Kafka Securing Kafka
Securing Kafka
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Stephan Ewen - Experiences running Flink at Very Large Scale
Stephan Ewen -  Experiences running Flink at Very Large ScaleStephan Ewen -  Experiences running Flink at Very Large Scale
Stephan Ewen - Experiences running Flink at Very Large Scale
 
Reliable Event Delivery in Apache Kafka Based on Retry Policy and Dead Letter...
Reliable Event Delivery in Apache Kafka Based on Retry Policy and Dead Letter...Reliable Event Delivery in Apache Kafka Based on Retry Policy and Dead Letter...
Reliable Event Delivery in Apache Kafka Based on Retry Policy and Dead Letter...
 
Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
 
MirrorMaker: Beyond the Basics with Mickael Maison
MirrorMaker: Beyond the Basics with Mickael MaisonMirrorMaker: Beyond the Basics with Mickael Maison
MirrorMaker: Beyond the Basics with Mickael Maison
 
Introduction to Kafka Cruise Control
Introduction to Kafka Cruise ControlIntroduction to Kafka Cruise Control
Introduction to Kafka Cruise Control
 
Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)Kafka to the Maxka - (Kafka Performance Tuning)
Kafka to the Maxka - (Kafka Performance Tuning)
 
Reliability Guarantees for Apache Kafka
Reliability Guarantees for Apache KafkaReliability Guarantees for Apache Kafka
Reliability Guarantees for Apache Kafka
 
Improving fault tolerance and scaling out in Kafka Streams with Bill Bejeck |...
Improving fault tolerance and scaling out in Kafka Streams with Bill Bejeck |...Improving fault tolerance and scaling out in Kafka Streams with Bill Bejeck |...
Improving fault tolerance and scaling out in Kafka Streams with Bill Bejeck |...
 
Apache Kafka - Martin Podval
Apache Kafka - Martin PodvalApache Kafka - Martin Podval
Apache Kafka - Martin Podval
 
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
The Log of All Logs: Raft-based Consensus Inside Kafka | Guozhang Wang, Confl...
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Show Me Kafka Tools That Will Increase My Productivity! (Stephane Maarek, Dat...
Show Me Kafka Tools That Will Increase My Productivity! (Stephane Maarek, Dat...Show Me Kafka Tools That Will Increase My Productivity! (Stephane Maarek, Dat...
Show Me Kafka Tools That Will Increase My Productivity! (Stephane Maarek, Dat...
 
A Kafka-based platform to process medical prescriptions of Germany’s health i...
A Kafka-based platform to process medical prescriptions of Germany’s health i...A Kafka-based platform to process medical prescriptions of Germany’s health i...
A Kafka-based platform to process medical prescriptions of Germany’s health i...
 
Autoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive ModeAutoscaling Flink with Reactive Mode
Autoscaling Flink with Reactive Mode
 
An Introduction to Apache Kafka
An Introduction to Apache KafkaAn Introduction to Apache Kafka
An Introduction to Apache Kafka
 
My first 90 days with ClickHouse.pdf
My first 90 days with ClickHouse.pdfMy first 90 days with ClickHouse.pdf
My first 90 days with ClickHouse.pdf
 
Visualizing Kafka Security
Visualizing Kafka SecurityVisualizing Kafka Security
Visualizing Kafka Security
 

Similaire à A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff Gilmore, AWS

Zero Down Time Move From Apache Kafka to Confluent With Justin Dempsey | Curr...
Zero Down Time Move From Apache Kafka to Confluent With Justin Dempsey | Curr...Zero Down Time Move From Apache Kafka to Confluent With Justin Dempsey | Curr...
Zero Down Time Move From Apache Kafka to Confluent With Justin Dempsey | Curr...
HostedbyConfluent
 

Similaire à A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff Gilmore, AWS (20)

Zero Down Time Move From Apache Kafka to Confluent With Justin Dempsey | Curr...
Zero Down Time Move From Apache Kafka to Confluent With Justin Dempsey | Curr...Zero Down Time Move From Apache Kafka to Confluent With Justin Dempsey | Curr...
Zero Down Time Move From Apache Kafka to Confluent With Justin Dempsey | Curr...
 
Not Your Mother's Kafka - Deep Dive into Confluent Cloud Infrastructure | Gwe...
Not Your Mother's Kafka - Deep Dive into Confluent Cloud Infrastructure | Gwe...Not Your Mother's Kafka - Deep Dive into Confluent Cloud Infrastructure | Gwe...
Not Your Mother's Kafka - Deep Dive into Confluent Cloud Infrastructure | Gwe...
 
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LMESet your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
Set your Data in Motion with Confluent & Apache Kafka Tech Talk Series LME
 
20191201 kubernetes managed weblogic revival - part 2
20191201 kubernetes managed weblogic revival - part 220191201 kubernetes managed weblogic revival - part 2
20191201 kubernetes managed weblogic revival - part 2
 
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...
Taking Software Lifecycle Integration (SLI) to the Next Layer - Welcome to Co...
 
The Kubernetes WebLogic revival (part 2)
The Kubernetes WebLogic revival (part 2)The Kubernetes WebLogic revival (part 2)
The Kubernetes WebLogic revival (part 2)
 
Westpac Bank Tech Talk 1: Dive into Apache Kafka
Westpac Bank Tech Talk 1: Dive into Apache KafkaWestpac Bank Tech Talk 1: Dive into Apache Kafka
Westpac Bank Tech Talk 1: Dive into Apache Kafka
 
Decoupling Decisions with Apache Kafka
Decoupling Decisions with Apache KafkaDecoupling Decisions with Apache Kafka
Decoupling Decisions with Apache Kafka
 
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
HTTP/2 Comes to Java: Servlet 4.0 and what it means for the Java/Jakarta EE e...
 
Kafka 101 and Developer Best Practices
Kafka 101 and Developer Best PracticesKafka 101 and Developer Best Practices
Kafka 101 and Developer Best Practices
 
게임 고객사를 위한 ‘AWS 컨테이너 교육’ 자료 - 유재석 솔루션즈 아키텍트, AWS :: Gaming Immersion Day 201...
게임 고객사를 위한 ‘AWS 컨테이너 교육’ 자료 -  유재석 솔루션즈 아키텍트, AWS :: Gaming Immersion Day 201...게임 고객사를 위한 ‘AWS 컨테이너 교육’ 자료 -  유재석 솔루션즈 아키텍트, AWS :: Gaming Immersion Day 201...
게임 고객사를 위한 ‘AWS 컨테이너 교육’ 자료 - 유재석 솔루션즈 아키텍트, AWS :: Gaming Immersion Day 201...
 
Citi Tech Talk Disaster Recovery Solutions Deep Dive
Citi Tech Talk  Disaster Recovery Solutions Deep DiveCiti Tech Talk  Disaster Recovery Solutions Deep Dive
Citi Tech Talk Disaster Recovery Solutions Deep Dive
 
MySQL Operator for Kubernetes
MySQL Operator for KubernetesMySQL Operator for Kubernetes
MySQL Operator for Kubernetes
 
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, ClouderaLessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
Lessons from the field: Catalog of Kafka Deployments | Joseph Niemiec, Cloudera
 
Capital One Delivers Risk Insights in Real Time with Stream Processing
Capital One Delivers Risk Insights in Real Time with Stream ProcessingCapital One Delivers Risk Insights in Real Time with Stream Processing
Capital One Delivers Risk Insights in Real Time with Stream Processing
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
 
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
Dissolving the Problem (Making an ACID-Compliant Database Out of Apache Kafka®)
 
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
Webinar: Emerging Trends in Data Architecture – What’s the Next Big Thing?
 
MySQL Replication Performance in the Cloud
MySQL Replication Performance in the CloudMySQL Replication Performance in the Cloud
MySQL Replication Performance in the Cloud
 
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
Architecture patterns for distributed, hybrid, edge and global Apache Kafka d...
 

Plus de HostedbyConfluent

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
HostedbyConfluent
 
Evolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at TrendyolEvolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at Trendyol
HostedbyConfluent
 

Plus de HostedbyConfluent (20)

Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Renaming a Kafka Topic | Kafka Summit London
Renaming a Kafka Topic | Kafka Summit LondonRenaming a Kafka Topic | Kafka Summit London
Renaming a Kafka Topic | Kafka Summit London
 
Evolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at TrendyolEvolution of NRT Data Ingestion Pipeline at Trendyol
Evolution of NRT Data Ingestion Pipeline at Trendyol
 
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Ensuring Kafka Service Resilience: A Dive into Health-Checking TechniquesEnsuring Kafka Service Resilience: A Dive into Health-Checking Techniques
Ensuring Kafka Service Resilience: A Dive into Health-Checking Techniques
 
Exactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and KafkaExactly-once Stream Processing with Arroyo and Kafka
Exactly-once Stream Processing with Arroyo and Kafka
 
Fish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit LondonFish Plays Pokemon | Kafka Summit London
Fish Plays Pokemon | Kafka Summit London
 
Tiered Storage 101 | Kafla Summit London
Tiered Storage 101 | Kafla Summit LondonTiered Storage 101 | Kafla Summit London
Tiered Storage 101 | Kafla Summit London
 
Building a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And WhyBuilding a Self-Service Stream Processing Portal: How And Why
Building a Self-Service Stream Processing Portal: How And Why
 
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
From the Trenches: Improving Kafka Connect Source Connector Ingestion from 7 ...
 
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
Future with Zero Down-Time: End-to-end Resiliency with Chaos Engineering and ...
 
Navigating Private Network Connectivity Options for Kafka Clusters
Navigating Private Network Connectivity Options for Kafka ClustersNavigating Private Network Connectivity Options for Kafka Clusters
Navigating Private Network Connectivity Options for Kafka Clusters
 
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data PlatformApache Flink: Building a Company-wide Self-service Streaming Data Platform
Apache Flink: Building a Company-wide Self-service Streaming Data Platform
 
Explaining How Real-Time GenAI Works in a Noisy Pub
Explaining How Real-Time GenAI Works in a Noisy PubExplaining How Real-Time GenAI Works in a Noisy Pub
Explaining How Real-Time GenAI Works in a Noisy Pub
 
TL;DR Kafka Metrics | Kafka Summit London
TL;DR Kafka Metrics | Kafka Summit LondonTL;DR Kafka Metrics | Kafka Summit London
TL;DR Kafka Metrics | Kafka Summit London
 
A Window Into Your Kafka Streams Tasks | KSL
A Window Into Your Kafka Streams Tasks | KSLA Window Into Your Kafka Streams Tasks | KSL
A Window Into Your Kafka Streams Tasks | KSL
 
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
Mastering Kafka Producer Configs: A Guide to Optimizing PerformanceMastering Kafka Producer Configs: A Guide to Optimizing Performance
Mastering Kafka Producer Configs: A Guide to Optimizing Performance
 
Data Contracts Management: Schema Registry and Beyond
Data Contracts Management: Schema Registry and BeyondData Contracts Management: Schema Registry and Beyond
Data Contracts Management: Schema Registry and Beyond
 
Code-First Approach: Crafting Efficient Flink Apps
Code-First Approach: Crafting Efficient Flink AppsCode-First Approach: Crafting Efficient Flink Apps
Code-First Approach: Crafting Efficient Flink Apps
 
Debezium vs. the World: An Overview of the CDC Ecosystem
Debezium vs. the World: An Overview of the CDC EcosystemDebezium vs. the World: An Overview of the CDC Ecosystem
Debezium vs. the World: An Overview of the CDC Ecosystem
 
Beyond Tiered Storage: Serverless Kafka with No Local Disks
Beyond Tiered Storage: Serverless Kafka with No Local DisksBeyond Tiered Storage: Serverless Kafka with No Local Disks
Beyond Tiered Storage: Serverless Kafka with No Local Disks
 

Dernier

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Dernier (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff Gilmore, AWS

  • 1. A Look into the Mirror Patterns and Best Practices for MirrorMaker2 © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 1 Cliff Gilmore Principal Solutions Architect – Streaming Data
  • 2. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 2 Agenda • MirrorMaker2 Overview • Live Migration • Active Passive • Hub and Spoke / Aggregation • Active Active • Capacity Planning • Best Practices
  • 3. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 3 Key MirrorMaker2 Features • Multi-cluster data replication engine based on Kafka Connect framework • Detects new topics and partitions in self-discovery mode • Automatically synchronizes topic configuration & ACLs • Supports “active/active” cluster pairs, as well as any number of active clusters • Provides new metrics including end-to-end replication latency across multiple clusters • Emits the offsets required to migrate consumers between clusters and tooling for offset translation (in Apache Kafka 2.7, offset sync is also automated) • Configuration file for specifying multiple clusters and replication flows in one place
  • 4. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 4 MirrorMaker2 Core Concepts • Connectors • MirrorSourceConnector • MirrorSinkConnector • MirrorCheckpointConnector • MirrorHeartbeatConnector • Replication Policies • Controls naming of replicated topics • DefaultReplicationPolicy • <source>.<topic> convention • CustomReplicationPolicy • Create your own policy based on preferences (IE, no prefix for migration/active-passive) • Configuration Parameters • topics lets you control which topics are replicated • Groups lets you control which consumer groups have offsets replicated • More configuration for options, connectivity and topology defined at • https://cwiki.apache.org/confluence/display/KAFKA/KIP-382%3A+MirrorMaker+2.0
  • 5. Live Migrations with MM2 © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 5
  • 6. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 6 Live Migration Pattern (Initial State) Source Cluster Destination Cluster Consumer Producers
  • 7. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 7 Live Migration Pattern (Enable Replication) Source Cluster Destination Cluster Consumer Producers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Replication for Topics and Offsets Replication for Topics and Offsets Source Cluster Heartbeats Topic Names stay consistent via CustomReplicationPolicy
  • 8. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 8 Live Migration Pattern (Stop Consumer, Update Offsets) Source Cluster Destination Cluster Producers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Replication for Topics and Offsets Replication for Topics and Offsets Source Cluster Heartbeats Note: OffsetSync can be Automated with the MirrorMaker2 version part of Apache Kafka 2.7 release RemoteClusterUtils to update offsets
  • 9. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 9 Live Migration Pattern (Start Consumer on Destination) Source Cluster Destination Cluster Producers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Replication for Topics and Offsets Replication for Topics and Offsets Source Cluster Heartbeats Consumer
  • 10. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 10 Live Migration Pattern (Point Producers to Destination) Source Cluster Destination Cluster Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Replication for Topics and Offsets Replication for Topics and Offsets Source Cluster Heartbeats Consumer Producers
  • 11. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 11 Live Migration Pattern (Shut Down Source/Connect) Destination Cluster Consumer Producers • The source cluster can now be safely shut down • This leaves us with our clients migrated to the new cluster • Very little delay is introduced with just the restart time of each topic’s producers and consumers being the disruption
  • 12. Active – Passive Replication with DR Failover/Back © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 12
  • 13. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 13 Active-Passive (Normal State) Source Cluster Destination Cluster Consumer Producers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Replication for Topics and Offsets Replication for Topics and Offsets Source Cluster Heartbeats Datacenter/Region #1 Datacenter/Region #2 topic1 topic1 region1.topic1
  • 14. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 14 Active-Passive (Cluster Failure, Bounce clients) Source Cluster Destination Cluster Consumer Producers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Datacenter/Region #1 Datacenter/Region #2 topic1 region1.topic1 RemoteClusterUtils to update offsets
  • 15. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 15 Active-Passive (Datacenter Failure) Source Cluster Destination Cluster Consumer Producers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Datacenter/Region #1 Datacenter/Region #2 Copy of Producers Consumers with same group ID topic1 region1.topic1 RemoteClusterUtils to update offsets
  • 16. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 16 Active-Passive (Reverse Replication) Source Cluster Destination Cluster Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Datacenter/Region #1 Datacenter/Region #2 Copy of Producers Consumers with same group ID topic1 region1.topic1 topic1 region2.topic1
  • 17. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 17 Active-Passive (Reverse Replication) Source Cluster Destination Cluster Kafka Connect MirrorSinkConnector MirrorCheckpointConnector MirrorHeartBeatConnector Datacenter/Region #1 Datacenter/Region #2 Copy of Producers Consumers with same group ID topic1 region1.topic1 topic1 region2.topic1 Replication for Topics and Offsets Replication for Topics and Offsets Dest Cluster Heartbeats RemoteClusterUtils to update offsets
  • 18. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 18 Active-Passive (Failback Producer/Consumer) Source Cluster Destination Cluster Kafka Connect MirrorSinkConnector MirrorCheckpointConnector MirrorHeartBeatConnector Datacenter/Region #1 Datacenter/Region #2 topic1 region1.topic1 topic1 region2.topic1 Replication for Topics and Offsets Replication for Topics and Offsets Dest Cluster Heartbeats Consumer Producers
  • 19. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 19 Active-Passive (Resume Normal Replication) Source Cluster Destination Cluster Consumer Producers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Replication for Topics and Offsets Replication for Topics and Offsets Source Cluster Heartbeats Datacenter/Region #1 Datacenter/Region #2 topic1 region2.topic1 topic1 region1.topic1
  • 20. Hub and Spoke aka Aggregation Pattern © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 20
  • 21. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 21 Hub and Spoke/Aggregation Destination Cluster Consumer Producers Kafka Connect MirrorSourceConnector Replication for Topics Consumer Producers Consumer Producers Consumer Local Datacenter/Region #2 Local Datacenter/Region #1 Local Datacenter/Region #3 Central Datacenter/Region region1.topic1 region2.topic1 region3.topic1
  • 22. Active – Active also useful for Cloud Bridging © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 22
  • 23. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 23 Active-Active OnPrem Cluster Cloud Cluster Consumers Producers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector Datacenter Cloud Region topic1 cloud.topic1 topic1 datacenter.topic1 Producers Consumers Kafka Connect MirrorSourceConnector MirrorCheckpointConnector MirrorHeartBeatConnector
  • 24. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 24 Capacity Planning Considerations • Run Kafka Connect in distributed mode • Mainly size based on network throughput • Always consider the impact of a downed worker in capacity planning • Remember to measure impact on source cluster (extra consumer) • Follow general task to CPU core ratio of 8-16 tasks per core • Avoid SMTs and type conversion • Use CPU/Network optimized instances/VMs/machines as disk or high amounts of RAM are not needed • Increase the Heap size to something between 6-12GB
  • 25. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 25 Best Practices / Observations • Keep partitions per connect task ratio <=10:1 • There can be issues with offset replication when > 10:1 • https://issues.apache.org/jira/browse/KAFKA-12558 • Set consumer.task.id in the connect configuration manually • This allows for client quotas to be set to control replication max throughput for balancing with other producers/consumers • Monitor task status vs Connect REST interface • Monitor JMX metrics to ensure latency and throughput are as expected • You can’t measure consumer lag due to the way MM2 consumes from the source assign() vs subscribe() • Negative lag on replication destinations can occur if replication is pending or behind and offset sync is enabled
  • 26. © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 26 Monitoring Metrics • MirrorSourceConnector • record-count • record-age-ms • record-age-ms-min • record-age-ms-max • record-age-ms-avg • replication-latency-ms • replication-latency-ms-min • replication-latency-ms-max • replication-latency-ms-avg • byte-rate • MirrorCheckpointConnector • checkpoint-latency-ms • checkpoint-latency-ms-min • checkpoint-latency-ms-max • checkpoint-latency-ms-avg
  • 27. Thanks! Twitter : @cwgdata LinkedIN: https://www.linkedin.com/in/cliffgilmore © 2021, Amazon Web Services, Inc. or its affiliates. All rights reserved. 27