SlideShare a Scribd company logo
1 of 30
Download to read offline
Introduction & Use Cases
Amita Mirajkar, Sunny Gupta
Clairvoyant India Pvt. Ltd.
design engineer deliver
2Page
Presentation
Agenda
Start
Messaging
Overview
End
Kafka
Overview
Zookeeper
Comparison
Use Cases
Q & A0.9 Features
Sample App
3Page
Messaging Systems
•  Asynchronous communication between systems
•  Some Use Cases
•  Web application – fast response to client and handle heavy processing
tasks asynchronously
•  Balance load between workers
•  Decouple processing from data producers
•  Models
•  Queuing: a pool of consumers may read from a server and each message
goes to one of them
•  Publish – Subscribe: the message is broadcast to all consumers
Producer
Messaging
System
Consumer
4Page
Kafka
• Kafka is a open-source message broker project
• Distributed, replicated, scalable, durable, and gives high throughput
• Aim – “central nervous system for data”
• The design is heavily influenced by transaction logs
• Built at LinkedIn with a specific purpose in mind: to serve as a central repository of data
streams
5Page
Motivation
At LinkedIn before Kafka - Complex setup with pipelines between different systems
6Page
Motivation
Creators of Kafka imagined something like this… Stream Data Platform
7Page
Kafka
• After Kafka in place, LinkedIn stats look great – as of March 2015 –
• 800B messages produced / day – almost 175 TB of data
• 1100 Kafka brokers organized in 60 clusters
• As of Sep 2015… around 1.1 trillion a day...
• Written in Scala, open-sourced in 2011 under the Apache Software Foundation
• Apache top level project since 2012
8Page
Kafka Terminology
Kafka broker
•  Designed for HA - there are no master nodes. All
nodes are interchangeable.
•  Data is replicated.
•  Messages are stored for configurable period of time
Topic
•  A topic is a category or feed name to which messages
are published.
•  Topics are partitioned
Log
•  Append Only
•  Totally ordered sequence of records – ordered by
time
•  They record what happened and when
9Page
Kafka Terminology (cont.)
•  Partitions
•  Each partition is an ordered, immutable sequence of messages that is
continually appended to —a commit log
•  Each message in the partition is assigned a unique sequenced ID, its offset
•  More partitions allow greater parallelism for consumption
•  They allow the log to scale beyond a size that will fit on a single server. Each
individual partition must fit on the servers that host it, but a topic can handle
an arbitrary amount of data.
•  Number of partitions decide number of workers
•  Each partition has one server which acts as the "leader" and zero or more
servers which act as "followers".
•  Leader handles all read and write requests for the partition.
10Page
Kafka Terminology (cont.)
Producers
•  Send messages to topics synchronously or asynchronously
•  They decide
•  Partition / Key / none of these / Partitioner class
•  what sort of replication guarantees they want (acks setting)
•  batching and compressing
Consumers and Consumer Groups
•  Consumer labels themselves with a consumer group name; and subscribe to
one or more topics
•  Consumers pull messages
•  They control the offset read by them .. Can re-read without overhead on
broker
•  Each consumer in a consumer group will read messages from a unique subset
of partitions in each topic they subscribe to, so each message is delivered to
one consumer in the group, and all messages with the same key arrive at the
same consumer
11Page
Kafka Terminology – Consumer Groups
Queue model Publish-subscribe model
Topic
C3 C4C1 C2
ConsGroup1 ConsGroup2
m1 m1 m2m2
Topic
C2C1
ConsGroup1 ConsGroup2
m1,
m2
m1,
m2
12Page
Zookeeper
•  ZooKeeper is a fast, highly available, fault tolerant, distributed coordination service
•  help distributed synchronization and
•  maintain configuration information
•  Replicated: Like the distributed processes it coordinates, ZooKeeper itself is intended to be
replicated over a sets of hosts called an ensemble.
•  Role in kafka architecture
•  Coordinate cluster information
•  Store cluster metadata
•  Store consumer offsets
13Page
Differences with RabbitMQ
Feature Kafka JMS Message Broker; RabbitMQ
Dequeuing cluster retains all published messages—whether or not
they have been consumed—for a configurable period of
time.
When consumer acknowledges
Consumer metadata the only metadata retained on a per-consumer basis is
offset.
consumer acknowledgments per
message
Ordering Strong ordering within a partition Ordering of the messages is lost in the
presence of parallel consumption. For
workaround of “exclusive consumer”
have to sacrifice parallelism
Batching / Streaming Available for both producer and consumer – supports
online and offline consumers
Consumers are mostly online
Scalability Client centric Broker centric
Complex routing Needs to be programmed Lot of options available with less work
Monitoring UI Needs work Decent web UI available
14Page
Common Use Cases
•  Messaging
•  Website Activity Tracking
•  The original use case for Kafka - Often very high volume –
•  (page views, searches, etc.) -> published to central topics -> subscribed by different consumers
for various use cases - real-time processing, monitoring, and loading into Hadoop or offline
processing and reporting.
•  Log Aggregation
•  Stream Processing
•  Collect data from various sources
•  Aggregate the data as soon as it arrives
•  Feed it to systems such as Hadoop/ DB/ other clients
15Page
Kafka 0.9 Features
•  Security
•  authenticate users using either Kerberos or TLS client
certificates
•  Unix-like permission system to control which user can
access which data
•  encryption
•  Kafka Connect
•  User defined Quota
•  New Consumer
•  New Java client
•  Group management facility
•  Faster rebalancing
•  Fully decouple clients from Zookeeper
16Page
Bootstrapping
Bootstrapping for producers
1.  Cycle through a list of "bootstrap" kafka urls until we find one we can connect to. Fetch cluster metadata.
2.  Process fetch or produce requests, directing them to the appropriate broker based on the topic/partitions they send
to or fetch from
3.  If we get an appropriate error, refresh the metadata and try again.
Bootstrapping of consumers
1.  On startup or on co-ordinator failover, the consumer sends a ConsumerMetadataRequest to any of the brokers in the
bootstrap.brokers list -> receives the location of the co-ordinator for it's group.
2.  The consumer connects to the co-ordinator and sends a HeartbeatRequest.
3.  If no error is returned in the HeartbeatResponse, the consumer continues fetching data, for the list of partitions it last
owned, without interruption.
SAMPLE APPLICATION
18Page
Sample Application
• E shopping system – simplified scenario
• Supports shipping in two cities
• Once order is placed we need to handle
payment and shipping
• Shipping system allows efficiency if
requests are grouped by city
• See simple architecture diagram in next
slide and check out the code
In demo application, we will cover:
•  Zookeeper config
•  Broker config
•  Start two brokers
•  Create Topic and describe / list
•  Producer config
•  Message delivery semantics
•  Consumer config
•  Consumer Rebalancing
•  Sample application code: https://github.com/teamclairvoyant/meetup-docs/tree/master/Meetup-Kafka
19Page
Kafka
Cluster
Broker 1 Broker 2
NewOrder Topic
P0 R1 P1 R0
Producer Process
TCP
TCP
AccountGroup ShipmentGroup
Account
Consumer 1
Shipment
Consumer 1
Shipment
Consumer 2
• broker.Id
• port
• log.dirs
• zookeeper.connect
• advertised.host.name
• advertised.port
• bootstrap.servers
• key.serializer
• value.serializer
• acks
• batch.size
• retries
• bootstrap.servers
• key.deserializer
• value.deserializer
• enable.auto.commit
• max.partition.fetch.bytes
• group.id
QUESTIONS?
careersindia@clairvoyantsoft.com
THANK YOU
BACKUP SLIDES
23Page
References / Good Reads
•  http://www.confluent.io/blog/stream-data-platform-1/
•  http://kafka.apache.org/documentation.html
•  http://www.infoq.com/articles/apache-kafka
•  http://blog.cloudera.com/blog/2014/09/apache-kafka-for-beginners/
•  http://www.confluent.io/blog/tutorial-getting-started-with-the-new-apache-kafka-0.9-consumer-client
•  https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol
•  https://cwiki.apache.org/confluence/display/KAFKA/System+Tools
•  https://zookeeper.apache.org/doc/r3.3.2/zookeeperOver.html#ch_DesignOverview
•  http://blog.cloudera.com/blog/2014/11/flafka-apache-flume-meets-apache-kafka-for-event-processing/
•  http://www.slideshare.net/wangxia5/netflix-kafka
24Page
RabbitMQ
•  Proven Message Broker uses Advanced Message Queuing Protocol
(AMQP) for messaging.
•  Message flow & concepts in RabbitMQ
•  The producer publishes a message
•  The exchange receives and routes the message in to the queues
•  Routing can be based on different message attributes such as routing key,
depending on the exchange type
•  Binding is a link between an exchange and a queue
•  The messages stays in the queue until they are handled by a consumer
•  The consumer handles the message.
•  Channel: a virtual connection inside a connection. When you are publishing
or consuming messages or subscribing to a queue is it all done over a channel
25Page
RabbitMQ (cont.)
•  Types of Exchange
•  Direct: delivers messages to queues based on a message
routing key:
Queues’ binding key == routing key of the message
•  Fanout: routes messages to all of the queues that are
bound to it.
•  Topic: does a wildcard match between the routing key
and the routing pattern specified in the binding.
•  Headers: uses the message header attributes for
routing.
•  CloudAMQP
•  hosted RabbitMQ solution, just sign up for an account
and create an instance. You do not need to set up and
install RabbitMQ or care about cluster handling
26Page
RabbitMQ (cont.)
•  Management and Monitoring
•  Nice web UI for management and monitoring of your RabbitMQ server.
•  Allows to handle, create, delete and list queues, monitor queue length, check message rate,
change and add users permissions, etc.
27Page
Upgrading from 0.8.0, 0.8.1.X or 0.8.2.X to 0.9.0.0
•  0.9.0.0 has potential breaking changes (please review before upgrading) and an inter-broker
protocol change from previous versions.
•  Java 1.6 and Scala 2.9 is no longer supported
•  http://kafka.apache.org/documentation.html
•  Kafka consumers in earlier releases store their offsets by default in ZooKeeper. It is possible to
migrate these consumers to commit offsets into Kafka by following some steps
28Page
Kafka Terminology (cont.)
•  Protocol
•  These requests to publish or fetch data must be sent to the broker that is currently acting as the
leader for a given partition. This condition is enforced by the broker, so a request for a
particular partition to the wrong broker will result in an the NotLeaderForPartition error code
•  All Kafka brokers can answer a metadata request that describes the current state of the cluster:
•  what topics there are
•  which partitions those topics have
•  which broker is the leader for those partitions
•  the host and port information for these brokers
•  Good explanation:
https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol
29Page
Kafka Adoption
Apache Kafka has become a popular messaging system in a short period of time with a number of
organizations like
•  LinkedIn
•  Tumblr
•  PayPal
•  Cisco
•  Box
•  Airbnb
•  Netflix
•  Square
•  Spotify
•  Pinterest
•  Uber
•  Goldman Sachs
•  Yahoo and Twitter among others using it in production systems
careersindia@clairvoyantsoft.com
THANK YOU

