SlideShare a Scribd company logo
1© Cloudera, Inc. All rights reserved.
Decoupling Decisions
with Apache Kafka
August, 2016
2© Cloudera, Inc. All rights reserved.
About Me
linkedin.com/in/granthenke
github.com/granthenke
@gchenke
grant@cloudera.com
• Cloudera Kafka Software Engineer
• Distributed Systems Enthusiast
• Father to a 15 month old
3© Cloudera, Inc. All rights reserved.
Agenda
Introduction
Terminology
Guarantees
What? Command Line
Configurations
Choosing Partitions
Apache Kafka Decoupling Decisions Getting Started
4© Cloudera, Inc. All rights reserved.
Apache Kafka
A brief overview
5© Cloudera, Inc. All rights reserved.
What Is Kafka?
Kafka provides the functionality of a
messaging system, but with a unique design.
6© Cloudera, Inc. All rights reserved.
What Is Kafka?
Kafka is a distributed, partitioned, replicated
commit log service.
7© Cloudera, Inc. All rights reserved.
What Is Kafka?
Kafka is Fast:
A single Kafka broker can handle hundreds of
megabytes of reads and writes per second
from thousands of clients.
8© Cloudera, Inc. All rights reserved.
What Is Kafka?
Kafka is Scalable:
Kafka is designed to allow a single cluster to
serve as the central data backbone for a
large organization.
9© Cloudera, Inc. All rights reserved.
What Is Kafka?
Kafka is Scalable:
Kafka can be expanded without downtime.
10© Cloudera, Inc. All rights reserved.
What Is Kafka?
Kafka is Durable:
Messages are persisted and replicated within
the cluster to prevent data loss.
11© Cloudera, Inc. All rights reserved.
What Is Kafka?
Kafka is Durable:
Each broker can handle terabytes of
messages without performance impact.
12© Cloudera, Inc. All rights reserved.
• Messages are organized into topics
• Topics are broken into partitions
• Partitions are replicated across the
brokers as replicas
• Kafka runs in a cluster. Nodes are
called brokers
• Producers push messages
• Consumers pull messages
The Basics
13© Cloudera, Inc. All rights reserved.
Replicas
• A partition has 1 leader replica. The
others are followers.
• Followers are considered in-sync when:
• The replica is alive
• The replica is not “too far” behind the
leader (configurable)
• The group of in-sync replicas for a
partition is called the ISR (In-Sync
Replicas)
• Replicas map to physical locations on a
broker
Messages
• Optionally be keyed in order to map to a
static partition
• Used if ordering within a partition is
needed
• Avoid otherwise (extra complexity,
skew, etc.)
• Location of a message is denoted by its
topic, partition & offset
• A partitions offset increases as
messages are appended
Beyond Basics…
14© Cloudera, Inc. All rights reserved.
Kafka Guarantees
15© Cloudera, Inc. All rights reserved.
Kafka Guarantees
WARNING: Guarantees can vary based on your
configuration choices.
16© Cloudera, Inc. All rights reserved.
• Messages sent to each partition will
be appended to the log in the order
they are sent
• Messages read from each partition
will be seen in the order stored in the
log
Kafka Guarantees: Message Ordering
17© Cloudera, Inc. All rights reserved.
Kafka Guarantees: Message Delivery
• At-least-once: Messages are never lost but may be redelivered
• Duplicates can be minimized but not totally eliminated
• Generally only get duplicates during failure or rebalance scenarios
• It’s a good practice to build pipelines with duplicates in mind regardless
18© Cloudera, Inc. All rights reserved.
Kafka Guarantees: Message Safety
• Messages written to Kafka are durable and safe
• Once a published message is committed it will not be lost as long as one broker
that replicates the partition to which this message was written remains "alive”
• Only committed messages are ever given out to the consumer. This means that
the consumer need not worry about potentially seeing a message that could be
lost if the leader fails.
19© Cloudera, Inc. All rights reserved.
Decoupling Decisions
Flexible from the beginning
20© Cloudera, Inc. All rights reserved.
• Data pipelines start simple
• One or two data sources
• One backend application
Initial Decisions:
• How can I be successful quickly?
• What does this specific pipeline
need?
• Don’t prematurely optimize
How It Starts
Client Backend
21© Cloudera, Inc. All rights reserved.
• Multiple sources
• Another backend application
• Initial decisions need to change
Then Quickly…
Source Batch Backend
Source
Source
Source
Streaming
Backend
22© Cloudera, Inc. All rights reserved.
• More environments
• Backend applications feed other
backend applications
• You may also want to
• Experiment with new software
• Change data formats
• Move to a streaming architecture
And Eventually…
Source Batch Backend
Source
Source
Source
Streaming
Backend
Cloud Backend
QA Backend
23© Cloudera, Inc. All rights reserved.
• Early decisions made for that single
pipeline have impacted each system
added
• Because sources and applications are
tightly coupled change is difficult
• Progress becomes slower and slower
• The system has grown fragile
• Experimentation, growth, and
innovation is risky
Technical Debt
24© Cloudera, Inc. All rights reserved.
Decision Types: Type 1 decisions
“Some decisions are consequential and
irreversible or nearly irreversible – one-way
doors – and these decisions must be made
methodically, carefully, slowly, with great
deliberation and consultation…” —Jeff Bezos
25© Cloudera, Inc. All rights reserved.
Decision Types: Type 2 Decisions
“Type 2 decisions are changeable, reversible
– they’re two-way doors. If you’ve made a
suboptimal Type 2 decision, you don’t have
to live with the consequences for that
long.”—Jeff Bezos
26© Cloudera, Inc. All rights reserved.
Kafka Is Here To Help!
27© Cloudera, Inc. All rights reserved.
• A central backbone for the entire
system
• Decouples source and backend
systems
• Slow or failing consumers don’t
impact source system
• Adding new sources or consumers is
easy and low impact
With Kafka
Source
Batch
Backend
Source
Source
Source
Streaming
Backend
Cloud
Backend
QA
Backend
Kafka
28© Cloudera, Inc. All rights reserved.
Lets Make Some Changes
29© Cloudera, Inc. All rights reserved.
• Add new source or backend
• Process more data
• Move from batch to streaming
• Change data source
The Really Easy Changes
Batch
Backend
Batch
Backend
Source
Source
Kafka
Source
Batch
Backend
Source
Source
Old Source
Streaming
Backend
Cloud
Backend
QA
Backend
Kafka
Kafka
New Source
30© Cloudera, Inc. All rights reserved.
• I would like to support avro (or thrift,
protobuf, xml, json, …)
• Keep source data raw
• In a streaming application transform
formats
• Read from source-topic and produce
to source-topic-{format}
• This could also include
lossy/optimization transformations
Change Data Format
Source
Batch
Backend
Source
Source
Source
Streaming
Backend
Cloud
Backend
QA
Backend
Kafka
Format
Conversion App
31© Cloudera, Inc. All rights reserved.
• Deploy new application and replay
the stream
• Great for testing and development
• Extremely useful for handling failures
and recovery too
Change Business Logic
32© Cloudera, Inc. All rights reserved.
• There are well written clients in a lot
of programming languages
• In the rare case your language of
choice doesn’t have a client, you can
use the binary wire protocol and
write one
Change Application Language
33© Cloudera, Inc. All rights reserved.
• Many processing frameworks get
Kafka integration early on
• Because consumers don’t affect
source applications its safe to
experiment
Change Processing Framework
Streams
34© Cloudera, Inc. All rights reserved.
35© Cloudera, Inc. All rights reserved.
Quick Start
Sounds great...but how do I use it?
36© Cloudera, Inc. All rights reserved.
Let’s Keep it Simple
37© Cloudera, Inc. All rights reserved.
Install Kafka
38© Cloudera, Inc. All rights reserved.
Start with the CLI tools
39© Cloudera, Inc. All rights reserved.
# Create a topic & describe
kafka-topics --zookeeper my-zk-host:2181 --create --topic my-topic --partitions 10 -
-replication-factor 3
kafka-topics --zookeeper my-zk-host:2181 --describe --topic my-topic
# Produce in one shell
vmstat -w -n -t 1 | kafka-console-producer --broker-list my-broker-host:9092 --
topic my-topic
# Consume in a separate shell
kafka-console-consumer --zookeeper my-zk-host:2181 --topic my-topic
40© Cloudera, Inc. All rights reserved.
# Create a topic & describe
kafka-topics --zookeeper my-zk-host:2181 --create --topic my-topic --partitions 10
--replication-factor 3
kafka-topics --zookeeper my-zk-host:2181 --describe --topic my-topic
# Produce in one shell
vmstat -w -n -t 1 | kafka-console-producer --broker-list my-broker-host:9092 --
topic my-topic
# Consume in a separate shell
kafka-console-consumer --zookeeper my-zk-host:2181 --topic my-topic
41© Cloudera, Inc. All rights reserved.
# Create a topic & describe
kafka-topics --zookeeper my-zk-host:2181 --create --topic my-topic --partitions 10 -
-replication-factor 3
kafka-topics --zookeeper my-zk-host:2181 --describe --topic my-topic
# Produce in one shell
vmstat -w -n -t 1 | kafka-console-producer --broker-list my-broker-host:9092 --
topic my-topic
# Consume in a separate shell
kafka-console-consumer --zookeeper my-zk-host:2181 --topic my-topic
42© Cloudera, Inc. All rights reserved.
# Create a topic & describe
kafka-topics --zookeeper my-zk-host:2181 --create --topic my-topic --partitions 10 -
-replication-factor 3
kafka-topics --zookeeper my-zk-host:2181 --describe --topic my-topic
# Produce in one shell
vmstat -w -n -t 1 | kafka-console-producer --broker-list my-broker-host:9092 --
topic my-topic
# Consume in a separate shell
kafka-console-consumer --zookeeper my-zk-host:2181 --topic my-topic
43© Cloudera, Inc. All rights reserved.
Kafka Configuration
A starting point
44© Cloudera, Inc. All rights reserved.
• Tune for throughput or
safety
• At least once or at most
once
• Per topic overrides and
client overrides
Flexible Configuration
45© Cloudera, Inc. All rights reserved.
Broker Configuration
• 3 or more Brokers
• broker_max_heap_size=8GiB
• zookeeper.chroot=kafka
• auto.create.topics.enable=false
• If you must use it make sure you set
• num.partitions >= #OfBrokers
• default.replication.factor=3
• min.insync.replicas=2
• unclean.leader.election=false (default)
46© Cloudera, Inc. All rights reserved.
Producer Configuration
• Use the new Java Producer
• acks=all
• retries=Integer.MAX_VALUE
• max.block.ms=Long.MAX_VALUE
• max.in.flight.requests.per.connection=1
• linger.ms=1000
• compression.type=snappy
47© Cloudera, Inc. All rights reserved.
Consumer Configuration
• Use the new Java Consumer
• group.id represents the “Coordinated Application”
• Consumers within the group share the load
• auto.offset.reset = latest/earliest/none
• enable.auto.commit=false
48© Cloudera, Inc. All rights reserved.
Choosing Partition Counts: Quick Pick
• Just getting started, don’t overthink it
• Don’t make the mistake of picking (1 partition)
• Don’t pick way too many (1000 partitions)
• Often a handwave choice of 25 to 100 partitions is a good
start
• Tune when you can understand your data and use case
better
49© Cloudera, Inc. All rights reserved.
Make something
Getting started is the
hardest part
What’s Next?
50© Cloudera, Inc. All rights reserved.
Thank you
51© Cloudera, Inc. All rights reserved.
Common Questions
52© Cloudera, Inc. All rights reserved.
How do I size broker hardware?
Brokers
• Similar profile to data nodes
• Depends on what’s important
• Message Retention = Disk Size
• Client Throughput = Network Capacity
• Producer Throughput = Disk I/O
• Consumer Throughput = Memory
53© Cloudera, Inc. All rights reserved.
• Brokers: 3->15 per Cluster
• Common to start with 3-5
• Very large are around 30-40 nodes
• Having many clusters is common
• Topics: 1->100s per Cluster
• Partitions: 1->1000s per Topic
• Clusters with up to 10k total
partitions are workable. Beyond
that we don't aggressively test. [src]
• Consumer Groups: 1->100s active per
Cluster
• Could Consume 1 to all topics
Kafka Cardinality—What is large?
54© Cloudera, Inc. All rights reserved.
• Kafka is not designed for very large
messages
• Optimal performance ~10KB
• Could consider breaking up the
messages/files into smaller chunks
Large Messages
55© Cloudera, Inc. All rights reserved.
Should I use Raid 10 or JBOD?
RAID10
• Can survive single disk failure
• Single log directory
• Lower total I/O
JBOD
• Single disk failure kills broker
• More available disk space
• Higher write throughput
• Broker is not smart about balancing
partitions across disk
56© Cloudera, Inc. All rights reserved.
Do I need a separate Zookeeper for Kafka?
• It’s not required but preferred
• Kafka relies on Zookeeper for cluster
metadata & state
• Correct Zookeeper configuration is most
important
57© Cloudera, Inc. All rights reserved.
Zookeeper Configuration
• ZooKeeper's transaction log must be on a dedicated device (A dedicated
partition is not enough) for optimal performance
• ZooKeeper writes the log sequentially, without seeking
• Set dataLogDir to point to a directory on that device
• Make sure to point dataDir to a directory not residing on that device
• Do not put ZooKeeper in a situation that can cause a swap
• Therefore, make certain that the maximum heap size given to ZooKeeper is
not bigger than the amount of real memory available to ZooKeeper
58© Cloudera, Inc. All rights reserved.
Choosing Partition Counts
• A topic partition is the unit of parallelism in Kafka
• It is easier to increase partitions than it is reduce them
•Especially when using keyed messages
•Consumers are assigned partitions to consume
•They can’t split/share partitions
•Parallelism is bounded by the number of partitions
59© Cloudera, Inc. All rights reserved.
Choosing Partition Counts: Quick Pick
• Just getting started, don’t overthink it
• Don’t make the mistake of picking (1 partition)
• Don’t pick way too many (1000 partitions)
• Often a handwave choice of 25 to 100 partitions is a good
start
• Tune when you can understand your data and use case
better
60© Cloudera, Inc. All rights reserved.
Choosing Partition Counts: Estimation
Given:
• pt = production throughput per partition
• ct = consumption throughput per partition
• tt = total throughput you want to achieve
• pc = the minimum partition count
Then:
• pc >= max(tt/pt, tt/ct)
61© Cloudera, Inc. All rights reserved.
Choosing Partition Counts: Tools
• Kafka includes rudimentary benchmarking tools to help you get a
rough estimate
• kafka-producer-perft-test.sh (kafka.tools.ConsumerPerformance)
• kafka-consumer-perf-test.sh (kafka.tools.ProducerPerformance)
• kafka.tools.EndToEndLatency
• Use with kafka-run-class.sh
• Nothing is more accurate than a real application
• With real/representative data
62© Cloudera, Inc. All rights reserved.
How do I manage Schemas?
• A big topic with enough content for its own talk
• Options
•Schema Registry
•Source Controlled Dependency
•Static "Envelop Schema”
63© Cloudera, Inc. All rights reserved.
Thank you

