Skip to content

Commit

Permalink
Update eshoppen.md
Browse files Browse the repository at this point in the history
Included the changes for the Energy and Embodied emissions values for the database server.
  • Loading branch information
srini1978 authored and atg-abhishek committed May 12, 2022
1 parent 4ae041d commit 55f4e59
Showing 1 changed file with 114 additions and 18 deletions.
132 changes: 114 additions & 18 deletions case-studies/eshoppen.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* The eShop Web application is a web application built on Asp.Net .It is built with monolithic architecture and follows MVC Design pattern
* The application uses a relational database for storing data
* The business use cases built demonstrates a simplified eCommerce site.
* The case study focuses on calculating the Software Carbon Intensity (SCI) value of the application **_at the app server level_** using the [formula](https://github.com/Green-Software-Foundation/software_carbon_intensity/blob/main/Software_Carbon_Intensity/Software_Carbon_Intensity_Specification.md#methodology-summary) as defined in the latest version of the [specification](https://github.com/Green-Software-Foundation/software_carbon_intensity/blob/main/Software_Carbon_Intensity/Software_Carbon_Intensity_Specification.md)
* The case study focuses on calculating the Software Carbon Intensity (SCI) value of the application using the [formula](https://github.com/Green-Software-Foundation/software_carbon_intensity/blob/main/Software_Carbon_Intensity/Software_Carbon_Intensity_Specification.md#methodology-summary) as defined in the latest version of the [specification](https://github.com/Green-Software-Foundation/software_carbon_intensity/blob/main/Software_Carbon_Intensity/Software_Carbon_Intensity_Specification.md)

The Software Carbon Intensity (SCI) is a rate, carbon emissions per one unit of R. The equation used to calculate the SCI value of a software system is:

Expand All @@ -22,13 +22,17 @@ All the elements in the SCI equation scale by the same functional unit of “R

## Architecture

* An architecture diagram of the system described in this use case
* Technical details of the components in the architecture
* Textual description with technical details of each component provided in the architecture diagram
The architecture consists of the following components.
* App Service plan: An App Service plan provides the managed virtual machines (VMs) that host your app. All apps associated with a plan run on the same VM instances.

**TODO: Add arch diagram**
* App Service app: Azure App Service is a fully managed platform for creating and deploying cloud applications.

We did Load Test runs with Azure App service Premium configuration with 2 core – 7 GB RAM and calculated the power consumed in these runs. The tests are meant to be a model only and can be extended to more infrastructure configurations. Database power and embodied emissions values of the database were not included in calculations .
* Azure SQL Database: SQL Database is a relational database-as-a-service in the cloud. SQL Database shares its code base with the Microsoft SQL Server database engine. Depending on your application requirements, you can also use Azure Database for MySQL or Azure Database for PostgreSQL. These are fully managed database services based on the open-source MySQL Server and Postgres database engines.


![image](https://user-images.githubusercontent.com/10396742/162613391-f27ed693-84df-4c70-a17a-479d7288a57a.png)

We did Load Test runs with Azure App service Premium configuration with 2 core – 7 GB RAM and database server of Gen 5 Processor and calculated the power consumed in these runs. The tests are meant to be a model only and can be extended to more infrastructure configurations.

## (What) Software boundary

Expand All @@ -37,16 +41,17 @@ We did Load Test runs with Azure App service Premium configuration with 2 core
### Included

* App server for the Web application
* Database server

### Excluded

This case study is focused on hardware efficiency at the app server alone and hence the following components and their carbon emissions have been excluded from the SCI calculation.
The following components and their carbon emissions have been excluded from the SCI calculation.

* Front end browser .This is the browser client on the device that is displaying the application to the end users on their desktop/mobile/laptop etc._Will be added in the next version of the case study_
* Network traffic between browser client and application server ._We have the numbers in terms of the byte size that travelled across the network but don’t have the reference multiplication factor in terms of carbon emissions associated per byte. We have requested this info from SCI open data project_
* Network traffic between application servers and databases. _We have the numbers in terms of the byte size that travelled across the network but don’t have the reference multiplication factor in terms of carbon emissions associated per byte. We have requested this info from SCI open data project_
* Test infrastructure: These include the load test resources that were used to simulate virtual users and http requests to the web server._Since the infrastructure and the associated energy usage do not fit into the same functional unit scale as defined in the SCI formula, these components will be excluded from the software’s SCI calculation._

* Front end web application .This is the browser client that is displaying the application to the end users on their desktop/mobile/laptop etc.
* Network traffic between browser client and application server
* Network traffic between application servers and databases
* Database server
* Test infrastructure: These include the load test resources that were used to simulate virtual users and http requests to the web server.Since the infrastructure and the associated energy usage do not fit into the same functional unit scale as defined in the SCI formula, these components are excluded from the software’s SCI calculation.

## (Scale) Functional Unit

Expand All @@ -71,10 +76,56 @@ The equation used to model the energy consumption is:

P[kwH] = (Power consumed by CPU or Pc Number of cores + Power consumed by Memory or Pr + Power consumed by GPU or Pg Number of GPUs)/1000

* Utilization doesn’t scale linearly with power consumption, we will use the power curve as described in the [SCI Data Project “[E] Energy Estimation from Utilization Model” model](https://docs.google.com/spreadsheets/d/1Viv94rMKH-fJrfD9Nn9_qkiAg1PDfIfJUAHRX9slG7A/edit#gid=526989613)
* From specs, we found that Power consumed by 4GB memory is close to 1.45 W and that by 8 GB memory is approximately 2.45 W. Since the energy values for memory are much lower than the calculated energy values for processors or CPUs, we consider these values negligible. Pr ~0
* CPU Utilization doesn’t scale linearly with power consumption, we will use the power curve as described in the [SCI Data Project “[E] Energy Estimation from Utilization Model” model](https://docs.google.com/spreadsheets/d/1Viv94rMKH-fJrfD9Nn9_qkiAg1PDfIfJUAHRX9slG7A/edit#gid=526989613)
* TDP of server used in Azure App server Premium configuration (P2v2 ) -2nd Generation Intel® Xeon® Platinum 8272CL (Cascade Lake)= 205 W ( [https://ark.intel.com/content/www/us/en/ark/products/192482/intel-xeon-platinum-8270-processor-35-75m-cache-2-70-ghz.html](https://ark.intel.com/content/www/us/en/ark/products/192482/intel-xeon-platinum-8270-processor-35-75m-cache-2-70-ghz.html))
* From specs, we found that Power consumed by 4GB memory is close to 1.45 W and that by 8 GB memory is approximately 2.45 W. Also from this [article](https://medium.com/teads-engineering/estimating-aws-ec2-instances-power-consumption-c9745e347959) we can consider power consumed is approx 0.38 W/GB or close to 2.6 Watts.Since the energy values for memory are much lower than the calculated energy values for processors or CPUs, we consider these values negligible. Pr ~0
* No GPU was used hence Pg ~0


### Carbon Intensity (`I`)

* We will use regional yearly averages.
* The region the application was run in was India.
* We will source the Carbon Intensity from the SCI Data project and the [[I] Regional Yearly Marginal Carbon Intensity](https://docs.google.com/spreadsheets/d/1Viv94rMKH-fJrfD9Nn9_qkiAg1PDfIfJUAHRX9slG7A/edit#gid=1582216595) data set.

### Embodied Carbon (`M`)

The equation to calculate `M = TE * (TR/EL) * (RR/TR)`

Where:

* TE = Total Embodied Emissions, the sum of LCA emissions for all hardware components associated with the application server.
* TR = Time Reserved, the length of time the hardware is reserved for use by the software.
* EL = Expected Lifespan, the anticipated time that the equipment will be installed.
* RR = Resources Reserved, the number of resources reserved for use by the software.
* TR = Total Resources, the total number of resources available.

For this component:

* TE: We will source the embodied carbon estimates for the servers from the [Cloud Carbon Footprint Coefficient](https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/blob/main/output/coefficients-azure-embodied.csv) Data Set.
* TR: 1 hr.
* EL: We will assume a 4 year lifespan or 35,040 hrs.
* RR: A virtual machine with 2 vCPUs was used, this data was sourced from [Cloud Carbon Footprint Azure Instances Coefficients](https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/blob/main/data/azure-instances.csv).
* TR: The bare metal host is split up into 16 vCPUs in total. This data was sourced from the [Cloud Carbon Footprint Azure Instances Coefficients](https://github.com/cloud-carbon-footprint/cloud-carbon-coefficients/blob/main/data/azure-instances.csv).

### Database server for Web application

The database server used for the load test is Standard Gen 5 2 vCore 10 GB RAM machine from Azure SQL


### Energy (`E`)

The Quantification method used for calculating energy value is **Calculate**. We are measuring CPU utilization of the database servers and then using a model based on the Thermal Design Power (TDP) of the processors, number of cores etc to **estimate** the power consumption.

The equation used to model the energy consumption is:

P[kwH] = (Power consumed by CPU or Pc Number of cores + Power consumed by Memory or Pr + Power consumed by GPU or Pg Number of GPUs)/1000

* CPU Utilization doesn’t scale linearly with power consumption, we will use the power curve as described in the [SCI Data Project “[E] Energy Estimation from Utilization Model” model](https://docs.google.com/spreadsheets/d/1Viv94rMKH-fJrfD9Nn9_qkiAg1PDfIfJUAHRX9slG7A/edit#gid=526989613)
* TDP of server used in Azure SQL server [Gen 5](https://azure.microsoft.com/en-us/pricing/details/azure-sql-database/single/#pricing) configuration - Intel SP8160 (Skylake)= 150 W ( [https://ark.intel.com/content/www/us/en/ark/products/192482/intel-xeon-platinum-8270-processor-35-75m-cache-2-70-ghz.html](https://www.intel.com/content/www/us/en/products/sku/120501/intel-xeon-platinum-8160-processor-33m-cache-2-10-ghz/specifications.html))
* From specs, we found that Power consumed by 4GB memory is close to 1.45 W and that by 10 GB memory is approximately 4 W. Also from this [article](https://medium.com/teads-engineering/estimating-aws-ec2-instances-power-consumption-c9745e347959) we can consider power consumed is approx 0.38 W/GB or close to 2.6 Watts.Since the energy values for memory are much lower than the calculated energy values for processors or CPUs, we consider these values negligible. Pr ~0
* No GPU was used hence Pg ~0
* TDP of server used in Azure App server Premium configuration (P2v2 ) -2nd Generation Intel® Xeon® Platinum 8272CL (Cascade Lake)= 205 W ( [https://ark.intel.com/content/www/us/en/ark/products/192482/intel-xeon-platinum-8270-processor-35-75m-cache-2-70-ghz.html](https://ark.intel.com/content/www/us/en/ark/products/192482/intel-xeon-platinum-8270-processor-35-75m-cache-2-70-ghz.html) )


### Carbon Intensity (`I`)

Expand All @@ -88,7 +139,7 @@ The equation to calculate `M = TE * (TR/EL) * (RR/TR)`

Where:

* TE = Total Embodied Emissions, the sum of LCA emissions for all hardware components.
* TE = Total Embodied Emissions, the sum of LCA emissions for all hardware components associated with the database server.
* TR = Time Reserved, the length of time the hardware is reserved for use by the software.
* EL = Expected Lifespan, the anticipated time that the equipment will be installed.
* RR = Resources Reserved, the number of resources reserved for use by the software.
Expand All @@ -107,6 +158,7 @@ For this component:
*Show your work! For each of the components of your software system, show how you arrived at the SCI value. Guidance for this is available in the [Methodology summary](https://github.com/Green-Software-Foundation/software_carbon_intensity/blob/main/Software_Carbon_Intensity/Software_Carbon_Intensity_Specification.md#methodology-summary) section.
*


### App server for Web application

#### Energy (`E`)
Expand All @@ -125,7 +177,7 @@ E = Server utilization * Number of hours * Number of cores * TDP * TDP co-effici
= 0.023
```

E = **0.023 KwH**
E = **0.023 KwH** for a 1 hour period

### Carbon Intensity (`I`)

Expand All @@ -149,8 +201,52 @@ _The sum of the SCI calculation._

SCI = (E * I) + M = (0.02394 KwH * 951 gCO2e/kwH) + 4.305 gCO2e = **26.178 gCO2e**

### Database server for Web application

#### Energy (`E`)

_The workings of E, include raw numbers and calculations._

- Server utilization = 10%
- Number of hours = 1
- Number of cores = 2
- TDP = 150W
- TDP Coefficient = 0.32

```
E = Server utilization * Number of hours * Number of cores * TDP * TDP co-efficient
= (0.10 * 1 hour * 2 cores * 150 TDP * 0.32 TDP co-efficient)/1000
= 0.0096
```

E = **0.0096 KwH** for a 1 hour period

### Carbon Intensity (`I`)

I = **951 gCO2e/kWh**

### Embodied Carbon (`M`)

`M = TE * (TR/EL) * (RR/TR)`

- TE = 1433.12 kgCo2e
- TR = 1 hour
- EL = 35040
- RR = 2
- TR = 16

M = 1433.12 * (1/35040) * (2/16) = 0.005112 KG =~ **5.112 gCO2e**

### SCI

_The sum of the SCI calculation._

SCI = (E * I) + M = (0.0096 KwH * 951 gCO2e/kwH) + 5.112 gCO2e = **14.2416 gCO2e**



## SCI Total

_The total SCI for the whole application._

SCI = SCI(App server for Web application) = **26.178 gCO2e**
SCI = SCI(App server for Web application) + SCI for database server = **40.4196 gCO2e**

0 comments on commit 55f4e59

Please sign in to comment.