Skip to content

Commit

Permalink
feat: Rewriting markdown file of reasonable CPU and memory requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ManuelGerding committed Dec 5, 2023
1 parent a730976 commit 1d229a8
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 33 deletions.
63 changes: 32 additions & 31 deletions extadvice/advice.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,11 +178,11 @@ func GetAdviceDescriptionCPULimit() advice_kit_api.AdviceDefinition {
},
Validation: extutil.Ptr([]advice_kit_api.Validation{
{
Id: "com.steadybit.extension_kubernetes.k8s-cpu-limit.experiment-1",
Type: "EXPERIMENT",
Name: "CPU Overload",
Id: "com.steadybit.extension_kubernetes.k8s-cpu-limit.experiment-1",
Type: "EXPERIMENT",
Name: "CPU Overload",
ShortDescription: "Check how ${target.steadybit.label} behaves when running at the CPU limit and whether your remaining Kubernetes resources at the host function properly.",
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(CpuLimitContent, "cpu_limit/experiment_cpu_limit.json"))),
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(CpuLimitContent, "cpu_limit/experiment_cpu_limit.json"))),
},
}),
},
Expand Down Expand Up @@ -218,11 +218,11 @@ func GetAdviceDescriptionCPURequest() advice_kit_api.AdviceDefinition {
},
Validation: extutil.Ptr([]advice_kit_api.Validation{
{
Id: CpuRequestID + ".validation.1",
Type: "TEXT",
Name: "Requested CPU resources are reasonable",
Id: CpuRequestID + ".validation.1",
Type: "TEXT",
Name: "Requested CPU resources are reasonable",
ShortDescription: "I confirm that the requested CPU resources are reasonable to avoid overcommitment of resources and optimize scheduling of workload resources.",
Description: extutil.Ptr(ReadAdviceFile(CpuRequestContent, "cpu_request/validation_1_description.md")),
Description: extutil.Ptr(ReadAdviceFile(CpuRequestContent, "cpu_request/validation_1_description.md")),
},
}),
},
Expand Down Expand Up @@ -258,11 +258,11 @@ func GetAdviceDescriptionSingleReplica() advice_kit_api.AdviceDefinition {
},
Validation: extutil.Ptr([]advice_kit_api.Validation{
{
Id: "com.steadybit.extension_kubernetes.k8s-single-replica.experiment-1",
Type: "EXPERIMENT",
Name: "Single Pod Failure",
Id: "com.steadybit.extension_kubernetes.k8s-single-replica.experiment-1",
Type: "EXPERIMENT",
Name: "Single Pod Failure",
ShortDescription: "In case one pod of ${target.steadybit.label} fails, Kubernetes manages this accordingly by routing the traffic to the other pods within expected failure rates.",
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(SingleReplicaContent, "single_replica/experiment_pod_failure.json"))),
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(SingleReplicaContent, "single_replica/experiment_pod_failure.json"))),
},
}),
},
Expand Down Expand Up @@ -324,11 +324,11 @@ func GetAdviceDescriptionLivenessProbe() advice_kit_api.AdviceDefinition {
},
Validation: extutil.Ptr([]advice_kit_api.Validation{
{
Id: "com.steadybit.extension_kubernetes.k8s-liveness-probe.experiment-1",
Type: "EXPERIMENT",
Name: "Container's Unhealthiness Is Detected Within Expected Failure Rates",
Id: "com.steadybit.extension_kubernetes.k8s-liveness-probe.experiment-1",
Type: "EXPERIMENT",
Name: "Container's Unhealthiness Is Detected Within Expected Failure Rates",
ShortDescription: "Verify that Kubernetes can detect an unhealthy container of gateway, restarts the container, and routes traffic afterward within the expected failure rates.",
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(LivenessProbeContent, "liveness_probe/experiment_pod_lifecycle.json"))),
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(LivenessProbeContent, "liveness_probe/experiment_pod_lifecycle.json"))),
},
}),
},
Expand Down Expand Up @@ -391,11 +391,11 @@ func GetAdviceDescriptionMemoryLimit() advice_kit_api.AdviceDefinition {
},
Validation: extutil.Ptr([]advice_kit_api.Validation{
{
Id: "com.steadybit.extension_kubernetes.k8s-memory-limit.experiment-1",
Type: "EXPERIMENT",
Name: "Memory Overload",
Id: "com.steadybit.extension_kubernetes.k8s-memory-limit.experiment-1",
Type: "EXPERIMENT",
Name: "Memory Overload",
ShortDescription: "Check how ${target.steadybit.label} behaves when running at the memory limit and whether your remaining Kubernetes resources at the host function properly.",
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(MemoryLimitContent, "memory_limit/experiment_memory_limit.json"))),
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(MemoryLimitContent, "memory_limit/experiment_memory_limit.json"))),
},
}),
},
Expand Down Expand Up @@ -431,10 +431,11 @@ func GetAdviceDescriptionMemoryRequest() advice_kit_api.AdviceDefinition {
},
Validation: extutil.Ptr([]advice_kit_api.Validation{
{
Id: MemoryRequestID + ".validation.1",
Type: "TEXT",
Name: "Requested Memory resources are reasonable",
Id: MemoryRequestID + ".validation.1",
Type: "TEXT",
Name: "Requested Memory resources are reasonable",
ShortDescription: "I confirm that the requested memory resources are reasonable to avoid overcommitment of resources and optimize scheduling of workload resources.",
Description: extutil.Ptr(ReadAdviceFile(CpuRequestContent, "memory_request/validation_1_description.md")),
},
}),
},
Expand Down Expand Up @@ -471,11 +472,11 @@ func GetAdviceDescriptionSingleAwsZone() advice_kit_api.AdviceDefinition {
},
Validation: extutil.Ptr([]advice_kit_api.Validation{
{
Id: "com.steadybit.extension_kubernetes.single-aws-zone.experiment-1",
Type: "EXPERIMENT",
Name: "Availability Zone Outage",
Id: "com.steadybit.extension_kubernetes.single-aws-zone.experiment-1",
Type: "EXPERIMENT",
Name: "Availability Zone Outage",
ShortDescription: "When a single AWS availability zone fails, there are still pods of ${target.steadybit.label} ready to continue providing offered features.",
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(SingleAwsZoneContent, "single_aws_zone/experiment_zone_outage.json"))),
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(SingleAwsZoneContent, "single_aws_zone/experiment_zone_outage.json"))),
},
}),
},
Expand Down Expand Up @@ -511,11 +512,11 @@ func GetAdviceDescriptionSingleAzureZone() advice_kit_api.AdviceDefinition {
},
Validation: extutil.Ptr([]advice_kit_api.Validation{
{
Id: "com.steadybit.extension_kubernetes.single-azure-zone.experiment-1",
Type: "EXPERIMENT",
Name: "Availability Zone Outage",
Id: "com.steadybit.extension_kubernetes.single-azure-zone.experiment-1",
Type: "EXPERIMENT",
Name: "Availability Zone Outage",
ShortDescription: "When a single Azure availability zone fails, there are still pods of ${target.steadybit.label} ready to continue providing offered features.",
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(SingleAzureZoneContent, "single_azure_zone/experiment_zone_outage.json"))),
Experiment: extutil.Ptr(advice_kit_api.Experiment(ReadAdviceFile(SingleAzureZoneContent, "single_azure_zone/experiment_zone_outage.json"))),
},
}),
},
Expand Down
13 changes: 11 additions & 2 deletions extadvice/cpu_request/validation_1_description.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
### Confirmation
I *confirm* that the `requested CPU` resources are reasonable to avoid overcommitment of resources and optimize scheduling of workload resources.
I *confirm* that the requested CPU resources are reasonable to avoid overcommitment of resources and optimize the scheduling of workload resources.