More Related Content

What's hot

A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...HostedbyConfluent
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explainedconfluent
 
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
 
A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...
 A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ... A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...
A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...HostedbyConfluent
 
Apache Kafka at LinkedIn
Apache Kafka at LinkedInApache Kafka at LinkedIn
Apache Kafka at LinkedInGuozhang Wang
 
Apache Kafka Introduction
Apache Kafka IntroductionApache Kafka Introduction
Apache Kafka IntroductionAmita Mirajkar
 
From Message to Cluster: A Realworld Introduction to Kafka Capacity Planning
From Message to Cluster: A Realworld Introduction to Kafka Capacity PlanningFrom Message to Cluster: A Realworld Introduction to Kafka Capacity Planning
From Message to Cluster: A Realworld Introduction to Kafka Capacity Planningconfluent
 
An Introduction to Kafka Cruise Control with Viktor Somogyi-Vass
An Introduction to Kafka Cruise Control with Viktor Somogyi-VassAn Introduction to Kafka Cruise Control with Viktor Somogyi-Vass
An Introduction to Kafka Cruise Control with Viktor Somogyi-VassHostedbyConfluent
 
An Introduction to Apache Kafka
An Introduction to Apache KafkaAn Introduction to Apache Kafka
An Introduction to Apache KafkaAmir Sedighi
 
