ThingsBoard is designed to distribute workload across multiple nodes without a single point of failure. Each ThingsBoard node is identical and can handle request from both device and server-side applications.
ThingsBoard Rule Engine allows to process messages from devices and trigger configurable processing modules called Plugins.
ThingsBoard contains set of core services that allow managing the following entities:
Rules and Plugins are able to invoke a certain subset of this APIs. For example, a rule can create an alarm for certain device.
Every ThingsBoard server provides REST API for registered users. Plugins are able to extend existing REST APIs and also handle websocket connections. For example:
Actor model enables high performant concurrent processing of messages from devices as long as server-side API calls. ThingsBoard uses Akka as an actor system implementation with following actor hierarchies.
The brief description of each actor’s functionality is listed below:
Plugin Actor - process incoming messages, and report results back to rule actor. Also, it handles server side requests. An instance of this actor is always present in memory.
Session Actor - represents a communication session between a device and ThingsBoard server. Sessions may be synchronous (HTTP, CoAP) and asynchronous (MQTT, CoAP with Observe option).
ThingsBoard uses Zookeeper for service discovery. All ThingsBoard nodes are identical and registered as ephemeral in Zookeeper. Apache Curator path cache receipt is used to keep track of all available sibling nodes.
ThingsBoard adopts consistent hashing to ensure scalability and availability. Message from Device A that is received on a particular node may be forwarded to the other node based on the hash of the device ID. Although this introduces certain networking overhead, it allows to process all messages from a particular device using corresponding device actor on a determined server, which introduces the following advantages:
The illustration below demonstrates how ThingsBoard handles RPC request to Device D1. In this case, the request arrives at Server A, but D1 is connected using MQTT to Server C. In the worst-case scenario, D1 Device Actor will be located on another server B that obviously does not match either A or C.
As a system administrator, you are able to configure ThingsBoard to use secure sockets layer for HTTP(s) and MQTT transports. DTLS for CoAP is not supported yet.
ThingsBoard is designed to support many types of device credentials. Current release provides support of token based credentials for all protocols and support of X.509 certificate based credentials for MQTT protocol. See MQTT over SSL guide for more details.
ThingsBoard uses following main third-party projects: