Skip to content

Commit 36f6b5d

Browse files
committed
Added advanced options + scaling options
1 parent 9bccb60 commit 36f6b5d

File tree

15 files changed

+599
-458
lines changed

15 files changed

+599
-458
lines changed

frontend/src/App.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ function App() {
4242
</a>
4343
</header>
4444
<main className='w-full px-10 max-w-[2000px] mx-auto relative flex flex-col gap-8'>
45-
<section className='flex flex-col justify-center py-4'>
46-
<h1 className='text-3xl text-center'>TCO<sub>2</sub>: Analyzing the Carbon Footprint of Database Server
47-
Replacements</h1>
45+
<section className='flex flex-col justify-center py-4 gap-2'>
46+
<h1 className='text-3xl text-center font-medium'>TCO<sub>2</sub>: Total CO<sub>2</sub> Cost of Ownership</h1>
47+
<h2 className='text-lg text-center font-light text-slate-600'>Analyzing the Carbon Footprint of Database Server Replacements</h2>
4848
<div className='flex mx-auto gap-8'>
4949
<p className='text-cyan-700 underline underline-offset-2 text-lg text-center'>
5050
<a
@@ -71,7 +71,7 @@ function App() {
7171
</div>
7272
</section>
7373
</main>
74-
<section className='flex flex-col text-slate-600 w-full md:w-3/4 px-2 lg:w-3/5 max-w-[2000px] mx-auto text-left mt-14'>
74+
<section className='flex flex-col text-slate-600 w-full px-10 max-w-[2000px] mx-auto text-left mt-14'>
7575
<p>1. SPEC CPU Benchmark - <a className='underline hover:opacity-65' href='https://www.spec.org/cpu2017/'>spec.org/cpu2017</a></p>
7676
<p>2. TPC-H - <a className='underline hover:opacity-65' href='https://www.tpc.org/tpch/'>tpc.org/tpch</a></p>
7777
<p>3. Hyrise - Hyrise is a research in-memory database. <a className='underline hover:opacity-65' href='https://github.com/hyrise/hyrise'>github.com/hyrise/hyrise</a></p>

frontend/src/assets/countries.js

Lines changed: 179 additions & 179 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/assets/data.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const CPU_DATA : CPUs= {
4444
"TPCH_RUNS_PER_KJOULE": 0.0897,
4545
"SPECINT_PER_TDP": 1.38974358974359,
4646
"SPECINTrate_PER_TDP": 0.470085470085469,
47-
"DIE_SIZE": 541
47+
"DIE_SIZE": 541 // UNSURE
4848
},
4949
"Intel Xeon E7-4850 v4": {
5050
"MAKE": INTEL,
@@ -60,7 +60,7 @@ const CPU_DATA : CPUs= {
6060
"TPCH_RUNS_PER_KJOULE": 0.1037,
6161
"SPECINT_PER_TDP": 1.85507246376811,
6262
"SPECINTrate_PER_TDP": 0.95,
63-
"DIE_SIZE": 456
63+
"DIE_SIZE": 456 // UNSURE
6464
},
6565
"Intel Xeon Platinum 8180": {
6666
"MAKE": INTEL,
@@ -76,7 +76,7 @@ const CPU_DATA : CPUs= {
7676
"TPCH_RUNS_PER_KJOULE": 0.1106,
7777
"SPECINT_PER_TDP": 2.54704390243902,
7878
"SPECINTrate_PER_TDP": 0.673170731707317,
79-
"DIE_SIZE": 628
79+
"DIE_SIZE": 694 // UNSURE
8080
},
8181
"Intel Xeon Platinum 8259CL": {
8282
"MAKE": INTEL,
@@ -92,7 +92,7 @@ const CPU_DATA : CPUs= {
9292
"TPCH_RUNS_PER_KJOULE": 0.1164,
9393
"SPECINT_PER_TDP": 2.99636363636364,
9494
"SPECINTrate_PER_TDP": 0.6666666666,
95-
"DIE_SIZE": 754
95+
"DIE_SIZE": 754 // UNSURE
9696
},
9797
"Intel Xeon Platinum 8352Y": {
9898
"MAKE": INTEL,
@@ -108,7 +108,7 @@ const CPU_DATA : CPUs= {
108108
"TPCH_RUNS_PER_KJOULE": 0.1552,
109109
"SPECINT_PER_TDP": 3.64572097560976,
110110
"SPECINTrate_PER_TDP": 1.04878048780488,
111-
"DIE_SIZE": 660
111+
"DIE_SIZE": 660 // UNSURE
112112
},
113113
"Intel Xeon Platinum 8480CL": {
114114
"MAKE": INTEL,
@@ -124,7 +124,7 @@ const CPU_DATA : CPUs= {
124124
"TPCH_RUNS_PER_KJOULE": 0.1332,
125125
"SPECINT_PER_TDP": 4.7264,
126126
"SPECINTrate_PER_TDP": 1.26714285714286,
127-
"DIE_SIZE": (4*477)
127+
"DIE_SIZE": (4*477) // https://www.techpowerup.com/cpu-specs/xeon-platinum-8480.c2958
128128
},
129129
"Intel Xeon Platinum 8570": {
130130
"MAKE": INTEL,
@@ -140,7 +140,7 @@ const CPU_DATA : CPUs= {
140140
"TPCH_RUNS_PER_KJOULE": 0.1399,
141141
"SPECINT_PER_TDP": 4.736,
142142
"SPECINTrate_PER_TDP": 1.37714285714286,
143-
"DIE_SIZE": (2*763)
143+
"DIE_SIZE": (2*763) // https://www.techpowerup.com/cpu-specs/xeon-platinum-8570.c3410
144144
},
145145
"AMD EPYC 7601": {
146146
"MAKE": AMD,
@@ -156,7 +156,7 @@ const CPU_DATA : CPUs= {
156156
"TPCH_RUNS_PER_KJOULE": null,
157157
"SPECINT_PER_TDP": 0.03977777777,
158158
"SPECINTrate_PER_TDP": 0.83888888888,
159-
"DIE_SIZE": 213
159+
"DIE_SIZE": 213 // https://www.techpowerup.com/cpu-specs/epyc-7601.c1920
160160
},
161161
"AMD EPYC 7402P": {
162162
"MAKE": AMD,
@@ -172,7 +172,7 @@ const CPU_DATA : CPUs= {
172172
"TPCH_RUNS_PER_KJOULE": null,
173173
"SPECINT_PER_TDP": 0.04805555555,
174174
"SPECINTrate_PER_TDP": 0.94444444444,
175-
"DIE_SIZE": 74
175+
"DIE_SIZE": 74 // https://www.techpowerup.com/cpu-specs/epyc-7402p.c2261
176176
},
177177
"AMD EPYC 7302P": {
178178
"MAKE": AMD,
@@ -188,7 +188,7 @@ const CPU_DATA : CPUs= {
188188
"TPCH_RUNS_PER_KJOULE": null,
189189
"SPECINT_PER_TDP": 0.05516129032,
190190
"SPECINTrate_PER_TDP": 0.76129032258,
191-
"DIE_SIZE": 74
191+
"DIE_SIZE": 74 // https://www.techpowerup.com/cpu-specs/epyc-7302p.c2262
192192
},
193193
"AMD EPYC 7513": {
194194
"MAKE": AMD,
@@ -204,7 +204,7 @@ const CPU_DATA : CPUs= {
204204
"TPCH_RUNS_PER_KJOULE": null,
205205
"SPECINT_PER_TDP": 0.0615,
206206
"SPECINTrate_PER_TDP": 1.26,
207-
"DIE_SIZE": (8*81)
207+
"DIE_SIZE": (8*81) //https://www.techpowerup.com/cpu-specs/epyc-7513.c2381
208208
},
209209
"AMD EPYC 7773X": {
210210
"MAKE": AMD,
@@ -220,7 +220,7 @@ const CPU_DATA : CPUs= {
220220
"TPCH_RUNS_PER_KJOULE": null,
221221
"SPECINT_PER_TDP": 0.04392857142,
222222
"SPECINTrate_PER_TDP": 1.45,
223-
"DIE_SIZE": (8*81)
223+
"DIE_SIZE": (8*81) //https://www.techpowerup.com/cpu-specs/epyc-7773x.c2759
224224
},
225225
"AMD EPYC 9554": {
226226
"MAKE": AMD,
@@ -236,7 +236,7 @@ const CPU_DATA : CPUs= {
236236
"TPCH_RUNS_PER_KJOULE": null,
237237
"SPECINT_PER_TDP": 0.04138888888,
238238
"SPECINTrate_PER_TDP": 1.81944444444,
239-
"DIE_SIZE": (8*72)
239+
"DIE_SIZE": (8*72) // https://www.techpowerup.com/cpu-specs/epyc-9554.c2930
240240
}
241241
}
242242

Lines changed: 86 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
import CPU_DATA from "../assets/data";
22
import { GRID_INTENSITY } from "../assets/grid_intensities";
3-
import { useBenchmarkContext } from "../utility/BenchmarkContext";
3+
import { ServerType, useBenchmarkContext, NEW_LABEL, OLD_LABEL } from "../utility/BenchmarkContext";
44
import ToggleSelection from "../utility/ToggleSelection";
5-
import { addCommaToNumber } from "../utility/UtilityFunctions";
5+
import { addCommaToNumber, clamp } from "../utility/UtilityFunctions";
66
import { getCountryColor } from "../partials/GeoMap";
77
// @tsignore
88
import GeoMap from "../partials/GeoMap";
99
// @ts-ignore
1010
import { COUNTRY_NAMES } from '../assets/countries.js';
1111
import { ListItem, ListItemWithSearch } from "../utility/ListItems";
1212
import { WORKLOAD_EXPLANATIONS, SCALING_EXPLANATIONS } from "../utility/descriptions";
13+
import UtilizationInput from "../utility/UtilizationInput.js";
1314

1415
export const WORKLOAD_TYPES = ['SPECrate', 'SPECspeed', 'Sorting', 'TPC-H'] as const;
1516
export type WorkloadType = typeof WORKLOAD_TYPES[number];
1617

17-
export const SCALING_TYPES = ['None', 'Utilization', 'Resources'] as const;
18+
export const SCALING_TYPES = ['None', 'Utilization', 'Emissions'] as const;
1819
export type ScalingType = typeof SCALING_TYPES[number];
1920

2021
export type PerformanceType = number | null;
@@ -61,15 +62,15 @@ export const WORKLOAD_MAPPING: WorkloadMappingType = {
6162

6263
function BenchmarkSettings() {
6364

64-
const { country, currentCPU, newCPU, workload, scaling, utilization, singleComparison, advancedSettings, setCountry, setWorkload, setScaling, setUtilization } = useBenchmarkContext();
65+
const { country, currentServer, newServer, workload, scaling, singleComparison, advancedSettings, oldPerformanceIndicator, newPerformanceIndicator, setCountry, setWorkload, setScaling, updateServer } = useBenchmarkContext();
6566

6667
const intensity = GRID_INTENSITY[country];
6768
let disabledWorkload: WorkloadType[] = [];
6869

6970
WORKLOAD_TYPES.forEach(workload => {
7071
let push = false
71-
if (CPU_DATA[currentCPU][WORKLOAD_MAPPING[workload]] === null) push = true;
72-
if (!singleComparison && CPU_DATA[newCPU][WORKLOAD_MAPPING[workload]] === null) push = true;
72+
if (CPU_DATA[currentServer.cpu][WORKLOAD_MAPPING[workload]] === null) push = true;
73+
if (!singleComparison && CPU_DATA[newServer.cpu][WORKLOAD_MAPPING[workload]] === null) push = true;
7374

7475
// push only if it is not alreal in disableWorkload
7576
if (push && !disabledWorkload.includes(workload)) disabledWorkload.push(workload)
@@ -78,96 +79,89 @@ function BenchmarkSettings() {
7879
// need to reset workload if restriced cpu is selected after workload is set
7980
if (disabledWorkload.includes(workload)) setWorkload(WORKLOAD_TYPES[0])
8081

81-
82-
return (
83-
<div className="flex z-30 flex-col text-medium font-medium flex-wrap px-4 py-2 gap-4">
84-
<div className="grid grid-cols-7 space-x-4">
85-
<div className="flex flex-col col-span-5 justify-evenly gap-2">
86-
<ToggleSelection<WorkloadType>
87-
label="Workload:"
88-
options={[...WORKLOAD_TYPES]}
89-
optionsTooltip={WORKLOAD_EXPLANATIONS}
90-
currentState={workload}
91-
setState={setWorkload}
92-
zIndex="z-30"
93-
disabled={disabledWorkload}
94-
flexGrow={false}
95-
/>
96-
<ToggleSelection<ScalingType>
97-
label="Scaling:"
98-
options={[...SCALING_TYPES]}
99-
optionsTooltip={SCALING_EXPLANATIONS}
100-
currentState={scaling}
101-
setState={setScaling}
102-
zIndex="z-30"
103-
disabled={['Resources']}
104-
flexGrow={false}
105-
/>
106-
<div className="flex gap-2 items-center">
107-
<label><p>{advancedSettings ? 'Current HW ' : ''}Utilization %:</p></label>
108-
<input
109-
className="grow accent-orange-600"
110-
type="range"
111-
value={utilization}
112-
min={0}
113-
max={100}
114-
onChange={(e) => setUtilization(Number(e.target.value))}
115-
/>
116-
<div className="flex gap-1">
117-
<input
118-
className="border rounded-md text-center bg-white"
119-
type="number"
120-
min={0}
121-
max={100}
122-
value={utilization}
123-
onChange={(e) => setUtilization(Number(e.target.value))}
124-
/>
125-
<p>%</p>
126-
</div>
127-
</div>
128-
<div hidden={!advancedSettings} className="flex gap-2 items-center">
129-
<label><p>New HW Utilization %:</p></label>
130-
<input
131-
className="grow accent-orange-600"
132-
type="range"
133-
value={utilization}
134-
min={0}
135-
max={100}
136-
onChange={(e) => setUtilization(Number(e.target.value))}
137-
/>
138-
<div className="flex gap-1">
139-
<input
140-
className="border rounded-md text-center bg-white"
141-
type="number"
142-
min={0}
143-
max={100}
144-
value={utilization}
145-
onChange={(e) => setUtilization(Number(e.target.value))}
82+
const updateUtilization = (server: String, updates: Partial<ServerType>) => {
83+
const thisServer = server == NEW_LABEL ? newServer : currentServer;
84+
const otherServer = server == NEW_LABEL ? currentServer : newServer;
85+
86+
updateServer(thisServer, updates);
87+
88+
if (singleComparison) return;
89+
90+
if (scaling == 'Utilization') {
91+
const isNew = server === NEW_LABEL;
92+
console.log(isNew)
93+
const base = isNew ? oldPerformanceIndicator : newPerformanceIndicator;
94+
const target = isNew ? newPerformanceIndicator : oldPerformanceIndicator;
95+
96+
const ratio = target / base;
97+
const scaledUtilization = clamp( updates.utilization as number * ratio, 0, 100)
98+
99+
updateServer(otherServer, { utilization: scaledUtilization })
100+
}
101+
}
102+
103+
104+
return (
105+
<div className="flex z-30 flex-col text-medium font-medium flex-wrap px-4 py-2 gap-4">
106+
<div className="grid grid-cols-7 space-x-4">
107+
<div className="flex flex-col col-span-5 gap-5">
108+
<ToggleSelection<WorkloadType>
109+
label="Workload:"
110+
options={[...WORKLOAD_TYPES]}
111+
optionsTooltip={WORKLOAD_EXPLANATIONS}
112+
currentState={workload}
113+
setState={setWorkload}
114+
zIndex="z-30"
115+
disabled={disabledWorkload}
116+
flexGrow={false}
117+
/>
118+
<ToggleSelection<ScalingType>
119+
label="Scaling:"
120+
options={[...SCALING_TYPES]}
121+
optionsTooltip={SCALING_EXPLANATIONS}
122+
currentState={scaling}
123+
setState={setScaling}
124+
zIndex="z-30"
125+
disabled={[]}
126+
flexGrow={false}
127+
/>
128+
<UtilizationInput
129+
label={advancedSettings ? 'Current HW Utilization %:' : 'Utilization %:'}
130+
accent="accent-orange-600"
131+
utilization={currentServer.utilization}
132+
setUtilization={(x) => updateUtilization(OLD_LABEL, {utilization: (x)} )}
133+
/>
134+
{
135+
singleComparison ? null :
136+
<UtilizationInput
137+
label="New HW Utilization %:"
138+
accent="accent-blue-500"
139+
utilization={newServer.utilization}
140+
setUtilization={(x) => updateUtilization(NEW_LABEL, {utilization: (x)} )}
141+
hidden={!advancedSettings}
146142
/>
147-
<p>%</p>
148-
</div>
149-
</div>
150-
</div>
151-
<div className="flex font-normal gap-2 flex-col col-span-2">
152-
<ListItemWithSearch
153-
label="Location"
154-
value={country}
155-
options={COUNTRY_NAMES}
156-
onChange={setCountry}
157-
borderColor={getCountryColor(intensity)}
158-
/>
159-
<ListItem
160-
label="Grid Carbon Intensity"
161-
value={`${addCommaToNumber(intensity)} gCO₂/kWh`}
162-
borderColor={getCountryColor(intensity)}
163-
/>
164-
</div>
143+
}
165144
</div>
166-
<div className={`${advancedSettings ? 'h-0' : 'h-96'} duration-300 ease-in-out overflow-hidden relative`}>
167-
<GeoMap country={country} setCountry={setCountry} />
145+
<div className="flex font-normal gap-2 flex-col col-span-2">
146+
<ListItemWithSearch
147+
label="Location"
148+
value={country}
149+
options={COUNTRY_NAMES}
150+
onChange={setCountry}
151+
borderColor={getCountryColor(intensity)}
152+
/>
153+
<ListItem
154+
label="Grid Carbon Intensity"
155+
value={`${addCommaToNumber(intensity)} gCO₂/kWh`}
156+
borderColor={getCountryColor(intensity)}
157+
/>
168158
</div>
169159
</div>
170-
)
160+
<div className={`${advancedSettings ? 'h-0' : 'h-96'} duration-300 ease-in-out overflow-hidden relative`}>
161+
<GeoMap country={country} setCountry={setCountry} />
162+
</div>
163+
</div>
164+
)
171165
}
172166

173167
export default BenchmarkSettings;

0 commit comments

Comments
 (0)