ActiveMQ;RabbitMQ;ZeroMQ
中間件類型:
-
Embedded middleware: As the name suggests, this typeof middleware handles embedded applications (software or firmware)。
-
RPC middleware: RPC (Remote Procedure Call)middleware communicates with applications using calls。
-
Object request broker: Here, applications can sendand receive objects, like CORBA。
-
SQL-oriented data access middleware: Primarily meantfor database-related applications, this class of middleware sits betweenapplications that communicate with databases, like JDBC,ODBC。
-
Message-oriented middleware(MOM): Message-oriented middleware mediate thecommunication or messages, between applications。
常見的三款開源消息中間件:
ActiveMQ
ActiveMQ是Apache開發(fā)的開源消息中間件,Java實現(xiàn),基于JMS1.1及J2EE 1.4規(guī)范。RabbitMQ
RabbitMQ 是由 LShift 提供的一個 Advanced MessageQueuing Protocol (AMQP) 的開源實現(xiàn),由以高性能、健壯以及可伸縮性出名的 Erlang 寫成,因此也是繼承了這些優(yōu)點。ZeroMQ
ZeroMQ是由iMatix公司使用C語言開發(fā)的高性能消息中間件,是對socket的封裝,在發(fā)送端緩存消息。ActiveMQ架構
-
Queue Region是P2P消息模型,Topic Region是Publish/Subscribe模型。
-
Connectors負責消息通信,支持OpenWire, Stomp,REST,WS Notification, XMPP等協(xié)議。
-
Network Services負責存儲轉發(fā),集群等服務。
-
Message Store負責消息的存儲,支持內存、文件、內嵌數(shù)據(jù)庫和外部數(shù)據(jù)庫等四種消息持久化方式。
ActiveMQ特點?
支持多語言:Java, C, C++,C#, Ruby, Perl, Python, PHP
消息模型:
Point to Point Publish/Subscribe協(xié)議支持情況:?
支持OpenWire,Stomp,REST,WS Notification,XMPP。 對于python僅支持Stomp 協(xié)議。 不支持AMQP協(xié)議。 支持STOMP 1.0,不支持STOMP 1.1。?支持Spring,可以很容易集成到Spring,并用Spring腳本配置。
支持Clustering built-in with autodiscovery,可以互相自動發(fā)
有Apache的支持,持續(xù)發(fā)展的優(yōu)勢明顯。
支持Python的clients,都是很微小的開源項目,編程較復雜,不靈活:
Pyactivemq——基本已經不在維護,活躍度為低。 stomppy——推薦使用,rhel還有相應的rpm包,活躍度為中。?需要消息服務器存儲轉發(fā)消息。
消息延時是10ms級別。?
RabbitMQ架構
-
RabbitMQ包括虛擬主機(virtualhost),交換機(exchange),隊列(queue)和綁定(binding)四個概念。
-
virtualhost:持有一組exchange、queue及bingding,可以做權限控制。
-
Queue:存放消息,由consumer建立,并綁定到Exchange。
-
Exchange:根據(jù)綁定的規(guī)則進行消息轉發(fā)。
-
Binding:綁定規(guī)則。
RabbitMQ特點
AMQP協(xié)議的開源實現(xiàn),使用Erlang編寫,維護時有語言障礙。
通過plugin完全支持STOMP 協(xié)議。
有Vmware的支持,RabbitMQ在云計算領域應該會有更多的特殊支持,架構會更適合云應用。
有SpringSource的商業(yè)支持,包括技術支持,培訓。
支持持久化,不過只能使用它自己的數(shù)據(jù)庫,不能使用mysql等。
Python客戶端是pika,編程靈活簡單;java的客戶端編程靈活簡單
需要消息服務器存儲轉發(fā)消息。
消息延時是10ms級別。
ActiveMQ與RabbitMQ性能測試對比
持久化性能對比
非持久化性能對比
ZerorMQ特點
-
是對socket的封裝與擴展,API和socket編程的方式基本一致,支持請求-響應、Publish/Subscribe等消息模式。
-
僅支持異步I/O,為了提高性能通過新建的線程發(fā)送消息。
-
不需要單獨的消息服務器來存儲轉發(fā)消息,重點放在消息的傳輸上,性能高于TCP。
-
支持C, C++, Java,Python等20多種語言。Java的開發(fā)包是jzmq,python的開發(fā)包是pyzmq。
-
消息延時是微秒級別。
-
由imatix開發(fā),并可以提供支持與培訓。 imatix 是AMQP協(xié)議最初的creator,并開發(fā)了開源的OpenAMQ ,但是在2010年imatix 宣布iMatix to drop OpenAMQ support by 2011, AMQP it now believes it is “fundamentally flawed and unfixable”。目前主要將精力集中到ZeroMQ。
zeroMQ——摘自zguide
-
Itturns out that building reusable messaging systems is really difficult, whichis why few FOSS projects ever tried, and why commercial messaging products arecomplex, expensive, inflexible, and brittle. In 2006 iMatix designed AMQP whichstarted to give FOSS developers perhaps the first reusable recipe for amessaging system. AMQP works better than many other designs butremains relatively complex, expensive, and brittle.It takes weeks to learn to use, and months to create stable architectures thatdon't crash when things get hairy.
-
Mostmessaging projects, like AMQP, that try to solve this long list of problems ina reusable way do so by inventing a new concept, the "broker", thatdoes addressing, routing, and queuing. This results in a client-server protocolor a set of APIs on top of some undocumented protocol, that let applicationsspeak to this broker. Brokers are an excellent thing in reducing the complexityof large networks. But addingbroker-based messaging to a product like Zookeeper would make it worse, notbetter. It would mean adding an additional big box, and a new single point offailure. A broker rapidly becomes a bottleneck and a new risk to manage. Ifthe software supports it, we can add a second, third, fourth broker and makesome fail-over scheme. People do this. It creates more moving pieces, more complexity,more things to break.
-
Anda broker-centric set-up needs its own operations team. You literally need towatch the brokers day and night, and beat them with a stick when they startmisbehaving. You need boxes, and you need backup boxes, and you need people tomanage those boxes. It is only worth doing for large applications with manymoving pieces, built by several teams of people, over several years.
-
Sosmall to medium application developers are trapped. Either they avoid networkprogramming, and make monolithic applications that do not scale. Or they jumpinto network programming and make brittle, complex applications that are hardto maintain. Or they bet on a messaging product, and end up with scalableapplications that depend on expensive, easily broken technology. There has beenno really good choice, which is maybe why messaging is largely stuck in thelast century and stirs strong emotions. Negative ones for users, gleeful joyfor those selling support and licenses.
| ? | ActiveMQ | RabbitMQ | ZeroMQ |
| 遵循規(guī)范 | JMS1.1及J2EE 1.4 | AMPQ | --- |
| 架構模型 | 消息代理架構Broker | 消息代理架構Broker | C/S架構 |
| 實現(xiàn)語言 | Java | Erlang | C/C++ |
| 支持消息協(xié)議 | Stomp | AMPQ、Stomp等 | --- |
| 主要推動力量 | Apache、Redhat | Lshift、Vmware、SpringSource | iMatix |
| 支持編程語言 | C,Java,Python | C,Java,Python | C,Java,Python |
| 編程復雜度 | 復雜 | 簡單 | 中等 |
| 持久化 | 支持 | 支持,不支持第三方數(shù)據(jù)庫 | 發(fā)送端緩存 |
| 性能 | Normal | Normal | High |
| 內存使用率 | High | High | Normal |
?
轉載于:https://www.cnblogs.com/kamil/p/5376556.html
總結
以上是生活随笔為你收集整理的ActiveMQ;RabbitMQ;ZeroMQ的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: memcpy实例(一)
- 下一篇: Unity3D去掉全屏时的屏幕黑边