-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ca1268
commit 649e5cb
Showing
14 changed files
with
332 additions
and
72 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,47 @@ | ||
# K8s Power Manager | ||
|
||
## Components | ||
1. **PowerManager Controller**: ensures the actual state matches the desired state of the cluster. | ||
2. **PowerConfig Controller**: sees the powerConfig created by user and deploys Power Node Agents onto each node specified using a DaemonSet. | ||
- powerNodeSelector: A key/value map used to define a list of node labels that a node must satisfy for the operator's node | ||
agent to be deployed. | ||
- powerProfiles: The list of PowerProfiles that the user wants available on the nodes | ||
3. **Power Node Agent**: containerized applications used to communicate with the node's Kubelet PodResources endpoint to discover the exact CPUs that | ||
are allocated per container and tune frequency of the cores as requested | ||
|
||
|
||
## Setup | ||
### 1. Manual | ||
#### on both nodes | ||
git clone -b new_test --depth=1 https://github.com/vhive-serverless/vhive.git | ||
cd vhive | ||
mkdir -p /tmp/vhive-logs | ||
./scripts/cloudlab/setup_node.sh stock-only > >(tee -a /tmp/vhive-logs/setup_node.stdout) 2> >(tee -a /tmp/vhive-logs/setup_node.stderr >&2) | ||
|
||
#### for worker | ||
./scripts/cluster/setup_worker_kubelet.sh stock-only > >(tee -a /tmp/vhive-logs/setup_worker_kubelet.stdout) 2> >(tee -a /tmp/vhive-logs/setup_worker_kubelet.stderr >&2) | ||
sudo screen -dmS containerd bash -c "containerd > >(tee -a /tmp/vhive-logs/containerd.stdout) 2> >(tee -a /tmp/vhive-logs/containerd.stderr >&2)" | ||
|
||
#### for master | ||
sudo screen -dmS containerd bash -c "containerd > >(tee -a /tmp/vhive-logs/containerd.stdout) 2> >(tee -a /tmp/vhive-logs/containerd.stderr >&2)" | ||
./scripts/cluster/create_multinode_cluster.sh stock-only > >(tee -a /tmp/vhive-logs/create_multinode_cluster.stdout) 2> >(tee -a /tmp/vhive-logs/create_multinode_cluster.stderr >&2) | ||
|
||
join the cluster from worker, answer 'y' to master | ||
|
||
## Setup | ||
### 1. Manual | ||
|
||
Execute the following below **as a non-root user with sudo rights** using **bash**: | ||
1. On master node, run the node setup script: | ||
```bash | ||
./examples/powermanger/setup_power_manager.sh; | ||
``` | ||
2. On worker node, run: | ||
```bash | ||
go run ./examples/powermanger/workload_sensitivity_exp.go | ||
``` | ||
|
||
2. Clean Up | ||
```bash | ||
./scripts/github_runner/clean_cri_runner.sh | ||
``` |
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
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
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,5 @@ | ||
module github.com/vhive-serverless/vhive/examples/deployer | ||
|
||
go 1.19 | ||
|
||
replace github.com/vhive-serverless/vhive/examples/deployer => ../deployer |
Empty file.
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,121 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/csv" | ||
"fmt" | ||
"os" | ||
"os/exec" | ||
"strconv" | ||
"time" | ||
) | ||
|
||
var ( | ||
SpinningURL = "spinning-go.default.192.168.1.240.sslip.io" | ||
SleepingURL = "sleeping-go.default.192.168.1.240.sslip.io" | ||
AesURL = "aes-python.default.192.168.1.240.sslip.io" | ||
AuthURL = "auth-python.default.192.168.1.240.sslip.io" | ||
) | ||
|
||
func setPowerProfileToNodes(freq1 int64, freq2 int64) error { | ||
// powerConfig | ||
command := fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerConfig\nmetadata:\n name: power-config\n namespace: intel-power\nspec:\n powerNodeSelector:\n kubernetes.io/os: linux\n powerProfiles:\n - \"performance\"\nEOF") | ||
cmd := exec.Command("bash", "-c", command) | ||
_, err := cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// performanceProfile w freq | ||
command = fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerProfile\nmetadata:\n name: performance-node1\n namespace: intel-power\nspec:\n name: \"performance-node1\"\n max: %d\n min: %d\n shared: true\n governor: \"performance\"\nEOF", freq1, freq1) | ||
cmd = exec.Command("bash", "-c", command) | ||
_, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
command = fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerProfile\nmetadata:\n name: performance-node2\n namespace: intel-power\nspec:\n name: \"performance-node2\"\n max: %d\n min: %d\n shared: true\n governor: \"performance\"\nEOF", freq2, freq2) | ||
cmd = exec.Command("bash", "-c", command) | ||
_, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// apply to node | ||
command = fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerWorkload\nmetadata:\n name: performance-node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload\n namespace: intel-power\nspec:\n name: \"performance-node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload\"\n allCores: true\n powerNodeSelector:\n kubernetes.io/hostname: node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us\n powerProfile: \"performance-node1\"\nEOF") | ||
cmd = exec.Command("bash", "-c", command) | ||
_, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
command = fmt.Sprintf("kubectl apply -f - <<EOF\napiVersion: \"power.intel.com/v1\"\nkind: PowerWorkload\nmetadata:\n name: performance-node-2.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload\n namespace: intel-power\nspec:\n name: \"performance-node-2.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload\"\n allCores: true\n powerNodeSelector:\n kubernetes.io/hostname: node-2.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us\n powerProfile: \"performance-node2\"\nEOF") | ||
cmd = exec.Command("bash", "-c", command) | ||
_, err = cmd.CombinedOutput() | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func invoke(n int, url string, writer *csv.Writer) { | ||
for i := 0; i < n; i++ { | ||
go func() { | ||
command := fmt.Sprintf("cd $HOME/vSwarm/tools/test-client && ./test-client --addr %s:80 --name \"allow\"", url) | ||
startInvoke := time.Now().UTC().UnixMilli() | ||
cmd := exec.Command("bash", "-c", command) | ||
_, err := cmd.CombinedOutput() | ||
if err != nil { | ||
fmt.Printf(fmt.Sprintf("ERR2: %+v", err)) | ||
return | ||
} | ||
endInvoke := time.Now().UTC().UnixMilli() | ||
latency := endInvoke - startInvoke | ||
err = writer.Write(append([]string{strconv.FormatInt(startInvoke, 10), strconv.FormatInt(endInvoke, 10), strconv.FormatInt(latency, 10)})) | ||
if err != nil { | ||
fmt.Printf("Error writing metrics to the CSV file: %v\n", err) | ||
} | ||
}() | ||
} | ||
} | ||
|
||
func main() { | ||
file1, err := os.Create("metrics1.csv") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer file1.Close() | ||
writer1 := csv.NewWriter(file1) | ||
defer writer1.Flush() | ||
err = writer1.Write(append([]string{"startTime", "endTime", "sleepingLatency"})) | ||
if err != nil { | ||
fmt.Printf("Error writing metrics to the CSV file: %v\n", err) | ||
} | ||
|
||
file2, err := os.Create("metrics2.csv") | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer file2.Close() | ||
writer2 := csv.NewWriter(file2) | ||
defer writer2.Flush() | ||
err = writer2.Write(append([]string{"startTime", "endTime", "spinningLatency"})) | ||
if err != nil { | ||
fmt.Printf("Error writing metrics to the CSV file: %v\n", err) | ||
} | ||
|
||
now := time.Now() | ||
for time.Since(now) < (time.Minute * 2) { | ||
go invoke(5, SleepingURL, writer1) | ||
go invoke(5, SpinningURL, writer2) | ||
} | ||
|
||
err = writer1.Write(append([]string{"-", "-", "-"})) | ||
if err != nil { | ||
fmt.Printf("Error writing metrics to the CSV file: %v\n", err) | ||
} | ||
err = writer2.Write(append([]string{"-", "-", "-"})) | ||
if err != nil { | ||
fmt.Printf("Error writing metrics to the CSV file: %v\n", err) | ||
} | ||
fmt.Println("done") | ||
} |
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
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
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,11 @@ | ||
apiVersion: power.intel.com/v1 | ||
kind: PowerProfile | ||
metadata: | ||
name: shared | ||
namespace: intel-power | ||
spec: | ||
name: "shared" | ||
max: 1200 | ||
min: 1200 | ||
shared: true | ||
governor: "powersave" |
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,11 @@ | ||
apiVersion: "power.intel.com/v1" | ||
kind: PowerWorkload | ||
metadata: | ||
name: shared-node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload | ||
namespace: intel-power | ||
spec: | ||
name: "shared-node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us-workload" | ||
allCores: true | ||
powerNodeSelector: | ||
kubernetes.io/hostname: node-1.kt-cluster.ntu-cloud-pg0.utah.cloudlab.us | ||
powerProfile: "shared" |
Oops, something went wrong.