Software and architecture optimization
IOTSUS01: How do you optimize software and firmware to reduce device's carbon footprint? |
---|
Reducing the carbon footprint of IoT devices requires a multi-faceted approach to software optimization throughout the system stack. At the core operating system and firmware level, best practices focus on creating lean, streamlined images that exclude unnecessary bloat. This involves using tools to build custom images containing only the minimum required modules and libraries to support the device's functionality. Techniques like event-driven architectures, efficient programming languages, hardware accelerators, and optimized logging further improve performance and reduce processing overhead. Over-the-air update capabilities allow extending product lifetimes through software updates rather than full device replacements.
Moving up the stack, application-layer best practices concentrate on intelligent edge processing and bandwidth reduction. This includes filtering, aggregating, and enriching data locally to minimize cloud transmission. Adopting efficient data formats, compression, adaptive power management, and message buffering and spooling policies can significantly reduce network traffic. Leveraging AWS IoT services can help with optimizing data ingestion and device management as well as help with implementing sustainability-focused features like carbon footprint monitoring.
IOTSUS01-BP01 Eliminate unnecessary modules, libraries, and processes
Verify that the operating system only runs essential processes that are necessary for the functionality of the IoT device.
Level of risk exposed if this best practice is not established: Low
Prescriptive guidance
Unnecessary libraries, modules, and processes contribute to a larger device footprint, increase patching requirements, and create a larger attack surface and more processes for the CPU to run.
Choose efficient programming languages that satisfy your business requirements. Programming language choice has an impact on device requirements as well as active and sleep cycles. Programming languages vary in areas such as memory management, typing, and parallelism. It is recommended to design and test as much as possible prior to making a final decision on language.
Produce a more efficient and secure IoT device design by streamlining the operating system and only including essential processes.
Use projects like Yocto or Buildroot to build custom Linux images containing only the necessary modules for device functionality, and build device software like AWS IoT Greengrass or the AWS IoT Device Client into these custom images using layers like the meta-aws Yocto layer.
IOTSUS01-BP02 Use AWS IoT features to optimize network usage and power consumption
Select AWS IoT service features which can help to optimize network and power resources.
Level of risk exposed if this best practice is not established: Medium
Prescriptive guidance
Use AWS IoT Device Shadow services, which are virtual representations of IoT devices in the cloud. Device shadows enable decoupled bi-directional communication between the device and applications running in the cloud. Applications can obtain device state from the shadow rather than the device, reducing traffic between the device and cloud, and allowing the application to continue operation even if the device is disconnected intermittently. When a device comes back online, it can check if there were any changes requested by the application while it was offline, and take action as needed. This allows the device to stay offline, saving power.
Use MQTT retained messages, message expiry, and session expiry features. Retained messages and Device Shadows both retain data from a device but have different capabilities and suitability. MQTT5 message expiry can be used to make sure that devices only receive time-relevant messages, reducing processing load. The session expiry feature can be used by MQTT clients to set application-specific session expiry limits, making sure that the broker does not need to retain resources beyond what is needed.
IOTSUS01-BP03 Use a hardware watchdog to restart your device automatically
IoT devices should have a hardware watchdog mechanism, which can reduce downtime by automatically restarting the device when it becomes unresponsive. In many cases, restarting the device can put it in a state where it can be remotely managed, minimizing the impact of failures and reducing the need for site visits.
Level of risk exposed if this best practice is not established: Low
Prescriptive guidance
Choose processors that include a hardware watchdog and that are well supported by vendor software solutions.
IOTSUS01-BP04 Implement resilient and scalable system behavior for clients communicating with the cloud
Clients communicating with the cloud must not only be functionally correct, but also implement resilient and scalable system behavior. Implementing such behavior reduces the work done by each client device and reduces network traffic and doing so can improve device longevity and total lifetime energy consumption.
Level of risk exposed if this best practice is not established: Medium
Prescriptive guidance
Support
exponential
backoff with jitter
Minimize the number of connection attempts when dealing with a congested network, reducing the work done by each client and reducing network traffic.
Define a threshold at which point it is more effective to enter low power modes during a backoff period.
Support MQTTv5 reason codes and use that information to determine if and when to reconnect.