MQTC v2017 Intro To Kafka
MQTC v2017 Intro To Kafka
2
Involved in “MQ” since early 90’s
Primarily at the technology layer
Various certifications
1993
6. Many more…
Other Legacy
Systems
Wanted a system that was not restricted by the past and exploited
technologies commonly available
Key requirements
High speed
Fault tolerant
Infinitely scalable
Distributed access
https://kafka.apache.org
In the rest of this presentation, we will introduce Kafka concepts which will
demonstrate how it achieves these objectives
Consumer
Producer Producer Producer
Broker Kafka
Connectors
Cluster
Stream Processor
Connectors
Logs
Topic: “Green”
Producer1
0 1 2 3 4 5 6 7 8 9
Consumer1
Offset
Did you expect this result? Probably not if you are thinking of IBM MQ
which only publishes messages for that topic if a subscription exists when
published
o The messages in Kafka do not go away simply because they were read by a
consumer like a queue (more later)
0 1 2 3 4 5 6 7 8 9
Consumer1
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 8 9 10 11 12
Consumer1
Consumer1
0 1 2 3 4 5 6 7 8 9
Producer1 0 1 2 3 Consumer1
0 1 2 3 4 5 6 7
0 1 2 3 4 5
0 1 2 3 4 5 6 7 8 9
Producer1 0 1 2 3 Consumer1
0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7
0 1 2 3 4
❖ Custom Partitioner
0 1 2 3
0 1 2 3 4
Producer1 0 1 2 3 Consumer1
0 1 2 3 4
0 1 2 3 4 5 6 7 8
0 1 2 3 4 5 6 7 8
0 1 2 3
Producer1 Consumer1
0 1 2 3 4
X
be reestablished (why 3
Producer1 0 1 2 3
servers was inadequate)
0 1 2 3 4
0 1 2 3 4 5 6 7 8
Consumer1
0 1 2 3 4 5 6 7 8
0 1 2 3
Producer1 Consumer1
0 1 2 3 4
3 partitions
Leaders
Replicas (leader and followers)
In Sync Replicas
Apache Zookeeper
Coordinates the state of Kafka for the brokers, publishers and consumers
Consumer groups
Adding Partitions
Adding Topics
Streaming processes
0 1 2 3 4 5 6 7 8 9
Producer1 0 1 2 3 Consumer1
Producer1
Producer1
0 1 2 3 4 5 6 7 Consumer2
0 1 2 3 4 5 6 7 8 9 Consumer1
Consumer3
Producer1 0 1 2 3
Producer1
0 1 2 3 4 5 6 7 Consumer2
Consumer4
Excess consumers have nothing to process
❖ log.retention.(hours|minutes|ms)
❖ Default is 1 week
❖ log.retention.bytes
Asynch Send
Max inflight
Synchronous
All writes complete with verification
Partition Assignment
Commit Strategy
Batch size
Rebalancing
Runaway producers
“Poison” messages
Partitioner Effectiveness
Rebalance
producer.send(record);
producer.close();
‘Guaranteed’ messaging
MQ Connector
https://github.com/ibm-messaging/kafka-connect-mq-source
MQ Bridge (Bluemix)
Kafka can and will integrate with your existing applications creating a
hybrid messaging environment
Kafka has advantages to MQ for some message patterns but may not work
for all