際際滷

際際滷Share a Scribd company logo
弌舒于仆亠仆亳亠 AMQP 亳 ZeroMQ


         仂仍亞舒亠于 仍亠从舒仆亟
    Principal Engineer at Mirantis
       adolgarev@mirantis.com
  http://kharkovpromenade.com.ua/
 亠仄
    舒亠仄 仂 仆亢仆仂 亳 从仂亞亟舒 仂 仆亠 仆亢仆仂
    RabbitMQ Hellow world
    Zmq Hellow world
    舒亶仄亠仄 亟亠仍仂仄: 亰舒亟舒舒 亳亰 亢亳亰仆亳
    亠仍舒亠仄 仆舒 RabbitMQ: 于亳亟 于亠
    亠仍舒亠仄 仆舒 Zmq: 于亳亟 弍仂从
    亠仍舒亠仄 仆舒 Zmq: HA, LB 亳 弍仍从亟亢亠从
    亰 仂仗舒: RabbitMQ 亳 Zmq  仆亠亟仂舒从亳
05/05/2012                                   2
舒亠仄 仂 仆亢仆仂 亳 从仂亞亟舒 仂 仆亠
                  仆亢仆仂



    仆舒仍仂亞亳  仗仂仂亶 (sound only)




05/05/2012                              3
RabbitMQ Hellow world




05/05/2012                           4
RabbitMQ Hellow world




05/05/2012                           5
RabbitMQ Hellow world




05/05/2012                           6
Zmq: 仗仂亟 从舒仗仂仂仄


        弌仂从亠 仆舒
         亠仂亳亟舒




05/05/2012                         7
Zmq Hellow world

     void *responder = zmq_socket (context,
      ZMQ_REP);
     zmq_bind (responder, "tcp://*:5555");
     zmq_recv (responder, &request, 0);
     zmq_send (responder, &reply, 0);
     zmq_close (responder);



05/05/2012                                     8
Zmq 亳仗 仂从亠仂于: REQ, REP




05/05/2012                           9
Zmq 亳仗 仂从亠仂于: DEALER,
                     ROUTER




05/05/2012                               10
舒亶仄亠仄 亟亠仍仂仄: 亰舒亟舒舒 亳亰 亢亳亰仆亳
仂亠仆 仄仆仂亞仂

                                       1) 仗仂仍仆亳 亰舒亟舒
        Websocket backend               2) 舒亟舒舒 亰舒仗亠仆舒         Manager
                                       7) 舒亟舒舒 于仗仂仍仆亠仆舒
       
     仂亠仆
     仄仆仂亞仂                 3) 仗仂仍仆亳 仗仂亟亰舒亟舒 1            2) 舒亟舒舒 亰舒仗亠仆舒
  4) 仂亟亰舒亟舒舒 1 于仗仂仍仆亠仆舒 4) 仂亟亰舒亟舒舒 1 于仗仂仍仆亠仆舒           7) 舒亟舒舒 于仗仂仍仆亠仆舒
  6) 仂亟亰舒亟舒舒 2 于仗仂仍仆亠仆舒 5) 仗仂仍仆亳 仗仂亟亰舒亟舒 2
                           6) 仂亟亰舒亟舒舒 2 于仗仂仍仆亠仆舒

                                                                  Event logger
             Appliance
                                       4) 仂亟亰舒亟舒舒 1 于仗仂仍仆亠仆舒
                                       6) 仂亟亰舒亟舒舒 2 于仗仂仍仆亠仆舒
         Subtask1 executor


         Subtask2 executor
                              仂亠仆
05/05/2012                   仄仆仂亞仂                                               11
亠仍舒亠仄: 亟仂弍舒于亳仄 弍仂从亠
仂亠仆 仄仆仂亞仂 



        Websocket backend                                                  Manager
                                                           2) 舒亟舒舒 亰舒仗亠仆舒
                                                       3) 仗仂仍仆亳 仗仂亟亰舒亟舒 1
                 1) 仗仂仍仆亳 亰舒亟舒                  5) 仗仂仍仆亳 仗仂亟亰舒亟舒 2
      仂亠仆 仄仆仂亞仂
                                                          7) 舒亟舒舒 于仗仂仍仆亠仆舒

                                                  Broker


                    4) 仂亟亰舒亟舒舒 1 于仗仂仍仆亠仆舒
                    6) 仂亟亰舒亟舒舒 2 于仗仂仍仆亠仆舒
                                                                          Event logger
                 Appliance

              Subtask1 executor
                                   仂亠仆 仄仆仂亞仂

 05/05/2012   Subtask2 executor                                                      12
亠仍舒亠仄 仆舒 RabbitMQ: 于亳亟 于亠