More Related Content

What's hot

Apache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and DevelopersApache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and Developersconfluent
 
APACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka StreamsAPACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka StreamsKetan Gote
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using KafkaKnoldus Inc.
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explainedconfluent
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaShiao-An Yuan
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafkaemreakis
 
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Kafka Tutorial - Introduction to Apache Kafka (Part 1)Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Kafka Tutorial - Introduction to Apache Kafka (Part 1)Jean-Paul Azar
 
Kafka Streams: What it is, and how to use it?
Kafka Streams: What it is, and how to use it?Kafka Streams: What it is, and how to use it?
Kafka Streams: What it is, and how to use it?confluent
 
Apache Kafka 0.8 basic training - Verisign
Apache Kafka 0.8 basic training - VerisignApache Kafka 0.8 basic training - Verisign
Apache Kafka 0.8 basic training - VerisignMichael Noll
 
Introduction to Kafka
Introduction to KafkaIntroduction to Kafka
Introduction to KafkaAkash Vacher
 

What's hot (20)

Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
 
Apache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and DevelopersApache Kafka Fundamentals for Architects, Admins and Developers
Apache Kafka Fundamentals for Architects, Admins and Developers
 
APACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka StreamsAPACHE KAFKA / Kafka Connect / Kafka Streams
APACHE KAFKA / Kafka Connect / Kafka Streams
 
