Skip to content

Add same_family_bias model argument for Cassandra#207

Draft
homatthew wants to merge 2 commits intoNetflix-Skunkworks:mainfrom
homatthew:mho/cassandra-least-regret-family-bias
Draft

Add same_family_bias model argument for Cassandra#207
homatthew wants to merge 2 commits intoNetflix-Skunkworks:mainfrom
homatthew:mho/cassandra-least-regret-family-bias

Conversation

@homatthew
Copy link
Contributor

Summary

Adds a new same_family_bias parameter to NflxCassandraArguments that penalizes switching to a different instance family during capacity planning.

Key changes:

  • Added same_family_bias: Optional[float] field to NflxCassandraArguments
  • Modified _plan_certain() in capacity_planner.py to apply bias during sorting
  • Added comprehensive tests for the new feature

Behavior

When same_family_bias is set and desires.current_clusters is provided:

  • Plans that keep the same instance family as the current cluster are sorted by their actual cost
  • Plans that switch to a different family have their effective cost multiplied by same_family_bias for sorting purposes

This helps maintain operational stability by preferring to stay on familiar instance families when the cost difference is small.

Example Usage

planner.plan_certain(
    model_name="org.netflix.cassandra",
    region="us-east-1",
    desires=desires_with_current_cluster,
    extra_model_arguments={
        "same_family_bias": 2.0,  # 2x effective cost for switching families
    },
)

Test plan

  • All 5 new family bias tests pass
  • All 20 existing Cassandra tests pass
  • All 378 tests in the test suite pass

🤖 Generated with Claude Code

homatthew and others added 2 commits January 16, 2026 17:05
These tests define the interface for a new `family_bias` argument that will
allow tuning the least-regret selection to prefer certain instance families.

Tests cover:
- Argument acceptance in NflxCassandraArguments
- Default value behavior
- Selection bias toward preferred families
- Penalty behavior to avoid certain families
- Regret calculation mechanics

The tests currently fail with:
  AttributeError: 'NflxCassandraArguments' object has no attribute 'family_bias'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Adds a new `same_family_bias` parameter to `NflxCassandraArguments` that
penalizes switching to a different instance family during capacity planning.

When `same_family_bias` is set and `desires.current_clusters` is provided:
- Plans that keep the same instance family as the current cluster
  are sorted by their actual cost
- Plans that switch to a different family have their effective cost
  multiplied by `same_family_bias` for sorting purposes

This helps maintain operational stability by preferring to stay on
familiar instance families when the cost difference is small.

Example usage:
  extra_model_arguments={"same_family_bias": 2.0}
  # Plans switching families appear as 2x more expensive during sorting

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant