5 karma · joined Oct 27, 2019 (7y ago) · 1 submissions
comment 2y ago · link · parent
Basically, we have hundreds of thousands sensors connected through gateways that keep open TCP/IP connections to the Erlang/OTP distributed backend. We do bidirectional communication as we have many control functions, OTA firmware updates, etc.
There are frequent failures which we handle with supervision trees and “let it fail” design principles. Failures are due to:
* Gateways which are connected through cellular networks with varying signal strength conditions.
* Sensors failing and providing incorrect data (eg. invalid float binaries).
* Buggy firmware in some 3rd party gateways / sensors.
* Buggy firmware in our own gateways and sensors ;-)
I highly recommend Elrang/OTP due to:
* Fault tolerance - processes fail, nodes carry on.
* Concurrency model (mailboxes, linking processes via supervision trees, monitors, trapping, etc)
* Built-in distribution and related modules in standard library
* Pattern matching which makes processing binary data super convenient
* Mnesia database (if used for right things)