Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Asynchronous Calls instead of sync when doing Network calls #76 #209

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions docs/catalog/cloud/use-async-instead-of-sync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
version: 1.0
submitted_by: srini1978, markus-ntt-seidl
published_date: TBD
category: cloud
tags:
- cloud
- size:medium
---

# Use Asynchronous network calls instead of synchronous

## Description

When making calls across process boundaries to either databases or file systems or REST APIs, use asynchronous calling patterns compared to synchronous calls.

## Solution

Using asynchronous patterns frees the calling thread from being blocked on the response and hence additional work is achieved without CPU cycles being consumed. Therefore this pattern drives optimal utilization of the CPU and Memory cycles contributing to reduced energy consumption.

## SCI Impact

`SCI = (E * I) + M per R`
[Software Carbon Intensity Spec](https://grnsft.org/sci)

This pattern affects the SCI as follows:

- `E`: This pattern drives optimal utilization of the CPU, hence reducing energy consumption.
- `M`: Optimized average CPU utilization can reduce the amount of resources needed which will decrease the amount of embodied carbon required to support.

## Assumptions

- The specific library for making asynchronous calls is available in the language being used for web development. E.g Task parallel library in C#.

## Considerations

- Consider higher level patterns for asynchronous communication as well, for example Queues, Topics and Streams

## References

- Async/Await (https://en.wikipedia.org/wiki/Async/await)
- [Azure Well-Architected Framework Sustainability Pillar](https://learn.microsoft.com/en-us/azure/architecture/framework/sustainability/sustainability-application-design)