SlideShare a Scribd company logo
Kafka Monitoring
and Kafka topic
Configuration
Presented By: Neelam
Software Consultant
Knoldus Inc.
About Knoldus
Knoldus is a technology consulting firm with focus on modernizing the digital systems
at the pace your business demands.
Functional. Reactive. Cloud Native
DevOps
01 Introduction to kafka monitoring
02 Why to monitor kafka
03 Important Metrics to focus on first
04 Kafka Topic Introduction
Default kafka topic configuration
Our Agenda
05
05
06 Modify topic configuration with
Demo
Introduction to
Kafka Monitoring
Apache kafka deals with transfering of large amount
of real-time data( we can call it data in a motion). To
assure end-to-end stream monitoring and every
message is delivered from producer to consumer.
How long messages take to be delivered, also
determines the source of issue in your cluster.
We can monitor kafka with the help of metrics. While
monitoring kafka, it’s important to also monitor
Zookeeper as kafka depends on it.
LEARN NOW
c
Why to
Monitor Kafka
Kafka monitoring is important to ensure
timeliness of data delivery, overall application
performance , knowing when to scale up ,
connectivity issues and ensuring data is not lost
as we deal with streaming data. Volume of data
is large and there are different components
involved into kafka cluster which are:
Producer , Consumer and Broker.
To ensure every component is working fine.
LEARN NOW
BANNER INFOGRAPHICInsert Your Subtitle Here
Network Request Rate01
02
03
Since the goal of kafka brokers is to gather and move for processing,
they can also be sources of high network traffic. Monitor and
compare the network throughput per server, if possible by tracking
the number of network requests per second.
Kafka.network: type=RequestMetrics, name=RequestsPerSec
Important Metrics to Focus on
Network error Rate
Under-Replicated
Partitions
Cross referencing network throughput with related network error
rates can help diagnose the reasons for latency. Error conditions
include dropped network packets, error rates in responses per
request type, and the types of error(s) occurring.
Kafka.network: type=RequestMetrics, name=ErrorsPerSec
To ensure data durability and that brokers are always available to deliver
data , you can set a replication number per topic as applicable This
metric alert you to cases where there are fewer than the minimum
number of active brokers for a given topic.
Kafka.server: type=ReplicaManager, name=UnderReplicatedPartitions
BANNER INFOGRAPHICInsert Your Subtitle Here
Total broker
Partitions
04
05
06
Simply knowing how many partitions a broker is managing can help
you avoid errors and know when it’s time to scale out. The goal should
be to keep the count balanced across brokers.
Kafka.server: type=ReplicaManager, name=PartitionCount – Number
of partitions on the brokers.
Important Metrics to Focus on
Log Flush Latency
Consumer
Message Rate
Kafka Stores data by appending to existing log files .Cache based
writes are flushed to physical storage. Your monitoring strategy
should include combination of data replication and latency in the
asynchronous disk log flush time.
Kafka.log: type=LogFlushStats, name=LogFlushRateAndTimeMs
Set baselines for expected consumer message throughput and measure
fluctuations in the rate to detect latency and the need to scale the
number of consumers up and down accordingly.
Kafka.consumer type=ConsumerTopicMetrics, name=MessagePerSec,
clientId=([-.w]+) Messages consumed per sec.
BANNER INFOGRAPHICInsert Your Subtitle Here
Consumer Max
Lag
07
08
Even with consumers fetching messages at a high rate, producers
can still outspace them. This metrics works at the level of consumer
and partition , means each partition in each topic has its own lag for
a given consumer.
Kafka.consumer: type=ConsumerFetcherManager, name=MaxLag,
clientId=([-.w]+) Number of messages by which consumer lags
behind the producer.
Important Metrics to Focus on
Fetcher Lag
This metrics indicates the lag in the number of messages per follower
replica, indicating that replication has potentially stopped or has
been interrupted. Monitoring the replica.lag.time.max.ms
configuration parameter you can measure the time for which the
replica has not attempted to fetch new data from the leader.
Kafka.server: type=FetcherLagMetrics, name=ConsumerLag,
clientId=([-.w]+), partition=([0-9]+)
BANNER INFOGRAPHICInsert Your Subtitle Here
Offline Partition
Count
09
10
Offline partitions represent data stores unavailable to your
application due to a server failure or restart. In kafka cluster one of
the broker server acts as a controller for managing the states of
partitions and replicas and to reassign partitions when needed.
Kafka.controller: type=KafkaController, name=OfflinePartitionCount –
Number of partitions without an active leader.
Important Metrics to Focus on
Free Memory and
Swap space Usage
Kafka performance is best when swapping is kept to minimum. To do
this set the JVM max heap size large enough to avoid frequent
garbage collecion activity, but small enough to allow space for
filesystem caching . Additionally , watch for swap usage if you have
swap enabled , watching for increases in server swapping activity, as
this can lead to kafka operations timeout.
In many cases its best to turn off swap entirely, we have to adjust our
monitoring accordingly.
Introduction to
Kafka Topic
We can say that kafka topic is the
same concept as a table in the
database. But its definetly not a table
and kafka isn’t a database.
A topic is where data(messages) get
published by the producer and pulled
from by a consumer.
20XX
STRATEGY
Kafka Topic
ABOUT COMPANYBy default kafka topic being created with the replication-factor 1 and Partitions as 1 for a
particular topic.
Description
Kafka Topic Configuration
1) For changing the configuration of partitions of the topic use --alter .
./kafka-topics.sh --zookeeper localhost:2181 --alter --topic
sendInvitation --partitions 3
2) For changing the configuration of replication-factor of a topic : add a
json script with the content provided in the next slide...
Modify kafka topic configuration at runtime.
ABOUT COMPANY
Kafka Topic Configuration
2) For changing the configuration of replication-factor of a topic : add a json script with the
content provided below:
Assume the script name is increase-replication-factor.json.
{"version":1,
"partitions":[
{"topic":"sendInvitation","partition":0,"replicas":[0,1,2]},
{"topic":"sendInvitation","partition":1,"replicas":[0,1,2]},
{"topic":"sendInvitation","partition":2,"replicas":[0,1,2]},
{"topic":"xyz","partition":0,"replicas":[0,1,2]},
{"topic":"xyz","partition":1,"replicas":[0,1,2]},
]}
Than execute the following command to run and apply this script:
./kafka-reassign-partitions --zookeeper localhost:2181 --reassignment-json-file
increase-replication-factor.json --execute
Modify kafka topic configuration at runtime.
References:
● https://kafka.apache.org/documentation/
● https://sematext.com/blog/kafka-metrics-to-monitor
Contact me at:
neelam@knoldus.com
Thank
You!