[Meetup] a successful migration from elastic search to clickhouse
[Meetup] a successful migration from elastic search to clickhouse[Meetup] a successful migration from elastic search to clickhouse
[Meetup] a successful migration from elastic search to clickhouseVianney FOUCAULT
 
How to Lock Down Apache Kafka and Keep Your Streams Safe
How to Lock Down Apache Kafka and Keep Your Streams SafeHow to Lock Down Apache Kafka and Keep Your Streams Safe
How to Lock Down Apache Kafka and Keep Your Streams Safeconfluent
 
Ditching the overhead - Moving Apache Kafka workloads into Amazon MSK - ADB30...
Ditching the overhead - Moving Apache Kafka workloads into Amazon MSK - ADB30...Ditching the overhead - Moving Apache Kafka workloads into Amazon MSK - ADB30...
Ditching the overhead - Moving Apache Kafka workloads into Amazon MSK - ADB30...Amazon Web Services
 
Kafka Streams State Stores Being Persistent
Kafka Streams State Stores Being PersistentKafka Streams State Stores Being Persistent
Kafka Streams State Stores Being Persistentconfluent
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaShiao-An Yuan
 
Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013Jun Rao
 

What's hot (20)

A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
A Look into the Mirror: Patterns and Best Practices for MirrorMaker2 | Cliff ...
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
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
 
A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...
 A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ... A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...
A Hitchhiker's Guide to Apache Kafka Geo-Replication with Sanjana Kaundinya ...
 
