forked from Green-Software-Foundation/patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Direct conversion of @srini1978 submitted version from https://github…
….com/Green-Software-Foundation/green-software-patterns-dev/blob/3082514aefa56b1688775e603bdc0532320f390f/docs/catalog/web/Use%20async%20network%20calls.md Wording has been fixed a bit.
- Loading branch information
Markus Seidl
committed
Jan 17, 2023
1 parent
458b7ae
commit 374d867
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
version: 1.0 | ||
submitted_by: srini1978, markus-ntt-seidl | ||
published_date: TBD | ||
category: web | ||
tags: | ||
- web | ||
--- | ||
|
||
# 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 lesser energy consumed. | ||
|
||
## 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 energy consumed is reduced | ||
- `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 | ||
|
||
[PATTERN_CONSIDERATIONS] | ||
|
||
## References | ||
|
||
- Async/Await (https://en.wikipedia.org/wiki/Async/await) | ||
- Optimize Peak and Average CPU utilization (https://patterns.greensoftware.foundation/catalog/cloud/optimize-avg-cpu-utilization) |