More Related Content

What's hot

Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013
Jun Rao
 
Get Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAMGet Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAM
Jonathan Katz
 
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
SANG WON PARK
 
Data Loss and Duplication in Kafka
Data Loss and Duplication in KafkaData Loss and Duplication in Kafka
Data Loss and Duplication in Kafka
Jayesh Thakrar
 

What's hot (20)

Improving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at UberImproving Kafka at-least-once performance at Uber
Improving Kafka at-least-once performance at Uber
 
Producer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache KafkaProducer Performance Tuning for Apache Kafka
Producer Performance Tuning for Apache Kafka
 
Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013
 
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...Everything you ever needed to know about Kafka on Kubernetes but were afraid ...
Everything you ever needed to know about Kafka on Kubernetes but were afraid ...
 
Apache Kafka - Martin Podval
Apache Kafka - Martin PodvalApache Kafka - Martin Podval
Apache Kafka - Martin Podval
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Get Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAMGet Your Insecure PostgreSQL Passwords to SCRAM
Get Your Insecure PostgreSQL Passwords to SCRAM
 
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
Apache kafka 모니터링을 위한 Metrics 이해 및 최적화 방안
 
Apache Kafka Best Practices
Apache Kafka Best PracticesApache Kafka Best Practices
Apache Kafka Best Practices
 
A Deep Dive into Kafka Controller
A Deep Dive into Kafka ControllerA Deep Dive into Kafka Controller
A Deep Dive into Kafka Controller
 
kafka
kafkakafka
kafka
 
No data loss pipeline with apache kafka
No data loss pipeline with apache kafkaNo data loss pipeline with apache kafka
No data loss pipeline with apache kafka
 
Solving PostgreSQL wicked problems
Solving PostgreSQL wicked problemsSolving PostgreSQL wicked problems
Solving PostgreSQL wicked problems
 
Deploying Confluent Platform for Production
Deploying Confluent Platform for ProductionDeploying Confluent Platform for Production
Deploying Confluent Platform for Production
 
Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
 Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