Apache Kafka at LinkedIn
Apache Kafka at LinkedInApache Kafka at LinkedIn
Apache Kafka at LinkedIn
 
Apache Kafka Introduction
Apache Kafka IntroductionApache Kafka Introduction
Apache Kafka Introduction
 
From Message to Cluster: A Realworld Introduction to Kafka Capacity Planning
From Message to Cluster: A Realworld Introduction to Kafka Capacity PlanningFrom Message to Cluster: A Realworld Introduction to Kafka Capacity Planning
From Message to Cluster: A Realworld Introduction to Kafka Capacity Planning
 
An Introduction to Kafka Cruise Control with Viktor Somogyi-Vass
An Introduction to Kafka Cruise Control with Viktor Somogyi-VassAn Introduction to Kafka Cruise Control with Viktor Somogyi-Vass
An Introduction to Kafka Cruise Control with Viktor Somogyi-Vass
 
Apache Kafka Best Practices
Apache Kafka Best PracticesApache Kafka Best Practices
Apache Kafka Best Practices
 
Introduction to apache kafka
Introduction to apache kafkaIntroduction to apache kafka
Introduction to apache kafka
 
An Introduction to Apache Kafka
An Introduction to Apache KafkaAn Introduction to Apache Kafka
An Introduction to Apache Kafka
 
[Meetup] a successful migration from elastic search to clickhouse
[Meetup] a successful migration from elastic search to clickhouse[Meetup] a successful migration from elastic search to clickhouse
[Meetup] a successful migration from elastic search to clickhouse
 
Introduction to Galera Cluster
Introduction to Galera ClusterIntroduction to Galera Cluster
Introduction to Galera Cluster
 
How to Lock Down Apache Kafka and Keep Your Streams Safe
How to Lock Down Apache Kafka and Keep Your Streams SafeHow to Lock Down Apache Kafka and Keep Your Streams Safe
How to Lock Down Apache Kafka and Keep Your Streams Safe
 
Ditching the overhead - Moving Apache Kafka workloads into Amazon MSK - ADB30...
Ditching the overhead - Moving Apache Kafka workloads into Amazon MSK - ADB30...Ditching the overhead - Moving Apache Kafka workloads into Amazon MSK - ADB30...
Ditching the overhead - Moving Apache Kafka workloads into Amazon MSK - ADB30...
 
Kafka Streams State Stores Being Persistent
Kafka Streams State Stores Being PersistentKafka Streams State Stores Being Persistent
Kafka Streams State Stores Being Persistent
 
Kafka 101
Kafka 101Kafka 101
Kafka 101
 
Planning for Disaster Recovery (DR) with Galera Cluster
Planning for Disaster Recovery (DR) with Galera ClusterPlanning for Disaster Recovery (DR) with Galera Cluster
Planning for Disaster Recovery (DR) with Galera Cluster
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Kafka replication apachecon_2013
Kafka replication apachecon_2013Kafka replication apachecon_2013
Kafka replication apachecon_2013
 

Viewers also liked

Kafka Reliability - When it absolutely, positively has to be there
Kafka Reliability - When it absolutely, positively has to be thereKafka Reliability - When it absolutely, positively has to be there
Kafka Reliability - When it absolutely, positively has to be thereGwen (Chen) Shapira
 
Tuning Kafka for Fun and Profit
Tuning Kafka for Fun and ProfitTuning Kafka for Fun and Profit
Tuning Kafka for Fun and ProfitTodd Palino
 
Optimizing Regulatory Compliance with Big Data
Optimizing Regulatory Compliance with Big DataOptimizing Regulatory Compliance with Big Data
Optimizing Regulatory Compliance with Big DataCloudera, Inc.
 
Kafka Reliability Guarantees ATL Kafka User Group
Kafka Reliability Guarantees ATL Kafka User GroupKafka Reliability Guarantees ATL Kafka User Group
Kafka Reliability Guarantees ATL Kafka User GroupJeff Holoman
 
Building Realtim Data Pipelines with Kafka Connect and Spark Streaming
Building Realtim Data Pipelines with Kafka Connect and Spark StreamingBuilding Realtim Data Pipelines with Kafka Connect and Spark Streaming
Building Realtim Data Pipelines with Kafka Connect and Spark StreamingGuozhang Wang
 
Introduction to Apache Kudu
Introduction to Apache KuduIntroduction to Apache Kudu
Introduction to Apache KuduJeff Holoman
 
Reducing Microservice Complexity with Kafka and Reactive Streams
Reducing Microservice Complexity with Kafka and Reactive StreamsReducing Microservice Complexity with Kafka and Reactive Streams
Reducing Microservice Complexity with Kafka and Reactive Streamsjimriecken
 
Apache Kafka - Messaging System Overview
Apache Kafka - Messaging System OverviewApache Kafka - Messaging System Overview
Apache Kafka - Messaging System OverviewDmitry Tolpeko
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache KafkaJeff Holoman
 
Gartner Data and Analytics Summit: Bringing Self-Service BI & SQL Analytics ...
 Gartner Data and Analytics Summit: Bringing Self-Service BI & SQL Analytics ... Gartner Data and Analytics Summit: Bringing Self-Service BI & SQL Analytics ...
Gartner Data and Analytics Summit: Bringing Self-Service BI & SQL Analytics ...Cloudera, Inc.
 
Microservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka EcosystemMicroservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka Ecosystemconfluent
 

Viewers also liked (13)

Kafka Reliability - When it absolutely, positively has to be there
Kafka Reliability - When it absolutely, positively has to be thereKafka Reliability - When it absolutely, positively has to be there
Kafka Reliability - When it absolutely, positively has to be there
 
intro-kafka
intro-kafkaintro-kafka
intro-kafka
 
Tuning Kafka for Fun and Profit
Tuning Kafka for Fun and ProfitTuning Kafka for Fun and Profit
Tuning Kafka for Fun and Profit
 
Optimizing Regulatory Compliance with Big Data
Optimizing Regulatory Compliance with Big DataOptimizing Regulatory Compliance with Big Data
Optimizing Regulatory Compliance with Big Data
 