## What's the Risk?
Requesting a reasonable amount of CPU might be difficult and is always a tradeoff.
Setting the requested CPU too low may lead to starvation and the container not getting needed CPU cycles.
Setting the requested CPU too high may lead to inefficiency and extra CPUs.
In addition, the value may depend on the criticality of your Kubernetes resources.

## How to Identify Proper Values?
Historical data are a good indicator of what your Kubernetes resource needs. For instance, check the 99th percentile of the last 24 hours and add some extra headroom depending on the criticality of your Kubernetes resources.
If you don't have historical data, a load test may help you to generate more insights.
11 changes: 11 additions & 0 deletions extadvice/memory_request/validation_1_description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
I *confirm* that the requested memory resources are reasonable to avoid overcommitment of resources and optimize the scheduling of workload resources.

## What's the Risk?
Requesting a reasonable amount of memory might be difficult and is always a tradeoff.
Setting the requested memory too low may lead to Kubernetes killing the container.
Setting the requested memory too high may lead to inefficiency and extra memory.
In addition, the value may depend on the criticality of your Kubernetes resources.

## How to Identify Proper Values?
Historical data are a good indicator of what your Kubernetes resource needs. For instance, check the 99th percentile of the last 24 hours and add some extra headroom depending on the criticality of your Kubernetes resources.
If you don't have historical data, a load test may help you to generate more insights.

0 comments on commit 1d229a8

Please sign in to comment.