Spark Operator—Deploy, Manage and Monitor Spark clusters on Kubernetes
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Data Loss and Duplication in Kafka
Data Loss and Duplication in KafkaData Loss and Duplication in Kafka
Data Loss and Duplication in Kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Hive Bucketing in Apache Spark with Tejas Patil
Hive Bucketing in Apache Spark with Tejas PatilHive Bucketing in Apache Spark with Tejas Patil
Hive Bucketing in Apache Spark with Tejas Patil
 
Introduction to Galera Cluster
Introduction to Galera ClusterIntroduction to Galera Cluster
Introduction to Galera Cluster
 

Similar to Removing performance bottlenecks with Kafka Monitoring and topic configuration

Cluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQCluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQ
Shameera Rathnayaka
 

Similar to Removing performance bottlenecks with Kafka Monitoring and topic configuration (20)

Cluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQCluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQ
 
Kafka RealTime Streaming
Kafka RealTime StreamingKafka RealTime Streaming
Kafka RealTime Streaming
 
Kafka Deep Dive
Kafka Deep DiveKafka Deep Dive
Kafka Deep Dive
 
Kafka monitoring and metrics
Kafka monitoring and metricsKafka monitoring and metrics
Kafka monitoring and metrics
 
Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !Apache Kafka - Scalable Message-Processing and more !
Apache Kafka - Scalable Message-Processing and more !
 
Kafka internals
Kafka internalsKafka internals
Kafka internals
 
101 mistakes FINN.no has made with Kafka (Baksida meetup)
101 mistakes FINN.no has made with Kafka (Baksida meetup)101 mistakes FINN.no has made with Kafka (Baksida meetup)
101 mistakes FINN.no has made with Kafka (Baksida meetup)
 
Building Retry Architectures in Kafka with Compacted Topics | Matthew Zhou, V...
Building Retry Architectures in Kafka with Compacted Topics | Matthew Zhou, V...Building Retry Architectures in Kafka with Compacted Topics | Matthew Zhou, V...
Building Retry Architectures in Kafka with Compacted Topics | Matthew Zhou, V...
 
Apache Big Data Europe 2015: Selected Talks
Apache Big Data Europe 2015: Selected TalksApache Big Data Europe 2015: Selected Talks
Apache Big Data Europe 2015: Selected Talks
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Session 23 - Kafka and Zookeeper
Session 23 - Kafka and ZookeeperSession 23 - Kafka and Zookeeper
Session 23 - Kafka and Zookeeper
 
Apache Kafka Introduction
Apache Kafka IntroductionApache Kafka Introduction
Apache Kafka Introduction
 
Enhancing Apache Kafka for Large Scale Real-Time Data Pipeline at Tencent | K...
Enhancing Apache Kafka for Large Scale Real-Time Data Pipeline at Tencent | K...Enhancing Apache Kafka for Large Scale Real-Time Data Pipeline at Tencent | K...
Enhancing Apache Kafka for Large Scale Real-Time Data Pipeline at Tencent | K...
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
A Quick Guide to Refresh Kafka Skills
A Quick Guide to Refresh Kafka SkillsA Quick Guide to Refresh Kafka Skills
A Quick Guide to Refresh Kafka Skills
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache Kafka
 
Kubernetes connectivity to Cloud Native Kafka | Evan Shortiss and Hugo Guerre...
Kubernetes connectivity to Cloud Native Kafka | Evan Shortiss and Hugo Guerre...Kubernetes connectivity to Cloud Native Kafka | Evan Shortiss and Hugo Guerre...
Kubernetes connectivity to Cloud Native Kafka | Evan Shortiss and Hugo Guerre...
 
Kafka syed academy_v1_introduction
Kafka syed academy_v1_introductionKafka syed academy_v1_introduction
Kafka syed academy_v1_introduction
 

More from Knoldus Inc.

More from Knoldus Inc. (20)

Using InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in JmeterUsing InfluxDB for real-time monitoring in Jmeter
Using InfluxDB for real-time monitoring in Jmeter
 
Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)Intoduction to KubeVela Presentation (DevOps)
Intoduction to KubeVela Presentation (DevOps)
 
Stakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) PresentationStakeholder Management (Project Management) Presentation
Stakeholder Management (Project Management) Presentation
 
Introduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) PresentationIntroduction To Kaniko (DevOps) Presentation
Introduction To Kaniko (DevOps) Presentation
 
Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)Efficient Test Environments with Infrastructure as Code (IaC)
Efficient Test Environments with Infrastructure as Code (IaC)
 
Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)Exploring Terramate DevOps (Presentation)
Exploring Terramate DevOps (Presentation)
 
Clean Code in Test Automation Differentiating Between the Good and the Bad
Clean Code in Test Automation  Differentiating Between the Good and the BadClean Code in Test Automation  Differentiating Between the Good and the Bad
Clean Code in Test Automation Differentiating Between the Good and the Bad
 
Integrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test AutomationIntegrating AI Capabilities in Test Automation
Integrating AI Capabilities in Test Automation
 
State Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptxState Management with NGXS in Angular.pptx
State Management with NGXS in Angular.pptx
 
Authentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptxAuthentication in Svelte using cookies.pptx
Authentication in Svelte using cookies.pptx
 
OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)OAuth2 Implementation Presentation (Java)
OAuth2 Implementation Presentation (Java)
 
Supply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptxSupply chain security with Kubeclarity.pptx
Supply chain security with Kubeclarity.pptx
 
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML ParsingMastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
Mastering Web Scraping with JSoup Unlocking the Secrets of HTML Parsing
 
Akka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On IntroductionAkka gRPC Essentials A Hands-On Introduction
Akka gRPC Essentials A Hands-On Introduction
 
Entity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptxEntity Core with Core Microservices.pptx
Entity Core with Core Microservices.pptx
 
Introduction to Redis and its features.pptx
Introduction to Redis and its features.pptxIntroduction to Redis and its features.pptx
Introduction to Redis and its features.pptx
 
GraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdfGraphQL with .NET Core Microservices.pdf
GraphQL with .NET Core Microservices.pdf
 
NuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptxNuGet Packages Presentation (DoT NeT).pptx
NuGet Packages Presentation (DoT NeT).pptx
 
Data Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable TestingData Quality in Test Automation Navigating the Path to Reliable Testing
Data Quality in Test Automation Navigating the Path to Reliable Testing
 
K8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose KubernetesK8sGPTThe AI​ way to diagnose Kubernetes
K8sGPTThe AI​ way to diagnose Kubernetes
 

Recently uploaded

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 

Recently uploaded (20)

Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Agnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in KrakówAgnieszka Andrzejewska - BIM School Course in Kraków
Agnieszka Andrzejewska - BIM School Course in Kraków
 
Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
How Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptxHow Recreation Management Software Can Streamline Your Operations.pptx
How Recreation Management Software Can Streamline Your Operations.pptx
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdfA Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
A Comprehensive Appium Guide for Hybrid App Automation Testing.pdf
 
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
Abortion ^Clinic ^%[+971588192166''] Abortion Pill Al Ain (?@?) Abortion Pill...
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 

