mqtt as a unified message bus for infrastructure services

16
MQTT as a Unified Message Bus for Infrastructure Services Matthew Treinish Open Source Developer Advocate - IBM [email protected] mtreinish on Freenode Jeremy Stanley [email protected] fungi on Freenode January 23, 2018 https://github.com/mtreinish/firehose/tree/lca2018

Upload: others

Post on 12-Apr-2022

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MQTT as a Unified Message Bus for Infrastructure Services

MQTT as a Unified Message Bus for Infrastructure Services

Matthew TreinishOpen Source Developer Advocate -

[email protected]

mtreinish on Freenode

Jeremy [email protected]

fungi on Freenode

January 23, 2018

https://github.com/mtreinish/firehose/tree/lca2018

Page 2: MQTT as a Unified Message Bus for Infrastructure Services

The problem

I The OpenStack community infrastructure operates >40 services on >250 serversI All the community infrastructure runs on donated public cloud resourcesI Some services depend on automation from othersI Several user facing services expose event busesI A real mess when you try to consume infrastructure events for any purpose

1 / 15

Page 3: MQTT as a Unified Message Bus for Infrastructure Services

OpenStack Community Infrastructure Firehose

I An MQTT broker for the OpenStackcommunity infrastructure

I Has anonymous, read-only access viaMQTT on 1883/tcp

I SSL/TLS MQTT also available on8883/tcp

I Websockets supported (buttemporarily disabled)

2 / 15

Page 4: MQTT as a Unified Message Bus for Infrastructure Services

MQTT

I Pub/sub messaging protocolI Formerly MQ Telemetry TransportI ISO/IEC 20922I Protocol dates back to 1999I Standard Maintained by OASISI Lightweight design, low bandwidth, and designed to handle unreliable networkingI Popular in IoT and sensor network applicationsI Large application ecosystem

3 / 15

Page 5: MQTT as a Unified Message Bus for Infrastructure Services

MQTT Clients

I Bindings available for most languagesI https://github.com/mqtt/mqtt.github.io/wiki/librariesI Eclipse Paho project provides similar interfaces across multiple languages

MQTT Brokers

I Relies on a central brokerI Many different options: https://github.com/mqtt/mqtt.github.io/wiki/servers

4 / 15

Page 6: MQTT as a Unified Message Bus for Infrastructure Services

MQTT Topics and Subscriptions

I Topics are generated dynamicallyI Topics are heirarchicalI Supports wildcarding

Examples:sensors/HOSTNAME/temperature/HDD_NAME

I sensors/sinanju/temperature/nvme0n1p1I sensors/+/temperature/+I sensors/sinanju/temperature/+I sensors/sinanju/#

5 / 15

Page 7: MQTT as a Unified Message Bus for Infrastructure Services

QoS

I 3 QoS Levels:I 0: The broker/client will deliver the message once, with no confirmation.I 1: The broker/client will deliver the message at least once, with confirmation

required.I 2: The broker/client will deliver the message exactly once by using a four step

handshake.

I QoS of a message sent with each PUBLISHI Client sends QoS with SUBSCRIBE

6 / 15

Page 8: MQTT as a Unified Message Bus for Infrastructure Services

The Firehose

I Runs Mosquitto MQTT brokerI Single broker instanceI Hardware Specs:

vCPUs 2CPU Frequency 2.6 GHz

RAM 2 GBswap 0 BDisk 40 GB

Bandwidth 200 Mbps

7 / 15

Page 9: MQTT as a Unified Message Bus for Infrastructure Services

Mosquitto

I MQTT broker implemented in CI An Eclipse IoT projectI Support for MQTT v3.1 and v3.1.1

8 / 15

Page 10: MQTT as a Unified Message Bus for Infrastructure Services

Services Using the Firehose

Service Base Topic Source of MessagesAnsible ansible Ansible MQTT Callback PluginGerrit gerrit germqtt

Launchpad launchpad lpmqttSubunit Gearman Worker gearman-subunit subunit-gearman-worker

Logstash Workers gearman-logstash logstash-gearman-worker

9 / 15

Page 11: MQTT as a Unified Message Bus for Infrastructure Services

Typical Firehose Load

10 / 15

Page 12: MQTT as a Unified Message Bus for Infrastructure Services

11 / 15

Page 13: MQTT as a Unified Message Bus for Infrastructure Services

Manually Load Testing

12 / 15

Page 14: MQTT as a Unified Message Bus for Infrastructure Services

CPU Usage: Memory Usage:

13 / 15

Page 15: MQTT as a Unified Message Bus for Infrastructure Services

Use cases for Firehose

I 3rd Party CI OperatorsI Desktop Notifications:

I mqttwarn: https://github.com/jpmens/mqttwarnI Inter Service communication:

I gerritbot: https://git.openstack.org/cgit/openstack-infra/gerritbot/I Graphing metrics:

I mqtt_statsd: https://git.openstack.org/cgit/openstack-infra/mqtt_statsdI grafana: http://grafana.openstack.org/dashboard/db/mosquitto-status

14 / 15

Page 16: MQTT as a Unified Message Bus for Infrastructure Services

Where to get more information

MQTT:I http://mqtt.org/I http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.htmlI https://mosquitto.org/I https://www.eclipse.org/paho/I #mqtt on FreenodeI https://github.com/mtreinish/pymqttbench

Firehose:I openstack-infra ML [email protected] #openstack-infra on FreenodeI http://docs.openstack.org/infra/system-config/firehose.htmlI https://docs.openstack.org/infra/system-config/firehose_schema.html

15 / 15