ZeroMQ

4,081 views

Published on

Using 0mq from Ruby.

Published in: Technology, Education
0 Comments
11 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
4,081
On SlideShare
0
From Embeds
0
Number of Embeds
22
Actions
Shares
0
Downloads
133
Comments
0
Likes
11
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • ZeroMQ

    1. 1. http://zero.mq/
    2. 2. A ØMQ socket is what you get whenyou take a normal TCP socket, injectit with a mix of radioactive isotopes stolen from a secret Soviet atomic research project, bombard it with1950-era cosmic rays, and put it into the hands of a drug-addled comic book author with a badly-disguised fetish for bulging muscles clad in spandex. Yes, ØMQ sockets are the world-saving superheros of the networking world.
    3. 3. Problem
    4. 4. How to easy connectany code to any code, anywhere
    5. 5. Existing solutions
    6. 6. Connect• In-process in-proc://some-point• Unix sockets ipc://some/pipe• BSD sockets tcp://0.0.0.0:1234• Others multicast (PGM) ...
    7. 7. BSD Sockets
    8. 8. BSD Protocols TCP * Images by Tenouk
    9. 9. BSD Protocols UDP TCP * Images by Tenouk
    10. 10. BSD Sockets • New/Exit - socket() , close() • Configure - setsockopt() • Connect - bind() , connect() • Use - send() , recv()
    11. 11. BSD Problems• Need to choice of transport• Stream (TCP) , datagram (UDP)• Peer-2-Peer connections
    12. 12. zguide.zero.mq
    13. 13. A ØMQ socket is what you get whenyou take a normal TCP socket, injectit with a mix of radioactive isotopes stolen from a secret Soviet atomic research project, bombard it with1950-era cosmic rays, and put it into the hands of a drug-addled comic book author with a badly-disguised fetish for bulging muscles clad in spandex. Yes, ØMQ sockets are the world-saving superheros of the networking world.
    14. 14. in a Hundred Words ØMQ (ZeroMQ, 0MQ, zmq) looks like an embeddable networking library but acts like a concurrency framework. It gives you sockets that carry whole messages acrossvarious transports like in-process, inter-process, TCP, and multicast. You can connect sockets N-to-N with patterns likefanout, pub-sub, task distribution, and request-reply. Its fast enough to be the fabric for clustered products. Its asynchronous I/O model gives you scalable multicoreapplications, built as asynchronous message-processing tasks. It has a score of language APIs and runs on most operating systems. ØMQ is from iMatix and is LGPL open source.
    15. 15. Many languages * Images by iMatrix
    16. 16. Sockets•Well known API•Messages oriented• Transport agnostic•Socket-level topology
    17. 17. Well known API
    18. 18. BSD Sockets • New/Exit - socket() • Configure - setsockopt() • Connect - bind() • Use - send() , recv()
    19. 19. Sockets• New/Exit - zmq_socket()• Configure - zmq_setsockopt()• Connect - zmq_bind()• Use - zmq_send() , zmq_recv()
    20. 20. Hello world (server)
    21. 21. Hello world (client)
    22. 22. Message oriented
    23. 23. Message oriented SendReceive
    24. 24. Various transports
    25. 25. Various transports• req.bind(‘inproc://some/pipe’)• req.bind(‘ipc://some/pipe’)• req.bind(’tcp://127.0.0.1:5555’)
    26. 26. PatternsSocket level topology
    27. 27. Request - Reply * Images by iMatrix
    28. 28. Publish - Subscribe * Images by iMatrix
    29. 29. Parallel tasks * Images by iMatrix
    30. 30. Demo
    31. 31. Scale
    32. 32. Start small * Images by iMatrix
    33. 33. Bigger * Images by iMatrix
    34. 34. And bigger... * Images by iMatrix
    35. 35. Devices Device * Images by iMatrix
    36. 36. QUEUE * Images by iMatrix
    37. 37. Demo
    38. 38. Implementation
    39. 39. Ruby-FFIForeign Function Interface
    40. 40. Ruby-FFI
    41. 41. Ruby-FFI (Win)
    42. 42. Why FFI?•Debian: no need from *-dev• Multi-platform• Easy to read (Ruby, not C)
    43. 43. Projectshttp://zeromq.org/docs:labs
    44. 44. http://mongrel2.org
    45. 45. Evolution App App App HTTP HTTP HTTP Net Net NetWebrick Mongrel Thin
    46. 46. Evolution App HTTP Net Mongrel2
    47. 47. Mongrel2Push/Pull 0mq Pub/Sub Handler Handler Responses HandlerRequests
    48. 48. Demo
    49. 49. Future• Part of Linux kernel• http://www.crossroads.io/• zerocloud ?
    50. 50. Thank you!

    ×