SlideShare una empresa de Scribd logo
1 de 22
Сравнение 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

Más contenido relacionado

Más de Mirantis

How to Accelerate Your Application Delivery Process on Top of Kubernetes Usin...
How to Accelerate Your Application Delivery Process on Top of Kubernetes Usin...How to Accelerate Your Application Delivery Process on Top of Kubernetes Usin...
How to Accelerate Your Application Delivery Process on Top of Kubernetes Usin...Mirantis
 
Kubernetes Security Workshop
Kubernetes Security WorkshopKubernetes Security Workshop
Kubernetes Security WorkshopMirantis
 
Using Kubernetes to make cellular data plans cheaper for 50M users
Using Kubernetes to make cellular data plans cheaper for 50M usersUsing Kubernetes to make cellular data plans cheaper for 50M users
Using Kubernetes to make cellular data plans cheaper for 50M usersMirantis
 
How to Build a Basic Edge Cloud
How to Build a Basic Edge CloudHow to Build a Basic Edge Cloud
How to Build a Basic Edge CloudMirantis
 
Securing Your Containers is Not Enough: How to Encrypt Container Data
Securing Your Containers is Not Enough: How to Encrypt Container DataSecuring Your Containers is Not Enough: How to Encrypt Container Data
Securing Your Containers is Not Enough: How to Encrypt Container DataMirantis
 
What's New in Kubernetes 1.18 Webinar Slides
What's New in Kubernetes 1.18 Webinar SlidesWhat's New in Kubernetes 1.18 Webinar Slides
What's New in Kubernetes 1.18 Webinar SlidesMirantis
 
Comparison of Current Service Mesh Architectures
Comparison of Current Service Mesh ArchitecturesComparison of Current Service Mesh Architectures
Comparison of Current Service Mesh ArchitecturesMirantis
 
Your Application Deserves Better than Kubernetes Ingress: Istio vs. Kubernetes
Your Application Deserves Better than Kubernetes Ingress: Istio vs. KubernetesYour Application Deserves Better than Kubernetes Ingress: Istio vs. Kubernetes
Your Application Deserves Better than Kubernetes Ingress: Istio vs. KubernetesMirantis
 
Demystifying Cloud Security Compliance
Demystifying Cloud Security ComplianceDemystifying Cloud Security Compliance
Demystifying Cloud Security ComplianceMirantis
 
Mirantis life
Mirantis lifeMirantis life
Mirantis lifeMirantis
 
OpenStack and the IoT: Where we are, where we're going, what we need to get t...
OpenStack and the IoT: Where we are, where we're going, what we need to get t...OpenStack and the IoT: Where we are, where we're going, what we need to get t...
OpenStack and the IoT: Where we are, where we're going, what we need to get t...Mirantis
 
Boris Renski: OpenStack Summit Keynote Austin 2016
Boris Renski: OpenStack Summit Keynote Austin 2016Boris Renski: OpenStack Summit Keynote Austin 2016
Boris Renski: OpenStack Summit Keynote Austin 2016Mirantis
 
Digital Disciplines: Attaining Market Leadership through the Cloud
Digital Disciplines: Attaining Market Leadership through the CloudDigital Disciplines: Attaining Market Leadership through the Cloud
Digital Disciplines: Attaining Market Leadership through the CloudMirantis
 
Decomposing Lithium's Monolith with Kubernetes and OpenStack
Decomposing Lithium's Monolith with Kubernetes and OpenStackDecomposing Lithium's Monolith with Kubernetes and OpenStack
Decomposing Lithium's Monolith with Kubernetes and OpenStackMirantis
 
OpenStack: Changing the Face of Service Delivery
OpenStack: Changing the Face of Service DeliveryOpenStack: Changing the Face of Service Delivery
OpenStack: Changing the Face of Service DeliveryMirantis
 
Accelerating the Next 10,000 Clouds
Accelerating the Next 10,000 CloudsAccelerating the Next 10,000 Clouds
Accelerating the Next 10,000 CloudsMirantis
 
Containers for the Enterprise: It's Not That Simple
Containers for the Enterprise: It's Not That SimpleContainers for the Enterprise: It's Not That Simple
Containers for the Enterprise: It's Not That SimpleMirantis
 
Protecting Yourself from the Container Shakeout
Protecting Yourself from the Container ShakeoutProtecting Yourself from the Container Shakeout
Protecting Yourself from the Container ShakeoutMirantis
 
It's Not the Technology, It's You
It's Not the Technology, It's YouIt's Not the Technology, It's You
It's Not the Technology, It's YouMirantis
 
OpenStack as the Platform for Innovation
OpenStack as the Platform for InnovationOpenStack as the Platform for Innovation
OpenStack as the Platform for InnovationMirantis
 

Más de Mirantis (20)

How to Accelerate Your Application Delivery Process on Top of Kubernetes Usin...
How to Accelerate Your Application Delivery Process on Top of Kubernetes Usin...How to Accelerate Your Application Delivery Process on Top of Kubernetes Usin...
How to Accelerate Your Application Delivery Process on Top of Kubernetes Usin...
 
Kubernetes Security Workshop
Kubernetes Security WorkshopKubernetes Security Workshop
Kubernetes Security Workshop
 
Using Kubernetes to make cellular data plans cheaper for 50M users
Using Kubernetes to make cellular data plans cheaper for 50M usersUsing Kubernetes to make cellular data plans cheaper for 50M users
Using Kubernetes to make cellular data plans cheaper for 50M users
 
How to Build a Basic Edge Cloud
How to Build a Basic Edge CloudHow to Build a Basic Edge Cloud
How to Build a Basic Edge Cloud
 
Securing Your Containers is Not Enough: How to Encrypt Container Data
Securing Your Containers is Not Enough: How to Encrypt Container DataSecuring Your Containers is Not Enough: How to Encrypt Container Data
Securing Your Containers is Not Enough: How to Encrypt Container Data
 
What's New in Kubernetes 1.18 Webinar Slides
What's New in Kubernetes 1.18 Webinar SlidesWhat's New in Kubernetes 1.18 Webinar Slides
What's New in Kubernetes 1.18 Webinar Slides
 
Comparison of Current Service Mesh Architectures
Comparison of Current Service Mesh ArchitecturesComparison of Current Service Mesh Architectures
Comparison of Current Service Mesh Architectures
 
Your Application Deserves Better than Kubernetes Ingress: Istio vs. Kubernetes
Your Application Deserves Better than Kubernetes Ingress: Istio vs. KubernetesYour Application Deserves Better than Kubernetes Ingress: Istio vs. Kubernetes
Your Application Deserves Better than Kubernetes Ingress: Istio vs. Kubernetes
 
Demystifying Cloud Security Compliance
Demystifying Cloud Security ComplianceDemystifying Cloud Security Compliance
Demystifying Cloud Security Compliance
 
Mirantis life
Mirantis lifeMirantis life
Mirantis life
 
OpenStack and the IoT: Where we are, where we're going, what we need to get t...
OpenStack and the IoT: Where we are, where we're going, what we need to get t...OpenStack and the IoT: Where we are, where we're going, what we need to get t...
OpenStack and the IoT: Where we are, where we're going, what we need to get t...
 
Boris Renski: OpenStack Summit Keynote Austin 2016
Boris Renski: OpenStack Summit Keynote Austin 2016Boris Renski: OpenStack Summit Keynote Austin 2016
Boris Renski: OpenStack Summit Keynote Austin 2016
 
Digital Disciplines: Attaining Market Leadership through the Cloud
Digital Disciplines: Attaining Market Leadership through the CloudDigital Disciplines: Attaining Market Leadership through the Cloud
Digital Disciplines: Attaining Market Leadership through the Cloud
 
Decomposing Lithium's Monolith with Kubernetes and OpenStack
Decomposing Lithium's Monolith with Kubernetes and OpenStackDecomposing Lithium's Monolith with Kubernetes and OpenStack
Decomposing Lithium's Monolith with Kubernetes and OpenStack
 
OpenStack: Changing the Face of Service Delivery
OpenStack: Changing the Face of Service DeliveryOpenStack: Changing the Face of Service Delivery
OpenStack: Changing the Face of Service Delivery
 
Accelerating the Next 10,000 Clouds
Accelerating the Next 10,000 CloudsAccelerating the Next 10,000 Clouds
Accelerating the Next 10,000 Clouds
 
Containers for the Enterprise: It's Not That Simple
Containers for the Enterprise: It's Not That SimpleContainers for the Enterprise: It's Not That Simple
Containers for the Enterprise: It's Not That Simple
 
Protecting Yourself from the Container Shakeout
Protecting Yourself from the Container ShakeoutProtecting Yourself from the Container Shakeout
Protecting Yourself from the Container Shakeout
 
It's Not the Technology, It's You
It's Not the Technology, It's YouIt's Not the Technology, It's You
It's Not the Technology, It's You
 
OpenStack as the Platform for Innovation
OpenStack as the Platform for InnovationOpenStack as the Platform for Innovation
OpenStack as the Platform for Innovation
 

Сравнение AMQP и ZeroMQ

  • 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