kafka
kafkakafka
kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Stream processing using Kafka
Stream processing using KafkaStream processing using Kafka
Stream processing using Kafka
 
Apache Kafka - Overview
Apache Kafka - OverviewApache Kafka - Overview
Apache Kafka - Overview
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Kafka basics
Kafka basicsKafka basics
Kafka basics
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Apache Kafka
Apache KafkaApache Kafka
Apache Kafka
 
Apache Kafka at LinkedIn
Apache Kafka at LinkedInApache Kafka at LinkedIn
Apache Kafka at LinkedIn
 
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Kafka Tutorial - Introduction to Apache Kafka (Part 1)Kafka Tutorial - Introduction to Apache Kafka (Part 1)
Kafka Tutorial - Introduction to Apache Kafka (Part 1)
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Kafka Streams: What it is, and how to use it?
Kafka Streams: What it is, and how to use it?Kafka Streams: What it is, and how to use it?
Kafka Streams: What it is, and how to use it?
 
Apache Kafka 0.8 basic training - Verisign
Apache Kafka 0.8 basic training - VerisignApache Kafka 0.8 basic training - Verisign
Apache Kafka 0.8 basic training - Verisign
 
Introduction to Kafka
Introduction to KafkaIntroduction to Kafka
Introduction to Kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 

