RabbitMQ由浅入深

主流的中间件介绍

ActiveMQ

  • Apche出版的,最流行的,能力强劲的开源消息总线,并且它可以完全的支持JMS规范的消息中间件

  • 其丰富的API,多种集群构建模式让它成为业界的老牌消息队列中间件,在小型企业中使用比较的广泛

  • MQ衡量的指标:服务性能、数据存储、集群架构

缺点

  • 不适用当今的高并发的数据时代,在大规模的数据下,会严重的阻塞并且延迟,消息堆积

  • 小型中间件

集群的架构模式

KafKa

Kafka是Linkedln开源的分布式发布-订阅小心系统,目前归属于Apache顶级项目。Kafka主要的特点就是基于PULL的模式来处理消费,追求高吞吐量,一开始的目的就是用于日志的收集和传输的,0.8版本开始支持复制,不支持事物,对消息的重复、丢失、错误没有严格的要求、适合产生大量数据的互联网服务的数据收集业务。单机支持每秒100k的数据量。

Kafka常规集群模式

RocketMQ

RocketMQ是阿里开源项目的消息中间件,目前已经孵化为Apache顶级项目,它是纯JAVA开发,具有高吞吐量、高可用、适合大规模分布式系统应用的特点。RocketMQ思路起源于Kafka,它对于消息的可靠传输及其事务性做了优化,目前在阿里集团中被广泛的应用于交易、充值、流计算、消息推送,日志流式处理、binlog分发等。

  • 适合运用在超大规模的分布式应用系统中

  • 借鉴了Kafka的设计模式

  • 早起使用Zookeeper后期自己开发了一套nameserver

  • 顺序消费,实时消息,承载上亿的消息堆积

  • 唯一缺点商业版是收费的

集群的架构模式

RabbitMQ

RabbitMQ是使用Erlang语言开发的开源消息队列系统

为甚RabbitMQ高性能

Erlang语言最初使用在交换机领域的架构模式,这样使得RabbitMQ在Broker之间进行数据交互的性能很优秀。开发作者用Erlang制作了一个网络交换机的程序发现Erlang有很好的性能

  • Erlang有着和原生的Socket一样的延迟

  • 消息入到MQ中的延迟和响应吞吐量

AMQP入门

  • AMQP -> Advanced Message Queuing Protocl (高级小心队列协议)

定义:是一个具有现代特征的二进制协议特征,一个统一小心服务的应用层标准高级的小心队列协议,也是应用层的一个开放标准,为面向消息的中间件设计,也是一个标准的协议

  • Server -> 又称为Broker,接受客户端的连接,实现AMQP实体的服务

  • Connection -> 连接,application和broke建立网络连接

  • Channel -> 网络信道,几乎是所有的操作都在Channel中进行,Channel是进行消息读写的通道,客户端可以建立多个Channel,每一个Channel代表一个会话的任务(常规的增删改查都通过它)

  • Message -> 消息,服务器和应用之间传输数据,由于Properties和Body组成。Properties可以对消息进行修饰,如消息的优先级、延迟或其他高级的特性。Body是消息体内容

  • Virtual host -> 虚拟地址,用于进行逻辑隔离,最上层的消息路由,由于一个Virtual Host里面可以有若干个Exchange和Queue,但是同一个Virtual Host中不能有同名的Exchange和Queue

运行模式

RabbitMQ由浅入深》有5个想法

  1. I would like to show some appreciation to you just for rescuing me from this type of instance. Right after researching through the world wide web and obtaining solutions which were not beneficial, I assumed my entire life was over. Being alive without the presence of answers to the problems you’ve resolved as a result of the article content is a critical case, and ones which may have in a negative way affected my entire career if I hadn’t encountered your blog post. Your main expertise and kindness in handling every aspect was priceless. I am not sure what I would have done if I had not come upon such a thing like this. It’s possible to at this moment look forward to my future. Thanks so much for this reliable and sensible help. I will not be reluctant to suggest your web blog to anyone who wants and needs guidelines on this situation.

  2. I am just commenting to let you understand of the notable discovery my wife’s daughter encountered reading your site. She picked up too many things, which included how it is like to possess an awesome teaching spirit to make most people with ease grasp specified multifaceted matters. You truly exceeded readers’ desires. Thank you for coming up with those useful, healthy, educational not to mention fun thoughts on this topic to Jane.

  3. I and also my friends ended up analyzing the great things found on the blog and then developed an awful suspicion I never thanked the web site owner for those secrets. These young men appeared to be absolutely joyful to learn them and have in effect simply been tapping into those things. Thanks for truly being really helpful and then for deciding upon variety of helpful tips most people are really eager to be informed on. My sincere regret for not saying thanks to earlier.

发表评论