Kafka简介
-
Upload
fuqiang-wang -
Category
Technology
-
view
112 -
download
2
Transcript of Kafka简介
KAFKA简介陨⽯石@wacai.com
What Is The History?
Daemon Based Messaging
Tibco Rendezvous
Broker-Based Messaging
HOLD ON…
Broker-less Messaging
ZMQBrokerless
本质上,⽀支持多种通信协议和模式的消息框架
Actor Model
Messaging Scope
• Intra-Node
• Inter-Nodes
• Remoting
• Clustering
Broker Based Messaging
• JMS家族
• AMQP家族
JMS家族
消息模型
Point-To-Point Pub-Sub
相关产品
AMQP家族
消息模型
相关产品
Ultra Messaging
Todd L. Montgomery
理论模型
应⽤用模型
FAST 1. DISK FAVORED IO!2. Zero-Copy Transfer
SCALABLE PARTITIONING FOR SCALING READ&WRITE
DURABLE 1. REPLICA IN MIND!2. FLUSH PROPERLY
DISTRIBUTED FAULT-TOLERANCE!
KAFKA的应⽤用场景
KAFKA@Linkedin
KAFKA InternalsKafka集群拓扑结
构, 相关配置,结点之间的协调,消费管理,统统
我来管~
Zookeeper With Kafka
Message Producer
!
"
消息路由
props.put("partitioner.class", "xx.xxx.StringPrefixPartitioner")
class StringPrefixPartitioner(props:VerifiableProperties) extends kafka.producer.Partitioner{ def partition(key:Any, partitionNum:Int) : Int ={ hash(key.asInstanceOf[String].substring(0, 6)) % partitionNum } }
!
"
Message Consumer!
" High Level Consumer API
# Simple Consumer API
ConsumerGroup和Threads的关系
• 同⼀一consumer group中consumer线程的数量应该少于等于topic的partition的数量
• 同⼀一partition的数据会⼀一直分发给同⼀一个消费线程,但同⼀一个消费线程可能接收到来⾃自多个partition的数据
• 消费线程数量⼤大于topic的partition的数量的时候,有的消费线程不会接收到任何消息数据
Ops• Stabilize Zookeeper First
• Higher Scala-Versioned Distribution If Exists
• Bigger Disk, Faster RPM
• Higher file handle number limit
• Raise default Heap Size(1G), make it 2-4G at least
Conclusion
Use Kafka Wisely!
もんだい?