83
中中中中中中中中中 中中 Von Gosling@web world MOM those things Message-Oriented Middleware

Mom those things v1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Mom those things v1

中间件基础服务团队 鼬神Von Gosling@web world

MOM those things

Message-Oriented Middleware

Page 2: Mom those things v1

Agenda

•Part 1 MOM intro. MOM spec.•Part 2 MOM core tech. MOM advanced features

. Part 3 MOM geomancy References

Page 3: Mom those things v1

Part 1

MOM intro.I. whyII. whatIII. when

MOM spec.IV. JMSV. AMQPVI. STOMPVII. XMPPVIII. MQTT

Page 4: Mom those things v1

MOM intro. - why

1970s single protocol connecting mainframe

Page 5: Mom those things v1

MOM intro. - why

1980s many protocol connecting mainframe

Page 6: Mom those things v1

MOM intro. - why

• not easy since data format , hardware etc.• so adapter coms out, but still face many problems, maintainable?

• so many technologies comes out , such as

RPC(COM/COM+,CORBA,EJB) – sync. call Message Queue – Async. event notification

Also ,many Enterprise messaging killer coming, such as WebSphere MQ, SonicMQ , TIBCO Rendezvous, SUN JCAPS…

Page 7: Mom those things v1

MOM intro. - what

Message-oriented middleware (MOM) is

software or hardware infrastructure supporting

sending and receiving messages between

distributed systems. MOM allows application

modules to be distributed over heterogeneous

platforms and reduces the complexity of

developing applications that span multiple

operating systems and network protocols…

-- From Wikipedia

Page 8: Mom those things v1

MOM intro. - what

Messaging mediator

Page 9: Mom those things v1

MOM intro. - when

Heterogeneous application integration

Decoupled between applications(No RPC)

Event-driven backbone(CEP)

Page 10: Mom those things v1

MOM spec. - JMS

•JMS 1.1 released in in 2002 (JMS 1.0.2 spec. since 1998)•JMS 2.0 launched in 2011 as JSR 343•JMS 2.0 released in 2013 (with Java EE 7)

Page 11: Mom those things v1

MOM spec - JMS

JMS client (MessageProducer, MessageConsumer , JMSConsumer , JMSProducer)Non-JMS client (Instead of the JMS API , using JMS provider’s native client API)JMS producerJMS consumerJMS providerJMS messageJMS domainsAdministered objects(Connection factory,Destination)

Page 12: Mom those things v1

MOM spec - JMS

MessageConsumer glance

Page 13: Mom those things v1

MOM spec. - JMS

Non-JMS client - HornetQ

Page 14: Mom those things v1

MOM spec - JMS

JMS message

Page 15: Mom those things v1

MOM spec. - JMS

Page 16: Mom those things v1

MOM spec. - JMS

How to use it ? Selector(SQL 92 subset ,exactly any retrieval tech. you can image)

Page 17: Mom those things v1

MOM spec - JMS

Payload

Page 18: Mom those things v1

MOM spec. - JMS

JMS domains PK.

Page 19: Mom those things v1

MOM spec. - JMS

JMS 1.1 Core API

Page 20: Mom those things v1

MOM spec. - JMS

Page 21: Mom those things v1

MOM spec. - JMS

Snippet with JMS 1.1 spec.

Page 22: Mom those things v1

MOM spec. - JMS

Snippet with JMS 2.0 spec.

Page 23: Mom those things v1

MOM spec - JMS

Concurrency ConnectionFactory,Connection,Destination

Session,MessageProducer,MessageConsumer

Page 24: Mom those things v1

MOM spec. - AMQP

2012.10 1.0 release

Page 25: Mom those things v1

MOM spec. - AMQP

Page 26: Mom those things v1

MOM spec. - AMQP

•Types•Transport•Messaging•Transactions•Security

Page 27: Mom those things v1

MOM spec. - AMQP

Class Diagram of Communication Endpoints

Page 28: Mom those things v1

MOM spec. - AMQP

Version Negotiation examples

Page 29: Mom those things v1

MOM spec - AMQP

Protocol frames

Page 30: Mom those things v1

MOM spec - AMQP

AMQP Frame Layout

Page 31: Mom those things v1

MOM spec - AMQP