Kafka Reliability Guarantees ATL Kafka User Group
Kafka Reliability Guarantees ATL Kafka User GroupKafka Reliability Guarantees ATL Kafka User Group
Kafka Reliability Guarantees ATL Kafka User Group
 
Building Realtim Data Pipelines with Kafka Connect and Spark Streaming
Building Realtim Data Pipelines with Kafka Connect and Spark StreamingBuilding Realtim Data Pipelines with Kafka Connect and Spark Streaming
Building Realtim Data Pipelines with Kafka Connect and Spark Streaming
 
Introduction to Apache Kudu
Introduction to Apache KuduIntroduction to Apache Kudu
Introduction to Apache Kudu
 
Reducing Microservice Complexity with Kafka and Reactive Streams
Reducing Microservice Complexity with Kafka and Reactive StreamsReducing Microservice Complexity with Kafka and Reactive Streams
Reducing Microservice Complexity with Kafka and Reactive Streams
 
Apache Kafka - Messaging System Overview
Apache Kafka - Messaging System OverviewApache Kafka - Messaging System Overview
Apache Kafka - Messaging System Overview
 
Introduction to Apache Kafka
Introduction to Apache KafkaIntroduction to Apache Kafka
Introduction to Apache Kafka
 
Kafka presentation
Kafka presentationKafka presentation
Kafka presentation
 
Gartner Data and Analytics Summit: Bringing Self-Service BI & SQL Analytics ...
 Gartner Data and Analytics Summit: Bringing Self-Service BI & SQL Analytics ... Gartner Data and Analytics Summit: Bringing Self-Service BI & SQL Analytics ...
Gartner Data and Analytics Summit: Bringing Self-Service BI & SQL Analytics ...
 
Microservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka EcosystemMicroservices in the Apache Kafka Ecosystem
Microservices in the Apache Kafka Ecosystem
 

Similar to Decoupling Decisions with Apache Kafka

Big Data Day LA 2015 - Introduction to Apache Kafka - The Big Data Message Bu...
Big Data Day LA 2015 - Introduction to Apache Kafka - The Big Data Message Bu...Big Data Day LA 2015 - Introduction to Apache Kafka - The Big Data Message Bu...
Big Data Day LA 2015 - Introduction to Apache Kafka - The Big Data Message Bu...Data Con LA
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Cloudera, Inc.
 
Apache NiFi SDLC Improvements
Apache NiFi SDLC ImprovementsApache NiFi SDLC Improvements
Apache NiFi SDLC ImprovementsBryan Bende
 
The Flink - Apache Bigtop integration
The Flink - Apache Bigtop integrationThe Flink - Apache Bigtop integration
The Flink - Apache Bigtop integrationMárton Balassi
 
Building Effective Near-Real-Time Analytics with Spark Streaming and Kudu
Building Effective Near-Real-Time Analytics with Spark Streaming and KuduBuilding Effective Near-Real-Time Analytics with Spark Streaming and Kudu
Building Effective Near-Real-Time Analytics with Spark Streaming and KuduJeremy Beard
 
Fraud Detection for Israel BigThings Meetup
Fraud Detection  for Israel BigThings MeetupFraud Detection  for Israel BigThings Meetup
Fraud Detection for Israel BigThings MeetupGwen (Chen) Shapira
 
End to End Streaming Architectures
End to End Streaming ArchitecturesEnd to End Streaming Architectures
End to End Streaming ArchitecturesCloudera, Inc.
 
Best Practices For Workflow
Best Practices For WorkflowBest Practices For Workflow
Best Practices For WorkflowTimothy Spann
 
Hello, kafka! (an introduction to apache kafka)
Hello, kafka! (an introduction to apache kafka)Hello, kafka! (an introduction to apache kafka)
Hello, kafka! (an introduction to apache kafka)Timothy Spann
 
Apache Spark Operations
Apache Spark OperationsApache Spark Operations
Apache Spark OperationsCloudera, Inc.
 
Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?Pat Patterson
 
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...HostedbyConfluent
 
Lambda architecture on Spark, Kafka for real-time large scale ML
Lambda architecture on Spark, Kafka for real-time large scale MLLambda architecture on Spark, Kafka for real-time large scale ML
Lambda architecture on Spark, Kafka for real-time large scale MLhuguk
 
Intro to Apache Kafka
Intro to Apache KafkaIntro to Apache Kafka
Intro to Apache KafkaJason Hubbard
 

Similar to Decoupling Decisions with Apache Kafka (20)

Kafka for DBAs
Kafka for DBAsKafka for DBAs
Kafka for DBAs
 
Big Data Day LA 2015 - Introduction to Apache Kafka - The Big Data Message Bu...
Big Data Day LA 2015 - Introduction to Apache Kafka - The Big Data Message Bu...Big Data Day LA 2015 - Introduction to Apache Kafka - The Big Data Message Bu...
Big Data Day LA 2015 - Introduction to Apache Kafka - The Big Data Message Bu...
 
Apache kafka
Apache kafkaApache kafka
Apache kafka
 
Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive

Apache Kudu: Technical Deep Dive


Apache Kudu: Technical Deep Dive


 
Apache NiFi SDLC Improvements
Apache NiFi SDLC ImprovementsApache NiFi SDLC Improvements
Apache NiFi SDLC Improvements
 
Apache Kafka - Strakin Technologies Pvt Ltd
Apache Kafka - Strakin Technologies Pvt LtdApache Kafka - Strakin Technologies Pvt Ltd
Apache Kafka - Strakin Technologies Pvt Ltd
 
The Flink - Apache Bigtop integration
The Flink - Apache Bigtop integrationThe Flink - Apache Bigtop integration
The Flink - Apache Bigtop integration
 
Building Effective Near-Real-Time Analytics with Spark Streaming and Kudu
Building Effective Near-Real-Time Analytics with Spark Streaming and KuduBuilding Effective Near-Real-Time Analytics with Spark Streaming and Kudu
Building Effective Near-Real-Time Analytics with Spark Streaming and Kudu
 