Viewers also liked

Building a robot with the .Net Micro Framework
Building a robot with the .Net Micro FrameworkBuilding a robot with the .Net Micro Framework
Building a robot with the .Net Micro FrameworkDucas Francis
 
Introduction to Kafka
Introduction to KafkaIntroduction to Kafka
Introduction to KafkaDucas Francis
 
Introduction to Kafka and Zookeeper
Introduction to Kafka and ZookeeperIntroduction to Kafka and Zookeeper
Introduction to Kafka and ZookeeperRahul Jain
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great InfographicsSlideShare
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShareKapost
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareEmpowered Presentations
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation OptimizationOneupweb
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingContent Marketing Institute
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksSlideShare
 

Viewers also liked (10)

Building a robot with the .Net Micro Framework
Building a robot with the .Net Micro FrameworkBuilding a robot with the .Net Micro Framework
Building a robot with the .Net Micro Framework
 
Introduction to Kafka
Introduction to KafkaIntroduction to Kafka
Introduction to Kafka
 
Introduction to Kafka and Zookeeper
Introduction to Kafka and ZookeeperIntroduction to Kafka and Zookeeper
Introduction to Kafka and Zookeeper
 
What Makes Great Infographics
What Makes Great InfographicsWhat Makes Great Infographics
What Makes Great Infographics
 
Masters of SlideShare
Masters of SlideShareMasters of SlideShare
Masters of SlideShare
 
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to SlideshareSTOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
STOP! VIEW THIS! 10-Step Checklist When Uploading to Slideshare
 
You Suck At PowerPoint!
You Suck At PowerPoint!You Suck At PowerPoint!
You Suck At PowerPoint!
 
10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization10 Ways to Win at SlideShare SEO & Presentation Optimization
10 Ways to Win at SlideShare SEO & Presentation Optimization
 
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content MarketingHow To Get More From SlideShare - Super-Simple Tips For Content Marketing
How To Get More From SlideShare - Super-Simple Tips For Content Marketing
 
How to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & TricksHow to Make Awesome SlideShares: Tips & Tricks
How to Make Awesome SlideShares: Tips & Tricks
 

Similar to Apache Kafka Introduction

Unleashing Real-time Power with Kafka.pptx
Unleashing Real-time Power with Kafka.pptxUnleashing Real-time Power with Kafka.pptx
Unleashing Real-time Power with Kafka.pptxKnoldus Inc.
 
Distributed messaging with Apache Kafka
Distributed messaging with Apache KafkaDistributed messaging with Apache Kafka
Distributed messaging with Apache KafkaSaumitra Srivastav
 
Fundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache KafkaFundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache KafkaAngelo Cesaro
 