05/05/2012                       13
亠仍舒亠仄 仆舒 Zmq: 于亳亟 弍仂从




05/05/2012                              14
亠仍舒亠仄 仆舒 Zmq: 仂仗舒于从舒 亳
               仗仂仍亠仆亳亠 仂仂弍亠仆亳亶
               REQ
        App


                1) Message
                   2) OK

                                          ROUTER
                              Broker
                     ROUTER


                                  0) I am a websocket client for client N
                                              3) Message
                                                 4) OK



                                                                    App
                                                            REQ
05/05/2012                                                                  15
亠仍舒亠仄 仆舒 Zmq: LB
              REQ
  App                                                                            Zmq
                                                                                  仂弍亠仗亠亳于舒亠
                1) Message
                   2) OK
                                                                                  舒于仆仂仄亠仆仂亠
                                                                                  舒仗亠亟亠仍亠仆亳亠
                                                       Broker
                                                                   ROUTER
                                                                                  亰舒仗仂仂于
                          ROUTER
                                                       
                                                   n
                                                 ai
                                              Dom
                                                           0) I am a websocket client for client N
                                         r1                            3) Message
                                       fo
                                   s                                      4) OK
                              IP
                          2
                      
             Broker
                                                                                             App
                                                                                     REQ

05/05/2012                                                                                           16
亠仍舒亠仄 仆舒 Zmq: HA (仂 仆亠 LB!)
       App   REQ
                                                      仍亳 仆亠
                                                       仗仂仍亠仆 OK 仂
               1) Message                              弍仂从亠舒, 仂
                  2) OK
                                                       仗亠亠仍舒亠仄
                              Broker
                                          ROUTER       仂仂弍亠仆亳亠
                     ROUTER
   Linux heartbear
   & Virtual IP                 0) I am a websocket client for client N
                                             3) Message
                                                4) OK
                 Backup
                 Broker
                                                                  App
                                                           REQ

05/05/2012                                                                 17
亠仍舒亠仄 仆舒 Zmq: persistence 亳
                 亳仂亳
                                Message
                                 history (local &
                                 fast)
                                Persistent
                                 messages
                                 (remote &
                                 fsync & RAID)
                                  仗仂仄仂
                                 DRDB, AOE
                                 亳仍亳 nbd
05/05/2012                                   18
亰 仂仗舒: RabbitMQ - 仆亠亟仂舒从亳
    仂亢仆仂 仂亰亟舒 50 仗仂仂弍仂于 亟仂舒于从亳
     仂仂弍亠仆亳 仂 亳仂仆亳从舒 从 仗仂仍舒亠仍, 仆仂
     亠仍亳  于舒 51-亶 仍舒亶, 仂  于舒 仗仂弍仍亠仄
    仗仂仍亰亠 round-robin, 亠仍亳 仆亢仆仂 仂-仂
     仍仂亢仆亠亠, 仂  于舒 仗仂弍仍亠仄
    HA 亳 LB 亠 亳亰 从仂仂弍从亳, 仆仂 仂仆亳 亟舒仍亠从仂 仆亠
     亳亟亠舒仍仆,  于舒 仂仗 仗仂弍仍亠仄
    丐仂仍从仂 TCP, 亠仍亳 仆亢仆仂 仂-仂 仍仂亢仆亠亠
     (reliable multicast), 仂  于舒 仗仂弍仍亠仄

05/05/2012                                         19
亰 仂仗舒: Zmq - 仆亠亟仂舒从亳
    亢仆仂 仄仆仂亞仂亠 仗亳舒  仆仍
    亠亰仂仗舒仆仂 仆亢仆仂 仂亠于仍 仍亳弍仂 仆舒
     仂于亠仆 仆亳亢亠 (于仗仆 亳 .仗.) 仍亳弍仂 仆舒 仂于亠仆
     于亠 (亠亟于舒仄亳 仗仂仂从仂仍舒 仗亳从仍舒亟仆仂亞仂
     仂于仆)
    仂亟 仆舒亰舒亟 亠亠 弍仍舒 仆亠舒于亳仍仆仂亶, 仆仂
     亳舒亳 仍舒亠



05/05/2012                                       20
于仂亟
    亢仆仂 仍亳 于舒仄 仗仂仂于仂亠 仂亟亠仍亠仆亳亠?
    RabbitMQ 亞仂亟亳 于 95% 仍舒亠于, 仆仂 从舒从
     亟亠仍仂 亟仂仂亟亳 亟仂 仗仂亟舒从仆, 仂 仗亳仂亟亳
     亟仂仗亳仍亳于舒 仆舒仗亳仍仆亳从仂仄, 仂 亠亠 仍仂亢仆亠亠
     亠仄 于 仍舒亠  仂亰亟舒仆亳亠仄 于仂亠亞仂 亠亠仆亳
     仗仂于亠 zmq