Fraud Detection for Israel BigThings Meetup
Fraud Detection  for Israel BigThings MeetupFraud Detection  for Israel BigThings Meetup
Fraud Detection for Israel BigThings Meetup
 
End to End Streaming Architectures
End to End Streaming ArchitecturesEnd to End Streaming Architectures
End to End Streaming Architectures
 
Best Practices For Workflow
Best Practices For WorkflowBest Practices For Workflow
Best Practices For Workflow
 
Hello, kafka! (an introduction to apache kafka)
Hello, kafka! (an introduction to apache kafka)Hello, kafka! (an introduction to apache kafka)
Hello, kafka! (an introduction to apache kafka)
 
Apache Spark Operations
Apache Spark OperationsApache Spark Operations
Apache Spark Operations
 
Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?
 
Effective Spark on Multi-Tenant Clusters
Effective Spark on Multi-Tenant ClustersEffective Spark on Multi-Tenant Clusters
Effective Spark on Multi-Tenant Clusters
 
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...
 
Securing Spark Applications
Securing Spark ApplicationsSecuring Spark Applications
Securing Spark Applications
 
Lambda architecture on Spark, Kafka for real-time large scale ML
Lambda architecture on Spark, Kafka for real-time large scale MLLambda architecture on Spark, Kafka for real-time large scale ML
Lambda architecture on Spark, Kafka for real-time large scale ML
 
Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?Ingest and Stream Processing - What will you choose?
Ingest and Stream Processing - What will you choose?
 
Intro to Apache Kafka
Intro to Apache KafkaIntro to Apache Kafka
Intro to Apache Kafka
 

Recently uploaded

top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownloadvrstrong314
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationWave PLM
 
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...Abortion Clinic
 
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.pdfOrtus Solutions, Corp
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1KnowledgeSeed
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEJelle | Nordend
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
 
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.pdfMeon Technology
 
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 KnowPeter Caitens
 
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 IntelBrokerSOCRadar
 
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.pdfkalichargn70th171
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesKrzysztofKkol1
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
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 / helmholtzBubbleFoamtakuyayamamoto1800
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILNatan Silnitsky
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAlluxio, Inc.
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...Alluxio, Inc.
 

Recently uploaded (20)

top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Crafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM IntegrationCrafting the Perfect Measurement Sheet with PLM Integration
Crafting the Perfect Measurement Sheet with PLM Integration
 
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...
 
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
 
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
A Python-based approach to data loading in TM1 - Using Airflow as an ETL for TM1
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024Top Mobile App Development Companies 2024
Top Mobile App Development Companies 2024
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
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
 
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
 
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
 
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
 
Designing for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web ServicesDesigning for Privacy in Amazon Web Services
Designing for Privacy in Amazon Web Services
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
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
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
AI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in MichelangeloAI/ML Infra Meetup | ML explainability in Michelangelo
AI/ML Infra Meetup | ML explainability in Michelangelo
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 