apachekafka-160907180205.pdf
apachekafka-160907180205.pdfapachekafka-160907180205.pdf
apachekafka-160907180205.pdfTarekHamdi8
 
Session 23 - Kafka and Zookeeper
Session 23 - Kafka and ZookeeperSession 23 - Kafka and Zookeeper
Session 23 - Kafka and ZookeeperAnandMHadoop
 
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...confluent
 
Copy of Kafka-Camus
Copy of Kafka-CamusCopy of Kafka-Camus
Copy of Kafka-CamusDeep Shah
 
OSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
OSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland HochmuthOSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
OSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland HochmuthNETWAYS
 
OSMC 2016 | Monasca: Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
OSMC 2016 | Monasca: Monitoring-as-a-Service (at-Scale) by Roland HochmuthOSMC 2016 | Monasca: Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
OSMC 2016 | Monasca: Monitoring-as-a-Service (at-Scale) by Roland HochmuthNETWAYS
 
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Erik Onnen
 
Multi-Datacenter Kafka - Strata San Jose 2017
Multi-Datacenter Kafka - Strata San Jose 2017Multi-Datacenter Kafka - Strata San Jose 2017
Multi-Datacenter Kafka - Strata San Jose 2017Gwen (Chen) Shapira
 
Cluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQCluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQShameera Rathnayaka
 
Python Kafka Integration: Developers Guide
Python Kafka Integration: Developers GuidePython Kafka Integration: Developers Guide
Python Kafka Integration: Developers GuideInexture Solutions
 
Event Driven Architectures with Apache Kafka
Event Driven Architectures with Apache KafkaEvent Driven Architectures with Apache Kafka
Event Driven Architectures with Apache KafkaMatt Masuda
 
kafka_session_updated.pptx
kafka_session_updated.pptxkafka_session_updated.pptx
kafka_session_updated.pptxKoiuyt1
 

Similar to Apache Kafka Introduction (20)

Unleashing Real-time Power with Kafka.pptx
Unleashing Real-time Power with Kafka.pptxUnleashing Real-time Power with Kafka.pptx
Unleashing Real-time Power with Kafka.pptx
 
Distributed messaging with Apache Kafka
Distributed messaging with Apache KafkaDistributed messaging with Apache Kafka
Distributed messaging with Apache Kafka
 
Fundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache KafkaFundamentals and Architecture of Apache Kafka
Fundamentals and Architecture of Apache Kafka
 
Envoy and Kafka
Envoy and KafkaEnvoy and Kafka
Envoy and Kafka
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
apachekafka-160907180205.pdf
apachekafka-160907180205.pdfapachekafka-160907180205.pdf
apachekafka-160907180205.pdf
 
Session 23 - Kafka and Zookeeper
Session 23 - Kafka and ZookeeperSession 23 - Kafka and Zookeeper
Session 23 - Kafka and Zookeeper
 
Kafka tutorial
Kafka tutorialKafka tutorial
Kafka tutorial
 
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
Kafka Cluster Federation at Uber (Yupeng Fui & Xiaoman Dong, Uber) Kafka Summ...
 
Copy of Kafka-Camus
Copy of Kafka-CamusCopy of Kafka-Camus
Copy of Kafka-Camus
 
OSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
OSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland HochmuthOSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
OSMC 2016 - Monasca - Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
 
OSMC 2016 | Monasca: Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
OSMC 2016 | Monasca: Monitoring-as-a-Service (at-Scale) by Roland HochmuthOSMC 2016 | Monasca: Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
OSMC 2016 | Monasca: Monitoring-as-a-Service (at-Scale) by Roland Hochmuth
 
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
Data Models and Consumer Idioms Using Apache Kafka for Continuous Data Stream...
 
Multi-Datacenter Kafka - Strata San Jose 2017
Multi-Datacenter Kafka - Strata San Jose 2017Multi-Datacenter Kafka - Strata San Jose 2017
Multi-Datacenter Kafka - Strata San Jose 2017
 
Cluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQCluster_Performance_Apache_Kafak_vs_RabbitMQ
Cluster_Performance_Apache_Kafak_vs_RabbitMQ
 
Python Kafka Integration: Developers Guide
Python Kafka Integration: Developers GuidePython Kafka Integration: Developers Guide
Python Kafka Integration: Developers Guide
 
Event Driven Architectures with Apache Kafka
Event Driven Architectures with Apache KafkaEvent Driven Architectures with Apache Kafka
Event Driven Architectures with Apache Kafka
 
Microservices deck
Microservices deckMicroservices deck
Microservices deck
 
Event driven-arch
Event driven-archEvent driven-arch
Event driven-arch
 
kafka_session_updated.pptx
kafka_session_updated.pptxkafka_session_updated.pptx
kafka_session_updated.pptx
 

Recently uploaded

Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityScyllaDB
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...FIDO Alliance
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoTAnalytics
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreelreely ones
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGDSC PJATK
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoUXDXConf
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaCzechDreamin
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomCzechDreamin
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераMark Opanasiuk
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfFIDO Alliance
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsStefano
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...FIDO Alliance
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeCzechDreamin
 

Recently uploaded (20)

Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
THE BEST IPTV in GERMANY for 2024: IPTVreel
THE BEST IPTV in  GERMANY for 2024: IPTVreelTHE BEST IPTV in  GERMANY for 2024: IPTVreel
THE BEST IPTV in GERMANY for 2024: IPTVreel
 
Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024Enterprise Knowledge Graphs - Data Summit 2024
Enterprise Knowledge Graphs - Data Summit 2024
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Syngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdfSyngulon - Selection technology May 2024.pdf
Syngulon - Selection technology May 2024.pdf
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone KomSalesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
Salesforce Adoption – Metrics, Methods, and Motivation, Antone Kom
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdfIntroduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
Introduction to FDO and How It works Applications _ Richard at FIDO Alliance.pdf
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
Secure Zero Touch enabled Edge compute with Dell NativeEdge via FDO _ Brad at...
 
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi IbrahimzadeFree and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
Free and Effective: Making Flows Publicly Accessible, Yumi Ibrahimzade
 