AMQP connection state Diagram

Page 32: Mom those things v1

MOM spec - AMQP

AMQP message

Page 33: Mom those things v1

MOM spec - AMQP

How to parser ?

Page 34: Mom those things v1

MOM spec - AMQP

How to use ?

Page 35: Mom those things v1

MOM spec. - STOMP

STOMP 1.2 Released on 2012 10STOMP 1.1STOMP 1.0

In a way, It’s seems combing memcached protocol with REST style operation(such as send,subscribe,unsubscribe,begin,commit,abort,ack,nack,disconnect).

Page 36: Mom those things v1

Part 2

MOM core tech.I. TransportII. PersistentIII. TransactionIV. Integration

MOM advanced featuresV. HAVI. PerformanceVII. Administering and monitoringVIII. Plugins

Page 37: Mom those things v1

MOM core tech. - Transport

AMQ Transport configuration snippets

Page 38: Mom those things v1

MOM core tech. - Transport

AMQ log

Page 39: Mom those things v1

MOM core tech. - Transport

Hornetq Transport configuration snippets

Page 40: Mom those things v1

MOM core tech. - Persistent

RDB storeMemory store File store

Sequential disk access can in some cases be faster than random memory access! – from ACM Queue article

Page 41: Mom those things v1

MOM core tech. - Persistent

Page 42: Mom those things v1

MOM core tech. - Persistent

Page 43: Mom those things v1

MOM core tech. - Persistent

File store structure

Page 44: Mom those things v1

MOM core tech. - Persistent

AMQ store structure

Page 45: Mom those things v1

MOM core tech. - Transaction

Page 46: Mom those things v1

MOM core tech. - Transaction

Page 47: Mom those things v1

MOM core tech. - Transaction

2PC , 3PC or Paxos Why not choice?

Complex, Round Trip…

Page 48: Mom those things v1

MOM Core Tech. - Transaction

Client DB

Broker DB

①send

half m

essa

ge

②Op

③Com

mit/R

ollb

ack ①store half message

③ ⑤,commit: update message statusrollback: delete message

④perio

dic ch

eck

unco

mm

itted m

essa

ge

⑤Commit/Rollback

Local Tx

Local Tx

Page 49: Mom those things v1

MOM core tech. - Integration

Jetty,TomcatHadoopStormESBServiceMix

Page 50: Mom those things v1

MOM advanced features- HA

Static DiscoveryDynamic Discovery – ZK/UDP/JGROUP

Master-MasterMaster-Slave

Page 51: Mom those things v1

MOM advanced features- HA

Shared store

Page 52: Mom those things v1

MOM advanced features- HA

Replication

Page 53: Mom those things v1

MOM advanced features- HA

Which one?

Page 54: Mom those things v1

MOM advanced features- Performance

Broker performanceClient performance

TCP kernelProtocol

Page 55: Mom those things v1

MOM advanced features- Performance

Broker performance

Static scales better than dynamic Asynchronous network connection

establishment Concurrent store and dispatch Store optimization

Page 56: Mom those things v1

MOM advanced features- Performance

Client performance setDisableMessageID setDisableMessageTimeStamp Avoid ObjectMessage Avoid AUTO_ACKNOWLEDGE Avoid durable messages Send messages non blocking ProducerWindowSize(sendFailIfNoSp

aceAfterTimeout) Prefetch limit

Page 57: Mom those things v1

MOM advanced features- Performance

TCP kernel

Page 58: Mom those things v1

MOM advanced features- Performance

Protocol

OpenWire Text-based

No silver bullet...

Page 59: Mom those things v1

MOM advanced features- Performance

Page 60: Mom those things v1

MOM advanced features- Performance

Performance differs greatly depending on many different factors the network topology transport protocols used quality of service hardware, network, JVM and operating system number of producers, number of consumers distribution of messages across destinations

along with message size

So, No one is absolutely winner!Benchmark testing(SPECjms2007) is a Galileo thing !

Page 61: Mom those things v1

MOM advanced features- Administering and monitoring

MetricsMDCJMX-HTTP

Page 62: Mom those things v1

MOM advanced features- Plugins

RouterVisualizationStatistics

Page 63: Mom those things v1

MOM advanced features- Plugins