Decoupling Decisions with Apache Kafka

  • 1. 1© Cloudera, Inc. All rights reserved. Decoupling Decisions with Apache Kafka August, 2016
  • 2. 2© Cloudera, Inc. All rights reserved. About Me linkedin.com/in/granthenke github.com/granthenke @gchenke grant@cloudera.com • Cloudera Kafka Software Engineer • Distributed Systems Enthusiast • Father to a 15 month old
  • 3. 3© Cloudera, Inc. All rights reserved. Agenda Introduction Terminology Guarantees What? Command Line Configurations Choosing Partitions Apache Kafka Decoupling Decisions Getting Started
  • 4. 4© Cloudera, Inc. All rights reserved. Apache Kafka A brief overview
  • 5. 5© Cloudera, Inc. All rights reserved. What Is Kafka? Kafka provides the functionality of a messaging system, but with a unique design.
  • 6. 6© Cloudera, Inc. All rights reserved. What Is Kafka? Kafka is a distributed, partitioned, replicated commit log service.
  • 7. 7© Cloudera, Inc. All rights reserved. What Is Kafka? Kafka is Fast: A single Kafka broker can handle hundreds of megabytes of reads and writes per second from thousands of clients.
  • 8. 8© Cloudera, Inc. All rights reserved. What Is Kafka? Kafka is Scalable: Kafka is designed to allow a single cluster to serve as the central data backbone for a large organization.
  • 9. 9© Cloudera, Inc. All rights reserved. What Is Kafka? Kafka is Scalable: Kafka can be expanded without downtime.
  • 10. 10© Cloudera, Inc. All rights reserved. What Is Kafka? Kafka is Durable: Messages are persisted and replicated within the cluster to prevent data loss.
  • 11. 11© Cloudera, Inc. All rights reserved. What Is Kafka? Kafka is Durable: Each broker can handle terabytes of messages without performance impact.
  • 12. 12© Cloudera, Inc. All rights reserved. • Messages are organized into topics • Topics are broken into partitions • Partitions are replicated across the brokers as replicas • Kafka runs in a cluster. Nodes are called brokers • Producers push messages • Consumers pull messages The Basics
  • 13. 13© Cloudera, Inc. All rights reserved. Replicas • A partition has 1 leader replica. The others are followers. • Followers are considered in-sync when: • The replica is alive • The replica is not “too far” behind the leader (configurable) • The group of in-sync replicas for a partition is called the ISR (In-Sync Replicas) • Replicas map to physical locations on a broker Messages • Optionally be keyed in order to map to a static partition • Used if ordering within a partition is needed • Avoid otherwise (extra complexity, skew, etc.) • Location of a message is denoted by its topic, partition & offset • A partitions offset increases as messages are appended Beyond Basics…
  • 14. 14© Cloudera, Inc. All rights reserved. Kafka Guarantees
  • 15. 15© Cloudera, Inc. All rights reserved. Kafka Guarantees WARNING: Guarantees can vary based on your configuration choices.
  • 16. 16© Cloudera, Inc. All rights reserved. • Messages sent to each partition will be appended to the log in the order they are sent • Messages read from each partition will be seen in the order stored in the log Kafka Guarantees: Message Ordering
  • 17. 17© Cloudera, Inc. All rights reserved. Kafka Guarantees: Message Delivery • At-least-once: Messages are never lost but may be redelivered • Duplicates can be minimized but not totally eliminated • Generally only get duplicates during failure or rebalance scenarios • It’s a good practice to build pipelines with duplicates in mind regardless
  • 18. 18© Cloudera, Inc. All rights reserved. Kafka Guarantees: Message Safety • Messages written to Kafka are durable and safe • Once a published message is committed it will not be lost as long as one broker that replicates the partition to which this message was written remains "alive” • Only committed messages are ever given out to the consumer. This means that the consumer need not worry about potentially seeing a message that could be lost if the leader fails.
  • 19. 19© Cloudera, Inc. All rights reserved. Decoupling Decisions Flexible from the beginning
  • 20. 20© Cloudera, Inc. All rights reserved. • Data pipelines start simple • One or two data sources • One backend application Initial Decisions: • How can I be successful quickly? • What does this specific pipeline need? • Don’t prematurely optimize How It Starts Client Backend
  • 21. 21© Cloudera, Inc. All rights reserved. • Multiple sources • Another backend application • Initial decisions need to change Then Quickly… Source Batch Backend Source Source Source Streaming Backend
  • 22. 22© Cloudera, Inc. All rights reserved. • More environments • Backend applications feed other backend applications • You may also want to • Experiment with new software • Change data formats • Move to a streaming architecture And Eventually… Source Batch Backend Source Source Source Streaming Backend Cloud Backend QA Backend
  • 23. 23© Cloudera, Inc. All rights reserved. • Early decisions made for that single pipeline have impacted each system added • Because sources and applications are tightly coupled change is difficult • Progress becomes slower and slower • The system has grown fragile • Experimentation, growth, and innovation is risky Technical Debt
  • 24. 24© Cloudera, Inc. All rights reserved. Decision Types: Type 1 decisions “Some decisions are consequential and irreversible or nearly irreversible – one-way doors – and these decisions must be made methodically, carefully, slowly, with great deliberation and consultation…” —Jeff Bezos
  • 25. 25© Cloudera, Inc. All rights reserved. Decision Types: Type 2 Decisions “Type 2 decisions are changeable, reversible – they’re two-way doors. If you’ve made a suboptimal Type 2 decision, you don’t have to live with the consequences for that long.”—Jeff Bezos
  • 26. 26© Cloudera, Inc. All rights reserved. Kafka Is Here To Help!
  • 27. 27© Cloudera, Inc. All rights reserved. • A central backbone for the entire system • Decouples source and backend systems • Slow or failing consumers don’t impact source system • Adding new sources or consumers is easy and low impact With Kafka Source Batch Backend Source Source Source Streaming Backend Cloud Backend QA Backend Kafka
  • 28. 28© Cloudera, Inc. All rights reserved. Lets Make Some Changes
  • 29. 29© Cloudera, Inc. All rights reserved. • Add new source or backend • Process more data • Move from batch to streaming • Change data source The Really Easy Changes Batch Backend Batch Backend Source Source Kafka Source Batch Backend Source Source Old Source Streaming Backend Cloud Backend QA Backend Kafka Kafka New Source
  • 30. 30© Cloudera, Inc. All rights reserved. • I would like to support avro (or thrift, protobuf, xml, json, …) • Keep source data raw • In a streaming application transform formats • Read from source-topic and produce to source-topic-{format} • This could also include lossy/optimization transformations Change Data Format Source Batch Backend Source Source Source Streaming Backend Cloud Backend QA Backend Kafka Format Conversion App
  • 31. 31© Cloudera, Inc. All rights reserved. • Deploy new application and replay the stream • Great for testing and development • Extremely useful for handling failures and recovery too Change Business Logic
  • 32. 32© Cloudera, Inc. All rights reserved. • There are well written clients in a lot of programming languages • In the rare case your language of choice doesn’t have a client, you can use the binary wire protocol and write one Change Application Language
  • 33. 33© Cloudera, Inc. All rights reserved. • Many processing frameworks get Kafka integration early on • Because consumers don’t affect source applications its safe to experiment Change Processing Framework Streams
  • 34. 34© Cloudera, Inc. All rights reserved.
  • 35. 35© Cloudera, Inc. All rights reserved. Quick Start Sounds great...but how do I use it?
  • 36. 36© Cloudera, Inc. All rights reserved. Let’s Keep it Simple
  • 37. 37© Cloudera, Inc. All rights reserved. Install Kafka
  • 38. 38© Cloudera, Inc. All rights reserved. Start with the CLI tools
  • 39. 39© Cloudera, Inc. All rights reserved. # Create a topic & describe kafka-topics --zookeeper my-zk-host:2181 --create --topic my-topic --partitions 10 - -replication-factor 3 kafka-topics --zookeeper my-zk-host:2181 --describe --topic my-topic # Produce in one shell vmstat -w -n -t 1 | kafka-console-producer --broker-list my-broker-host:9092 -- topic my-topic # Consume in a separate shell kafka-console-consumer --zookeeper my-zk-host:2181 --topic my-topic
  • 40. 40© Cloudera, Inc. All rights reserved. # Create a topic & describe kafka-topics --zookeeper my-zk-host:2181 --create --topic my-topic --partitions 10 --replication-factor 3 kafka-topics --zookeeper my-zk-host:2181 --describe --topic my-topic # Produce in one shell vmstat -w -n -t 1 | kafka-console-producer --broker-list my-broker-host:9092 -- topic my-topic # Consume in a separate shell kafka-console-consumer --zookeeper my-zk-host:2181 --topic my-topic
  • 41. 41© Cloudera, Inc. All rights reserved. # Create a topic & describe kafka-topics --zookeeper my-zk-host:2181 --create --topic my-topic --partitions 10 - -replication-factor 3 kafka-topics --zookeeper my-zk-host:2181 --describe --topic my-topic # Produce in one shell vmstat -w -n -t 1 | kafka-console-producer --broker-list my-broker-host:9092 -- topic my-topic # Consume in a separate shell kafka-console-consumer --zookeeper my-zk-host:2181 --topic my-topic
  • 42. 42© Cloudera, Inc. All rights reserved. # Create a topic & describe kafka-topics --zookeeper my-zk-host:2181 --create --topic my-topic --partitions 10 - -replication-factor 3 kafka-topics --zookeeper my-zk-host:2181 --describe --topic my-topic # Produce in one shell vmstat -w -n -t 1 | kafka-console-producer --broker-list my-broker-host:9092 -- topic my-topic # Consume in a separate shell kafka-console-consumer --zookeeper my-zk-host:2181 --topic my-topic
  • 43. 43© Cloudera, Inc. All rights reserved. Kafka Configuration A starting point
  • 44. 44© Cloudera, Inc. All rights reserved. • Tune for throughput or safety • At least once or at most once • Per topic overrides and client overrides Flexible Configuration
  • 45. 45© Cloudera, Inc. All rights reserved. Broker Configuration • 3 or more Brokers • broker_max_heap_size=8GiB • zookeeper.chroot=kafka • auto.create.topics.enable=false • If you must use it make sure you set • num.partitions >= #OfBrokers • default.replication.factor=3 • min.insync.replicas=2 • unclean.leader.election=false (default)
  • 46. 46© Cloudera, Inc. All rights reserved. Producer Configuration • Use the new Java Producer • acks=all • retries=Integer.MAX_VALUE • max.block.ms=Long.MAX_VALUE • max.in.flight.requests.per.connection=1 • linger.ms=1000 • compression.type=snappy
  • 47. 47© Cloudera, Inc. All rights reserved. Consumer Configuration • Use the new Java Consumer • group.id represents the “Coordinated Application” • Consumers within the group share the load • auto.offset.reset = latest/earliest/none • enable.auto.commit=false
  • 48. 48© Cloudera, Inc. All rights reserved. Choosing Partition Counts: Quick Pick • Just getting started, don’t overthink it • Don’t make the mistake of picking (1 partition) • Don’t pick way too many (1000 partitions) • Often a handwave choice of 25 to 100 partitions is a good start • Tune when you can understand your data and use case better
  • 49. 49© Cloudera, Inc. All rights reserved. Make something Getting started is the hardest part What’s Next?
  • 50. 50© Cloudera, Inc. All rights reserved. Thank you
  • 51. 51© Cloudera, Inc. All rights reserved. Common Questions
  • 52. 52© Cloudera, Inc. All rights reserved. How do I size broker hardware? Brokers • Similar profile to data nodes • Depends on what’s important • Message Retention = Disk Size • Client Throughput = Network Capacity • Producer Throughput = Disk I/O • Consumer Throughput = Memory
  • 53. 53© Cloudera, Inc. All rights reserved. • Brokers: 3->15 per Cluster • Common to start with 3-5 • Very large are around 30-40 nodes • Having many clusters is common • Topics: 1->100s per Cluster • Partitions: 1->1000s per Topic • Clusters with up to 10k total partitions are workable. Beyond that we don't aggressively test. [src] • Consumer Groups: 1->100s active per Cluster • Could Consume 1 to all topics Kafka Cardinality—What is large?
  • 54. 54© Cloudera, Inc. All rights reserved. • Kafka is not designed for very large messages • Optimal performance ~10KB • Could consider breaking up the messages/files into smaller chunks Large Messages
  • 55. 55© Cloudera, Inc. All rights reserved. Should I use Raid 10 or JBOD? RAID10 • Can survive single disk failure • Single log directory • Lower total I/O JBOD • Single disk failure kills broker • More available disk space • Higher write throughput • Broker is not smart about balancing partitions across disk
  • 56. 56© Cloudera, Inc. All rights reserved. Do I need a separate Zookeeper for Kafka? • It’s not required but preferred • Kafka relies on Zookeeper for cluster metadata & state • Correct Zookeeper configuration is most important
  • 57. 57© Cloudera, Inc. All rights reserved. Zookeeper Configuration • ZooKeeper's transaction log must be on a dedicated device (A dedicated partition is not enough) for optimal performance • ZooKeeper writes the log sequentially, without seeking • Set dataLogDir to point to a directory on that device • Make sure to point dataDir to a directory not residing on that device • Do not put ZooKeeper in a situation that can cause a swap • Therefore, make certain that the maximum heap size given to ZooKeeper is not bigger than the amount of real memory available to ZooKeeper
  • 58. 58© Cloudera, Inc. All rights reserved. Choosing Partition Counts • A topic partition is the unit of parallelism in Kafka • It is easier to increase partitions than it is reduce them •Especially when using keyed messages •Consumers are assigned partitions to consume •They can’t split/share partitions •Parallelism is bounded by the number of partitions
  • 59. 59© Cloudera, Inc. All rights reserved. Choosing Partition Counts: Quick Pick • Just getting started, don’t overthink it • Don’t make the mistake of picking (1 partition) • Don’t pick way too many (1000 partitions) • Often a handwave choice of 25 to 100 partitions is a good start • Tune when you can understand your data and use case better
  • 60. 60© Cloudera, Inc. All rights reserved. Choosing Partition Counts: Estimation Given: • pt = production throughput per partition • ct = consumption throughput per partition • tt = total throughput you want to achieve • pc = the minimum partition count Then: • pc >= max(tt/pt, tt/ct)
  • 61. 61© Cloudera, Inc. All rights reserved. Choosing Partition Counts: Tools • Kafka includes rudimentary benchmarking tools to help you get a rough estimate • kafka-producer-perft-test.sh (kafka.tools.ConsumerPerformance) • kafka-consumer-perf-test.sh (kafka.tools.ProducerPerformance) • kafka.tools.EndToEndLatency • Use with kafka-run-class.sh • Nothing is more accurate than a real application • With real/representative data
  • 62. 62© Cloudera, Inc. All rights reserved. How do I manage Schemas? • A big topic with enough content for its own talk • Options •Schema Registry •Source Controlled Dependency •Static "Envelop Schema”
  • 63. 63© Cloudera, Inc. All rights reserved. Thank you