Apache Kafka Introduction

  • 1. Introduction & Use Cases Amita Mirajkar, Sunny Gupta Clairvoyant India Pvt. Ltd. design engineer deliver
  • 3. 3Page Messaging Systems •  Asynchronous communication between systems •  Some Use Cases •  Web application – fast response to client and handle heavy processing tasks asynchronously •  Balance load between workers •  Decouple processing from data producers •  Models •  Queuing: a pool of consumers may read from a server and each message goes to one of them •  Publish – Subscribe: the message is broadcast to all consumers Producer Messaging System Consumer
  • 4. 4Page Kafka • Kafka is a open-source message broker project • Distributed, replicated, scalable, durable, and gives high throughput • Aim – “central nervous system for data” • The design is heavily influenced by transaction logs • Built at LinkedIn with a specific purpose in mind: to serve as a central repository of data streams
  • 5. 5Page Motivation At LinkedIn before Kafka - Complex setup with pipelines between different systems
  • 6. 6Page Motivation Creators of Kafka imagined something like this… Stream Data Platform
  • 7. 7Page Kafka • After Kafka in place, LinkedIn stats look great – as of March 2015 – • 800B messages produced / day – almost 175 TB of data • 1100 Kafka brokers organized in 60 clusters • As of Sep 2015… around 1.1 trillion a day... • Written in Scala, open-sourced in 2011 under the Apache Software Foundation • Apache top level project since 2012
  • 8. 8Page Kafka Terminology Kafka broker •  Designed for HA - there are no master nodes. All nodes are interchangeable. •  Data is replicated. •  Messages are stored for configurable period of time Topic •  A topic is a category or feed name to which messages are published. •  Topics are partitioned Log •  Append Only •  Totally ordered sequence of records – ordered by time •  They record what happened and when
  • 9. 9Page Kafka Terminology (cont.) •  Partitions •  Each partition is an ordered, immutable sequence of messages that is continually appended to —a commit log •  Each message in the partition is assigned a unique sequenced ID, its offset •  More partitions allow greater parallelism for consumption •  They allow the log to scale beyond a size that will fit on a single server. Each individual partition must fit on the servers that host it, but a topic can handle an arbitrary amount of data. •  Number of partitions decide number of workers •  Each partition has one server which acts as the "leader" and zero or more servers which act as "followers". •  Leader handles all read and write requests for the partition.
  • 10. 10Page Kafka Terminology (cont.) Producers •  Send messages to topics synchronously or asynchronously •  They decide •  Partition / Key / none of these / Partitioner class •  what sort of replication guarantees they want (acks setting) •  batching and compressing Consumers and Consumer Groups •  Consumer labels themselves with a consumer group name; and subscribe to one or more topics •  Consumers pull messages •  They control the offset read by them .. Can re-read without overhead on broker •  Each consumer in a consumer group will read messages from a unique subset of partitions in each topic they subscribe to, so each message is delivered to one consumer in the group, and all messages with the same key arrive at the same consumer
  • 11. 11Page Kafka Terminology – Consumer Groups Queue model Publish-subscribe model Topic C3 C4C1 C2 ConsGroup1 ConsGroup2 m1 m1 m2m2 Topic C2C1 ConsGroup1 ConsGroup2 m1, m2 m1, m2
  • 12. 12Page Zookeeper •  ZooKeeper is a fast, highly available, fault tolerant, distributed coordination service •  help distributed synchronization and •  maintain configuration information •  Replicated: Like the distributed processes it coordinates, ZooKeeper itself is intended to be replicated over a sets of hosts called an ensemble. •  Role in kafka architecture •  Coordinate cluster information •  Store cluster metadata •  Store consumer offsets
  • 13. 13Page Differences with RabbitMQ Feature Kafka JMS Message Broker; RabbitMQ Dequeuing cluster retains all published messages—whether or not they have been consumed—for a configurable period of time. When consumer acknowledges Consumer metadata the only metadata retained on a per-consumer basis is offset. consumer acknowledgments per message Ordering Strong ordering within a partition Ordering of the messages is lost in the presence of parallel consumption. For workaround of “exclusive consumer” have to sacrifice parallelism Batching / Streaming Available for both producer and consumer – supports online and offline consumers Consumers are mostly online Scalability Client centric Broker centric Complex routing Needs to be programmed Lot of options available with less work Monitoring UI Needs work Decent web UI available
  • 14. 14Page Common Use Cases •  Messaging •  Website Activity Tracking •  The original use case for Kafka - Often very high volume – •  (page views, searches, etc.) -> published to central topics -> subscribed by different consumers for various use cases - real-time processing, monitoring, and loading into Hadoop or offline processing and reporting. •  Log Aggregation •  Stream Processing •  Collect data from various sources •  Aggregate the data as soon as it arrives •  Feed it to systems such as Hadoop/ DB/ other clients
  • 15. 15Page Kafka 0.9 Features •  Security •  authenticate users using either Kerberos or TLS client certificates •  Unix-like permission system to control which user can access which data •  encryption •  Kafka Connect •  User defined Quota •  New Consumer •  New Java client •  Group management facility •  Faster rebalancing •  Fully decouple clients from Zookeeper
  • 16. 16Page Bootstrapping Bootstrapping for producers 1.  Cycle through a list of "bootstrap" kafka urls until we find one we can connect to. Fetch cluster metadata. 2.  Process fetch or produce requests, directing them to the appropriate broker based on the topic/partitions they send to or fetch from 3.  If we get an appropriate error, refresh the metadata and try again. Bootstrapping of consumers 1.  On startup or on co-ordinator failover, the consumer sends a ConsumerMetadataRequest to any of the brokers in the bootstrap.brokers list -> receives the location of the co-ordinator for it's group. 2.  The consumer connects to the co-ordinator and sends a HeartbeatRequest. 3.  If no error is returned in the HeartbeatResponse, the consumer continues fetching data, for the list of partitions it last owned, without interruption.
  • 18. 18Page Sample Application • E shopping system – simplified scenario • Supports shipping in two cities • Once order is placed we need to handle payment and shipping • Shipping system allows efficiency if requests are grouped by city • See simple architecture diagram in next slide and check out the code In demo application, we will cover: •  Zookeeper config •  Broker config •  Start two brokers •  Create Topic and describe / list •  Producer config •  Message delivery semantics •  Consumer config •  Consumer Rebalancing •  Sample application code: https://github.com/teamclairvoyant/meetup-docs/tree/master/Meetup-Kafka
  • 19. 19Page Kafka Cluster Broker 1 Broker 2 NewOrder Topic P0 R1 P1 R0 Producer Process TCP TCP AccountGroup ShipmentGroup Account Consumer 1 Shipment Consumer 1 Shipment Consumer 2 • broker.Id • port • log.dirs • zookeeper.connect • advertised.host.name • advertised.port • bootstrap.servers • key.serializer • value.serializer • acks • batch.size • retries • bootstrap.servers • key.deserializer • value.deserializer • enable.auto.commit • max.partition.fetch.bytes • group.id
  • 23. 23Page References / Good Reads •  http://www.confluent.io/blog/stream-data-platform-1/ •  http://kafka.apache.org/documentation.html •  http://www.infoq.com/articles/apache-kafka •  http://blog.cloudera.com/blog/2014/09/apache-kafka-for-beginners/ •  http://www.confluent.io/blog/tutorial-getting-started-with-the-new-apache-kafka-0.9-consumer-client •  https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol •  https://cwiki.apache.org/confluence/display/KAFKA/System+Tools •  https://zookeeper.apache.org/doc/r3.3.2/zookeeperOver.html#ch_DesignOverview •  http://blog.cloudera.com/blog/2014/11/flafka-apache-flume-meets-apache-kafka-for-event-processing/ •  http://www.slideshare.net/wangxia5/netflix-kafka
  • 24. 24Page RabbitMQ •  Proven Message Broker uses Advanced Message Queuing Protocol (AMQP) for messaging. •  Message flow & concepts in RabbitMQ •  The producer publishes a message •  The exchange receives and routes the message in to the queues •  Routing can be based on different message attributes such as routing key, depending on the exchange type •  Binding is a link between an exchange and a queue •  The messages stays in the queue until they are handled by a consumer •  The consumer handles the message. •  Channel: a virtual connection inside a connection. When you are publishing or consuming messages or subscribing to a queue is it all done over a channel
  • 25. 25Page RabbitMQ (cont.) •  Types of Exchange •  Direct: delivers messages to queues based on a message routing key: Queues’ binding key == routing key of the message •  Fanout: routes messages to all of the queues that are bound to it. •  Topic: does a wildcard match between the routing key and the routing pattern specified in the binding. •  Headers: uses the message header attributes for routing. •  CloudAMQP •  hosted RabbitMQ solution, just sign up for an account and create an instance. You do not need to set up and install RabbitMQ or care about cluster handling
  • 26. 26Page RabbitMQ (cont.) •  Management and Monitoring •  Nice web UI for management and monitoring of your RabbitMQ server. •  Allows to handle, create, delete and list queues, monitor queue length, check message rate, change and add users permissions, etc.
  • 27. 27Page Upgrading from 0.8.0, 0.8.1.X or 0.8.2.X to 0.9.0.0 •  0.9.0.0 has potential breaking changes (please review before upgrading) and an inter-broker protocol change from previous versions. •  Java 1.6 and Scala 2.9 is no longer supported •  http://kafka.apache.org/documentation.html •  Kafka consumers in earlier releases store their offsets by default in ZooKeeper. It is possible to migrate these consumers to commit offsets into Kafka by following some steps
  • 28. 28Page Kafka Terminology (cont.) •  Protocol •  These requests to publish or fetch data must be sent to the broker that is currently acting as the leader for a given partition. This condition is enforced by the broker, so a request for a particular partition to the wrong broker will result in an the NotLeaderForPartition error code •  All Kafka brokers can answer a metadata request that describes the current state of the cluster: •  what topics there are •  which partitions those topics have •  which broker is the leader for those partitions •  the host and port information for these brokers •  Good explanation: https://cwiki.apache.org/confluence/display/KAFKA/A+Guide+To+The+Kafka+Protocol
  • 29. 29Page Kafka Adoption Apache Kafka has become a popular messaging system in a short period of time with a number of organizations like •  LinkedIn •  Tumblr •  PayPal •  Cisco •  Box •  Airbnb •  Netflix •  Square •  Spotify •  Pinterest •  Uber •  Goldman Sachs •  Yahoo and Twitter among others using it in production systems