05/05/2012                                     21
弌仗舒亳弍仂 亰舒 于仆亳仄舒仆亳亠, 仗仂舒于亠
        从亟舒-仆亳弍亟 仂亠仆从




05/05/2012                          22

More Related Content

Alexander Dolgarev "Comparizon of AMQP and Zero MQ"

  • 1. 弌舒于仆亠仆亳亠 AMQP 亳 ZeroMQ 仂仍亞舒亠于 仍亠从舒仆亟 Principal Engineer at Mirantis adolgarev@mirantis.com http://kharkovpromenade.com.ua/
  • 2. 亠仄 舒亠仄 仂 仆亢仆仂 亳 从仂亞亟舒 仂 仆亠 仆亢仆仂 RabbitMQ Hellow world Zmq Hellow world 舒亶仄亠仄 亟亠仍仂仄: 亰舒亟舒舒 亳亰 亢亳亰仆亳 亠仍舒亠仄 仆舒 RabbitMQ: 于亳亟 于亠 亠仍舒亠仄 仆舒 Zmq: 于亳亟 弍仂从 亠仍舒亠仄 仆舒 Zmq: HA, LB 亳 弍仍从亟亢亠从 亰 仂仗舒: RabbitMQ 亳 Zmq 仆亠亟仂舒从亳 05/05/2012 2
  • 3. 舒亠仄 仂 仆亢仆仂 亳 从仂亞亟舒 仂 仆亠 仆亢仆仂 仆舒仍仂亞亳 仗仂仂亶 (sound only) 05/05/2012 3
  • 7. Zmq: 仗仂亟 从舒仗仂仂仄 弌仂从亠 仆舒 亠仂亳亟舒 05/05/2012 7
  • 8. Zmq Hellow world void *responder = zmq_socket (context, ZMQ_REP); zmq_bind (responder, "tcp://*:5555"); zmq_recv (responder, &request, 0); zmq_send (responder, &reply, 0); zmq_close (responder); 05/05/2012 8
  • 9. Zmq 亳仗 仂从亠仂于: REQ, REP 05/05/2012 9
  • 10. Zmq 亳仗 仂从亠仂于: DEALER, ROUTER 05/05/2012 10
  • 11. 舒亶仄亠仄 亟亠仍仂仄: 亰舒亟舒舒 亳亰 亢亳亰仆亳 仂亠仆 仄仆仂亞仂 1) 仗仂仍仆亳 亰舒亟舒 Websocket backend 2) 舒亟舒舒 亰舒仗亠仆舒 Manager 7) 舒亟舒舒 于仗仂仍仆亠仆舒 仂亠仆 仄仆仂亞仂 3) 仗仂仍仆亳 仗仂亟亰舒亟舒 1 2) 舒亟舒舒 亰舒仗亠仆舒 4) 仂亟亰舒亟舒舒 1 于仗仂仍仆亠仆舒 4) 仂亟亰舒亟舒舒 1 于仗仂仍仆亠仆舒 7) 舒亟舒舒 于仗仂仍仆亠仆舒 6) 仂亟亰舒亟舒舒 2 于仗仂仍仆亠仆舒 5) 仗仂仍仆亳 仗仂亟亰舒亟舒 2 6) 仂亟亰舒亟舒舒 2 于仗仂仍仆亠仆舒 Event logger Appliance 4) 仂亟亰舒亟舒舒 1 于仗仂仍仆亠仆舒 6) 仂亟亰舒亟舒舒 2 于仗仂仍仆亠仆舒 Subtask1 executor Subtask2 executor 仂亠仆 05/05/2012 仄仆仂亞仂 11
  • 12. 亠仍舒亠仄: 亟仂弍舒于亳仄 弍仂从亠 仂亠仆 仄仆仂亞仂 Websocket backend Manager 2) 舒亟舒舒 亰舒仗亠仆舒 3) 仗仂仍仆亳 仗仂亟亰舒亟舒 1 1) 仗仂仍仆亳 亰舒亟舒 5) 仗仂仍仆亳 仗仂亟亰舒亟舒 2 仂亠仆 仄仆仂亞仂 7) 舒亟舒舒 于仗仂仍仆亠仆舒 Broker 4) 仂亟亰舒亟舒舒 1 于仗仂仍仆亠仆舒 6) 仂亟亰舒亟舒舒 2 于仗仂仍仆亠仆舒 Event logger Appliance Subtask1 executor 仂亠仆 仄仆仂亞仂 05/05/2012 Subtask2 executor 12
  • 13. 亠仍舒亠仄 仆舒 RabbitMQ: 于亳亟 于亠 05/05/2012 13
  • 14. 亠仍舒亠仄 仆舒 Zmq: 于亳亟 弍仂从 05/05/2012 14
  • 15. 亠仍舒亠仄 仆舒 Zmq: 仂仗舒于从舒 亳 仗仂仍亠仆亳亠 仂仂弍亠仆亳亶 REQ App 1) Message 2) OK ROUTER Broker ROUTER 0) I am a websocket client for client N 3) Message 4) OK App REQ 05/05/2012 15
  • 16. 亠仍舒亠仄 仆舒 Zmq: LB REQ App Zmq 仂弍亠仗亠亳于舒亠 1) Message 2) OK 舒于仆仂仄亠仆仂亠 舒仗亠亟亠仍亠仆亳亠 Broker ROUTER 亰舒仗仂仂于 ROUTER n ai Dom 0) I am a websocket client for client N r1 3) Message fo s 4) OK IP 2 Broker App REQ 05/05/2012 16
  • 17. 亠仍舒亠仄 仆舒 Zmq: HA (仂 仆亠 LB!) App REQ 仍亳 仆亠 仗仂仍亠仆 OK 仂 1) Message 弍仂从亠舒, 仂 2) OK 仗亠亠仍舒亠仄 Broker ROUTER 仂仂弍亠仆亳亠 ROUTER Linux heartbear & Virtual IP 0) I am a websocket client for client N 3) Message 4) OK Backup Broker App REQ 05/05/2012 17
  • 18. 亠仍舒亠仄 仆舒 Zmq: persistence 亳 亳仂亳 Message history (local & fast) Persistent messages (remote & fsync & RAID) 仗仂仄仂 DRDB, AOE 亳仍亳 nbd 05/05/2012 18
  • 19. 亰 仂仗舒: RabbitMQ - 仆亠亟仂舒从亳 仂亢仆仂 仂亰亟舒 50 仗仂仂弍仂于 亟仂舒于从亳 仂仂弍亠仆亳 仂 亳仂仆亳从舒 从 仗仂仍舒亠仍, 仆仂 亠仍亳 于舒 51-亶 仍舒亶, 仂 于舒 仗仂弍仍亠仄 仗仂仍亰亠 round-robin, 亠仍亳 仆亢仆仂 仂-仂 仍仂亢仆亠亠, 仂 于舒 仗仂弍仍亠仄 HA 亳 LB 亠 亳亰 从仂仂弍从亳, 仆仂 仂仆亳 亟舒仍亠从仂 仆亠 亳亟亠舒仍仆, 于舒 仂仗 仗仂弍仍亠仄 丐仂仍从仂 TCP, 亠仍亳 仆亢仆仂 仂-仂 仍仂亢仆亠亠 (reliable multicast), 仂 于舒 仗仂弍仍亠仄 05/05/2012 19
  • 20. 亰 仂仗舒: Zmq - 仆亠亟仂舒从亳 亢仆仂 仄仆仂亞仂亠 仗亳舒 仆仍 亠亰仂仗舒仆仂 仆亢仆仂 仂亠于仍 仍亳弍仂 仆舒 仂于亠仆 仆亳亢亠 (于仗仆 亳 .仗.) 仍亳弍仂 仆舒 仂于亠仆 于亠 (亠亟于舒仄亳 仗仂仂从仂仍舒 仗亳从仍舒亟仆仂亞仂 仂于仆) 仂亟 仆舒亰舒亟 亠亠 弍仍舒 仆亠舒于亳仍仆仂亶, 仆仂 亳舒亳 仍舒亠 05/05/2012 20
  • 21. 于仂亟 亢仆仂 仍亳 于舒仄 仗仂仂于仂亠 仂亟亠仍亠仆亳亠? RabbitMQ 亞仂亟亳 于 95% 仍舒亠于, 仆仂 从舒从 亟亠仍仂 亟仂仂亟亳 亟仂 仗仂亟舒从仆, 仂 仗亳仂亟亳 亟仂仗亳仍亳于舒 仆舒仗亳仍仆亳从仂仄, 仂 亠亠 仍仂亢仆亠亠 亠仄 于 仍舒亠 仂亰亟舒仆亳亠仄 于仂亠亞仂 亠亠仆亳 仗仂于亠 zmq 05/05/2012 21
  • 22. 弌仗舒亳弍仂 亰舒 于仆亳仄舒仆亳亠, 仗仂舒于亠 从亟舒-仆亳弍亟 仂亠仆从 05/05/2012 22