Router

Page 64: Mom those things v1

MOM advanced features- Plugins

Statistics

Page 65: Mom those things v1

MOM advanced features- Plugins

AMQ plugins architecture

Page 66: Mom those things v1

MOM advanced features- Plugins

AMQ - How plugins work

Page 67: Mom those things v1

Part3

MOM geomancyI. ZMQII. Local features continueIII. Cloud Messaging

References

Page 68: Mom those things v1

MOM geomancy - ZMQ

C++ Networking library

ZMQ Pattern:

Request-reply, which connects a set of clients to a set of services. This is a remote procedure call and task distribution pattern.Publish-subscribe, which connects a set of publishers to a set of subscribers. This is a data distribution pattern.Pipeline, which connects nodes in a fan-out/fan-in pattern that can have multiple steps and loops. This is a parallel task distribution and collection pattern.

Page 69: Mom those things v1

MOM geomancy - ZMQ

Page 70: Mom those things v1

MOM geomancy - ZMQ

Page 71: Mom those things v1

MOM geomancy - ZMQ

Page 72: Mom those things v1

MOM geomancy - ZMQ

ØMQ’s Built-in Proxy Function code snippet

Page 73: Mom those things v1

MOM geomancy - local features continue

Close to latest stable spec. ,such as JMS 2.0,AMQP 1.0,STOMP 1.2 etc.;Promote communication kernel ,such as AIO, Actor pattern etc.;Full stack PUSH model , support web, android, ios etc.;More Cloud features… MQ

(Broker)Broker WebSocket Connection

Service

WebSocket Engine

JMSWebSocket

HTTPServer

Java* Application

JMS Client Runtime

WebSocket Connection Handler

Java API for WebSocket Tyrus Implementation

Page 74: Mom those things v1

MOM geomancy - local features continue

Kestrel kernel

Page 75: Mom those things v1

MOM geomancy - local features continue

But, if you biased towards jms,How to give your views about jms ?•Join and contribute to [email protected] •Submit ideas to JMS spec issue tracker (or comment on existing ideas)•Contact [email protected]•See jms-spec.java.net for details

Page 76: Mom those things v1

MOM geomancy - Cloud Messaging

Page 77: Mom those things v1

MOM geomancy - Cloud Messaging

Page 78: Mom those things v1

MOM geomancy - References

Page 79: Mom those things v1

MOM geomancy - References

•http://en.wikipedia.org/wiki/Message-oriented_middleware

•http://augustl.com/blog/2013/zeromq_instead_of_http/

•http://kafka.apache.org/documentation.html#design

•http://www.oschina.net/translate/client-side-messaging-essentials

•http://www.iron.io/mq

•http://java.dzone.com/articles/guaranteed-messaging-topics

•http://download.progress.com/5331/open/adobe/prc/psc/perf_tuning_a

ctivemq/index.htm

•http://www.cs.cornell.edu/courses/cs614/2007fa/Slides/FLP_and_Paxos.

pdf

Page 80: Mom those things v1

MOM geomancy - References

•Enterprise Integration with WSO2 ESB

•http://lingo.codehaus.org/

•http://activespace.codehaus.org/

•https://engineering.groupon.com/2013/page/2/

•http

://blog.x-aeon.com/2013/04/10/a-quick-message-queue-benchmark-acti

vemq-rabbitmq-hornetq-qpid-apollo

/

•http://www.slashroot.in/linux-network-tcp-performance-tuning-sysctl

•http://activemq.apache.org/performance.html

•http://

activemq.apache.org/apollo/documentation/openwire-manual.html

•http://snarfed.org/transactions_across_datacenters_io.html

Page 81: Mom those things v1

MOM geomancy - References

•JMS Performance Comparison

•amqp-core-complete-v1.0-os.pdf

•HornetQ User Manual.pdf

•ActiveMQ In Action(Manning-2011).pdf

•Building a High Availability and Disaster Recovery Solution using

AlwaysOn Availability Groups.docx

•RocketMQ_design.pdf

•ZeroMQ: Messaging for Many Applications.pdf

•ZeroMQ.pdf

Page 82: Mom those things v1

Q & A

你问我答

共创,共建

Questions?

Page 83: Mom those things v1

Thanks!