Upgrade to Pro — share decks privately, control downloads, hide ads and more …

ZeroMQ - Toolkit for high-performance distribut...

Sponsored · SiteGround - Reliable hosting with speed, security, and support you can count on. →

ZeroMQ - Toolkit for high-performance distributed applications

Zdeslav Vojkovic

October 05, 2014

Transcript

31 slides
  1. WHAT IS ZEROMQ? not an MQ! networking and concurrency library

    asynchronous messaging routing/topology aware brokerless high performance multiple transports cross-platform numerous bindings (client libs) LGPL licensed
  2. PERFORMANCE Low latency, high throughput Zero-copy, reference counted Batching Configurable

    through socket options RabbitMQ: 4500 msg/s -> ZeroMQ: 250,000 msg/s apples to oranges (but similar use case with transient messages)
  3. ZEROMQ API Objects: context, socket, message Flow: create context >

    bind/connect > send/receive # s e r v e r p r o c e s s c o n t e x t = z m q . C o n t e x t ( 1 ) s o c k e t = c o n t e x t . s o c k e t ( z m q . P U B ) s o c k e t . b i n d ( " t c p : / / * : 5 5 5 6 " ) s o c k e t . s e n d ( " s o m e e v e n t " ) # c l i e n t p r o c e s s c o n t e x t = z m q . C o n t e x t ( ) s o c k e t = c o n t e x t . s o c k e t ( z m q . S U B ) s o c k e t . c o n n e c t ( " t c p : / / s e r v e r : 5 5 5 6 " ) e v e n t _ d a t a = s o c k e t . r e c v ( )
  4. TRANSPORTS # s e r v e r p r

    o c e s s c o n t e x t = z m q . C o n t e x t ( 1 ) s o c k e t = c o n t e x t . s o c k e t ( z m q . P U B ) # s o c k e t . b i n d ( " t c p : / / * : 5 5 5 6 " ) s o c k e t . b i n d ( " i p c : / / / t m p / f e e d s / 0 " ) s o c k e t . s e n d ( " s o m e e v e n t " ) # c l i e n t p r o c e s s c o n t e x t = z m q . C o n t e x t ( ) s o c k e t = c o n t e x t . s o c k e t ( z m q . S U B ) # s o c k e t . c o n n e c t ( " t c p : / / l o c a l h o s t : 5 5 5 6 " ) s o c k e t . c o n n e c t ( " i p c : / / / t m p / f e e d s / 0 " ) e v e n t _ d a t a = s o c k e t . r e c v ( )
  5. PATTERN: CLIENT-SERVER Sockets: REQ/REP c o n t e x

    t = z m q . C o n t e x t ( 1 ) s o c k e t = c o n t e x t . s o c k e t ( z m q . R E Q ) s o c k e t . c o n n e c t ( " t c p : / / l o c a l h o s t : 5 5 5 6 " ) s o c k e t . s e n d ( " s o m e e v e n t " ) r e p l y = s o c k e t . r e c v ( ) # b l o c k s

More Decks by Zdeslav Vojkovic

Other Decks in Programming