Removing performance bottlenecks with Kafka Monitoring and topic configuration

  • 1. Kafka Monitoring and Kafka topic Configuration Presented By: Neelam Software Consultant Knoldus Inc.
  • 2. About Knoldus Knoldus is a technology consulting firm with focus on modernizing the digital systems at the pace your business demands. Functional. Reactive. Cloud Native DevOps
  • 3. 01 Introduction to kafka monitoring 02 Why to monitor kafka 03 Important Metrics to focus on first 04 Kafka Topic Introduction Default kafka topic configuration Our Agenda 05 05 06 Modify topic configuration with Demo
  • 4. Introduction to Kafka Monitoring Apache kafka deals with transfering of large amount of real-time data( we can call it data in a motion). To assure end-to-end stream monitoring and every message is delivered from producer to consumer. How long messages take to be delivered, also determines the source of issue in your cluster. We can monitor kafka with the help of metrics. While monitoring kafka, it’s important to also monitor Zookeeper as kafka depends on it. LEARN NOW
  • 5. c Why to Monitor Kafka Kafka monitoring is important to ensure timeliness of data delivery, overall application performance , knowing when to scale up , connectivity issues and ensuring data is not lost as we deal with streaming data. Volume of data is large and there are different components involved into kafka cluster which are: Producer , Consumer and Broker. To ensure every component is working fine. LEARN NOW
  • 6. BANNER INFOGRAPHICInsert Your Subtitle Here Network Request Rate01 02 03 Since the goal of kafka brokers is to gather and move for processing, they can also be sources of high network traffic. Monitor and compare the network throughput per server, if possible by tracking the number of network requests per second. Kafka.network: type=RequestMetrics, name=RequestsPerSec Important Metrics to Focus on Network error Rate Under-Replicated Partitions Cross referencing network throughput with related network error rates can help diagnose the reasons for latency. Error conditions include dropped network packets, error rates in responses per request type, and the types of error(s) occurring. Kafka.network: type=RequestMetrics, name=ErrorsPerSec To ensure data durability and that brokers are always available to deliver data , you can set a replication number per topic as applicable This metric alert you to cases where there are fewer than the minimum number of active brokers for a given topic. Kafka.server: type=ReplicaManager, name=UnderReplicatedPartitions
  • 7. BANNER INFOGRAPHICInsert Your Subtitle Here Total broker Partitions 04 05 06 Simply knowing how many partitions a broker is managing can help you avoid errors and know when it’s time to scale out. The goal should be to keep the count balanced across brokers. Kafka.server: type=ReplicaManager, name=PartitionCount – Number of partitions on the brokers. Important Metrics to Focus on Log Flush Latency Consumer Message Rate Kafka Stores data by appending to existing log files .Cache based writes are flushed to physical storage. Your monitoring strategy should include combination of data replication and latency in the asynchronous disk log flush time. Kafka.log: type=LogFlushStats, name=LogFlushRateAndTimeMs Set baselines for expected consumer message throughput and measure fluctuations in the rate to detect latency and the need to scale the number of consumers up and down accordingly. Kafka.consumer type=ConsumerTopicMetrics, name=MessagePerSec, clientId=([-.w]+) Messages consumed per sec.
  • 8. BANNER INFOGRAPHICInsert Your Subtitle Here Consumer Max Lag 07 08 Even with consumers fetching messages at a high rate, producers can still outspace them. This metrics works at the level of consumer and partition , means each partition in each topic has its own lag for a given consumer. Kafka.consumer: type=ConsumerFetcherManager, name=MaxLag, clientId=([-.w]+) Number of messages by which consumer lags behind the producer. Important Metrics to Focus on Fetcher Lag This metrics indicates the lag in the number of messages per follower replica, indicating that replication has potentially stopped or has been interrupted. Monitoring the replica.lag.time.max.ms configuration parameter you can measure the time for which the replica has not attempted to fetch new data from the leader. Kafka.server: type=FetcherLagMetrics, name=ConsumerLag, clientId=([-.w]+), partition=([0-9]+)
  • 9. BANNER INFOGRAPHICInsert Your Subtitle Here Offline Partition Count 09 10 Offline partitions represent data stores unavailable to your application due to a server failure or restart. In kafka cluster one of the broker server acts as a controller for managing the states of partitions and replicas and to reassign partitions when needed. Kafka.controller: type=KafkaController, name=OfflinePartitionCount – Number of partitions without an active leader. Important Metrics to Focus on Free Memory and Swap space Usage Kafka performance is best when swapping is kept to minimum. To do this set the JVM max heap size large enough to avoid frequent garbage collecion activity, but small enough to allow space for filesystem caching . Additionally , watch for swap usage if you have swap enabled , watching for increases in server swapping activity, as this can lead to kafka operations timeout. In many cases its best to turn off swap entirely, we have to adjust our monitoring accordingly.
  • 10. Introduction to Kafka Topic We can say that kafka topic is the same concept as a table in the database. But its definetly not a table and kafka isn’t a database. A topic is where data(messages) get published by the producer and pulled from by a consumer.
  • 12. ABOUT COMPANYBy default kafka topic being created with the replication-factor 1 and Partitions as 1 for a particular topic. Description Kafka Topic Configuration 1) For changing the configuration of partitions of the topic use --alter . ./kafka-topics.sh --zookeeper localhost:2181 --alter --topic sendInvitation --partitions 3 2) For changing the configuration of replication-factor of a topic : add a json script with the content provided in the next slide... Modify kafka topic configuration at runtime.
  • 13. ABOUT COMPANY Kafka Topic Configuration 2) For changing the configuration of replication-factor of a topic : add a json script with the content provided below: Assume the script name is increase-replication-factor.json. {"version":1, "partitions":[ {"topic":"sendInvitation","partition":0,"replicas":[0,1,2]}, {"topic":"sendInvitation","partition":1,"replicas":[0,1,2]}, {"topic":"sendInvitation","partition":2,"replicas":[0,1,2]}, {"topic":"xyz","partition":0,"replicas":[0,1,2]}, {"topic":"xyz","partition":1,"replicas":[0,1,2]}, ]} Than execute the following command to run and apply this script: ./kafka-reassign-partitions --zookeeper localhost:2181 --reassignment-json-file increase-replication-factor.json --execute Modify kafka topic configuration at runtime.