排队排队!——kafka
什么是kafka
不是《变形虫》的作者。
Kafka起源于LinkedIn,使用scala语言实现。
是一个分布式的、分区的、多复本的日志提交服务。
作为消息队列使用,类似RabbitMQ等。
负载高,可横向扩展。
可靠性较低,无排序,无确认。
RPC协议使用Avro,thrift协议。
Jakfa,java版本。
kafka的架构
Kafka体系中有三种身份,Kafka只作为Broker。
Zookeeper作为集群管理,收集Consumer,Broker的信息,提
供查询。
producer推给broker,consumer从broker拉,broker是被动的。
Kafka可以分多副本,支持容灾。
消息分topic,不同的topic分不同的队列。同一topic,可以分
为多个partition,分为不同的队列中。
consumer分组,一组可以有多个。一个消息只能被一组消费
一次。不同组可以重复消费。
最多一次,至少一次,恰好一次。
生产者
生产者要连接Kafka,需要保持和每个partition的leader的连接。
没有路由。
当一个topic分为多个partition时,producer需要指定partition。
生产者主动推送过去。
批量插入broker,速度快。
消息不要求时效性,不要求事务。
多副本的存在,只要消息插入到broker,就认为不会丢失。
接受的消息量一般随生产者的增加线性增加。
代理者
被动,基本只维护队列。
分topic,每topic分多个partition,每个partition可以多副本,
有一个leader。leader尽量分散。
消息顺序写硬盘,分几个固定大小或者按照时间删掉旧的。
按照offset来分发消息,不保存offset的信息(zookeeper)。
In-Sync Replica,保证延迟不会太大。
可迁移topic,增加分区副本,或者增加分区。
只解决”fail/recover”,不处理“Byzantine”问题。
消费者
一个消费者,绑定一个partition。一个partition,只能有一个
消费者。
通过zookeeper拿offset。
可以重设offset,特别适合灾难恢复。
消费者要到zookeeper连接,指定组id。
发送fetch到broker,并告知offset,broker返回。
API连接方便,指定zookeeper就可以。
当consumer或者broker数目变化时候,会导致连接的重新分配。
consumer的commit,会改变offset,可在执行前也可在执行后。
flume的架构
类似。
cloudera的产品。

More Related Content

PDF
Java类加载器
PPTX
PDF
맛만 보자 Finagle이란
PPTX
java thrift
PPTX
Microservices in the Enterprise
PDF
RPC protocols
PPTX
Avro - More Than Just a Serialization Framework - CHUG - 20120416
PDF
Protobuf & Code Generation + Go-Kit
Java类加载器
맛만 보자 Finagle이란
java thrift
Microservices in the Enterprise
RPC protocols
Avro - More Than Just a Serialization Framework - CHUG - 20120416
Protobuf & Code Generation + Go-Kit

Viewers also liked (18)

PDF
OpenFest 2016 - Open Microservice Architecture
PDF
3 avro hug-2010-07-21
PPTX
G rpc lection1_theory_bkp2
PPTX
G rpc lection1
PPTX
RPC: Remote procedure call
PPTX
HTTP2 and gRPC
PPTX
아파치 쓰리프트 (Apache Thrift)
PDF
Building High Performance APIs In Go Using gRPC And Protocol Buffers
PDF
3 apache-avro
PDF
Enabling Googley microservices with HTTP/2 and gRPC.
PDF
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
PDF
gRPC: The Story of Microservices at Square
PDF
Msa読書会#3前半
PDF
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
PPTX
Apache kafka
PDF
Apache big data 2016 - Speaking the language of Big Data
PDF
Driving containerd operations with gRPC
PDF
GRPC 101 - DevFest Belgium 2016
OpenFest 2016 - Open Microservice Architecture
3 avro hug-2010-07-21
G rpc lection1_theory_bkp2
G rpc lection1
RPC: Remote procedure call
HTTP2 and gRPC
아파치 쓰리프트 (Apache Thrift)
Building High Performance APIs In Go Using gRPC And Protocol Buffers
3 apache-avro
Enabling Googley microservices with HTTP/2 and gRPC.
Introduction to gRPC - Mete Atamel - Codemotion Rome 2017
gRPC: The Story of Microservices at Square
Msa読書会#3前半
Robert Kubis - gRPC - boilerplate to high-performance scalable APIs - code.t...
Apache kafka
Apache big data 2016 - Speaking the language of Big Data
Driving containerd operations with gRPC
GRPC 101 - DevFest Belgium 2016
Ad

More from chernbb (10)

PPTX
Flume
PPTX
预测 副本
PPTX
Hbase拾荒者
PPTX
hadoop中的懒人Hive
PPTX
大数据保险 副本
PPTX
我们需要你是这样的
PPTX
抱着马云大腿谈谈管理
PPTX
微服务
PPT
谈谈小米的营销
PPTX
大数据 数据挖掘
Flume
预测 副本
Hbase拾荒者
hadoop中的懒人Hive
大数据保险 副本
我们需要你是这样的
抱着马云大腿谈谈管理
微服务
谈谈小米的营销
大数据 数据挖掘
Ad

排队排队--kafka