Run batch jobs during a low energy consumption period – Sustainability in Serverless

Amazon DynamoDB pricing AWS Certification Exam Microsoft Exams Software Architecture

Run batch jobs during a low energy consumption period

Nightly batch jobs that perform data consolidation, engineering analysis, business analytics, payment settlements, and other tasks are common in many organizations. Working with AWS, identify the quieter periods in your cloud Region and schedule your batch jobs during those hours. Batch jobs usually have a predictable load and are ideal for provisioning resources in an efficient way.

Data and Storage

Data drives our lives in the modern digital world. Data-driven has become a common term in boardrooms—data-driven decisions, data-driven marketing, data-driven design, data-driven culture, data-driven thinking, data-driven mindset, etc., are some of the many variants you may hear.

Every time you share data, you initiate countless data operations via the digital equip‐ ment you hold. Capturing, storing, and processing data requires cloud computing, storage, and network capabilities, and these resources consume energy. As data trav‐ els through the vastness of the cloud, it leaves a carbon footprint in our environment. Hence, for a sustainable serverless application, it’s essential to think about and care for your data.

In many organizations and teams, data is commonly overlooked and forgotten once it has served its purpose. Unless the storage services are expensive enough to make a dent in your monthly cloud bill, engineers become casual with data.

If the data you consume is not valuable or you do not need a piece of data, don’t store it.

Propagating data retention requests

When you work with a distributed event-driven microservices architecture where data ownership is isolated to individual microservices, aligning data lifetime across the application is challenging. If you hold on to the data longer than is necessary, it violates sustainability principles. If you delete it too soon, failures are likely when the services coordinate to perform a distributed task. Word of mouth, email, chat messages, and design documents are common approaches teams adopt to propagate data retention dependencies. In an event-driven architecture, you can use events to carry such information. When you emit a domain event, if the event has data signifi‐ cance, you can add data retention indicator attributes to reflect these details, as shown in Example 10-1. The applications that subscribe and react to these events can use these indicators to align their data retention policies. (Make sure the recommended data retention value aligns with legal and regulatory requirements!)

Example 10-1. A sample event that contains attributes to specify the data retention mandate

{

“detail”: {

“metadata”: {

“version”: “1.0”,

“domain”: “PAYMENTS”,

“service”: “payment-authorization”,

“category”: “domain-event”,

“type”: “data”,

“retention_period”: 28,

“retention_unit”: “day”

},

“data”: {

// payment authorization data

}

}

}

Leave a Reply

Your email address will not be published. Required fields are marked *