I’m pleased to announce improved load balancing for applications within the Watson IoT Platform.
The IoT Platform extends MQTT 3.1.1 with shared subscriptions. This allows you to have multiple instances of an application connect to the platform and share out the message workload between them. This ability to add more instances of an application allows you to scale beyond the workload that a single application instance can handle.
This new functionality (available in beta) allows you to use those shared subscriptions with CleanSession = false. (This is often referred to as a durable subscription.) That means that the server will retain state for application instances that are disconnected. That state includes status of in flight messages and subscriptions. If an instance of your application goes offline, messages will be redirected to other instances. If all your application instances go down, then the platform will keep messages and deliver them when the application reconnects.
To take advantage of this, you need to connect using an upper case ‘A’ in your application id and add an instance id:
The state will be stored against that instance id and allows the platform to recognize that individual application instance when it reconnects.
In the example below, three application instances subscribe to all device events using topic iot-2/type/+/id/+/evt/+/fmt/+ and connecting with A:orgId:appId:instanceId. The three instances will each get a share of the events to process.
For full details see the documentation.
This is Beta capability and we welcome feedback on the features and usability.