Skip to content

Commit 55e7d58

Browse files
committed
Change defaults + document simple limit - fixes #413
1 parent 0c7119c commit 55e7d58

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,21 @@ Get a free breakdown of KRR recommendations in the [Robusta SaaS](#free-krr-ui-o
441441

442442
### Algorithm
443443

444-
By default, we use a _simple_ strategy to calculate resource recommendations. It is calculated as follows (_The exact numbers can be customized in CLI arguments_):
444+
KRR provides multiple strategies for calculating resource recommendations:
445445

446-
- For CPU, we set a request at the 95th percentile with no limit. Meaning, in 95% of the cases, your CPU request will be sufficient. For the remaining 5%, we set no limit. This means your pod can burst and use any CPU available on the node - e.g. CPU that other pods requested but aren’t using right now.
446+
#### Simple Strategy (default)
447+
By default, we use the _simple_ strategy (`krr simple`). It is calculated as follows (_The exact numbers can be customized in CLI arguments_):
447448

448-
- For memory, we take the maximum value over the past week and add a 15% buffer.
449+
- **CPU**: Request at the 95th percentile, **limit unset** (allows unlimited bursting)
450+
- **Memory**: Maximum value over the past week + 15% buffer (same for request and limit)
451+
452+
#### Simple-Limit Strategy
453+
The _simple-limit_ strategy (`krr simple_limit`) provides both CPU requests and limits:
454+
455+
- **CPU**: Request and limit both set to configurable percentiles (default 95th percentile for both)
456+
- **Memory**: Maximum value over the past week + 15% buffer (same for request and limit)
457+
458+
**Key difference**: The simple strategy leaves CPU limits unset to allow unlimited bursting, while simple-limit sets explicit CPU limits.
449459

450460
### Prometheus connection
451461

robusta_krr/strategies/simple.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626

2727
class SimpleStrategySettings(StrategySettings):
28-
cpu_percentile: float = pd.Field(95, gt=0, le=100, description="The percentile to use for the CPU recommendation.")
28+
cpu_percentile: float = pd.Field(95, gt=0, le=100, description="The percentile to use for the CPU request recommendation. CPU limits are always unset to allow unlimited bursting.")
2929
memory_buffer_percentage: float = pd.Field(
3030
15, gt=0, description="The percentage of added buffer to the peak memory usage for memory recommendation."
3131
)
@@ -92,10 +92,12 @@ def metrics(self) -> list[type[PrometheusMetric]]:
9292
@property
9393
def description(self):
9494
s = textwrap.dedent(f"""\
95-
CPU request: {self.settings.cpu_percentile}% percentile, limit: unset
95+
CPU request: {self.settings.cpu_percentile}% percentile, limit: unset (allows unlimited bursting)
9696
Memory request: max + {self.settings.memory_buffer_percentage}%, limit: max + {self.settings.memory_buffer_percentage}%
9797
History: {self.settings.history_duration} hours
9898
Step: {self.settings.timeframe_duration} minutes
99+
100+
This is the default strategy. If you want to se CPU limits, use 'krr simple-limit' instead.
99101
100102
All parameters can be customized. For example: `krr simple --cpu_percentile=90 --memory_buffer_percentage=15 --history_duration=24 --timeframe_duration=0.5`
101103
""")

robusta_krr/strategies/simple_limit.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525

2626

2727
class SimpleLimitStrategySettings(StrategySettings):
28-
cpu_request: float = pd.Field(66, gt=0, le=100, description="The percentile to use for the CPU request.")
29-
cpu_limit: float = pd.Field(96, gt=0, le=100, description="The percentile to use for the CPU limit.")
28+
cpu_request: float = pd.Field(95, gt=0, le=100, description="The percentile to use for the CPU request.")
29+
cpu_limit: float = pd.Field(95, gt=0, le=100, description="The percentile to use for the CPU limit. Unlike 'simple' strategy, this strategy sets explicit CPU limits.")
3030
memory_buffer_percentage: float = pd.Field(
3131
15, gt=0, description="The percentage of added buffer to the peak memory usage for memory recommendation."
3232
)
@@ -97,6 +97,9 @@ def description(self):
9797
Memory request: max + {self.settings.memory_buffer_percentage}%, limit: max + {self.settings.memory_buffer_percentage}%
9898
History: {self.settings.history_duration} hours
9999
Step: {self.settings.timeframe_duration} minutes
100+
101+
Unlike the 'simple' strategy, this strategy sets explicit CPU limits instead of leaving them unset.
102+
Use this when you want to prevent CPU bursting beyond the configured limit.
100103
101104
All parameters can be customized. For example: `krr simple_limit --cpu_request=66 --cpu_limit=96 --memory_buffer_percentage=15 --history_duration=24 --timeframe_duration=0.5`
102105
""")

0 commit comments

Comments
 (0)