Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed disk provisioning threshold for adjusting cassandra #87

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion service_capacity_modeling/models/org/netflix/cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,12 @@ def _estimate_cassandra_cluster_zonal(
),
# C* requires ephemeral disks to be 25% full because compaction
# and replacement time if we're underscaled.
required_disk_space=lambda x: x * 4,
required_disk_space=lambda x: x * 2
if instance.drive is None
or "local" in instance.drive.drive_type.name
or required_cluster_size is None
or (x / required_cluster_size) < 1000
else x + (1000 * required_cluster_size),
# C* clusters cannot recover data from neighbors quickly so we
# want to avoid clusters with more than 1 TiB of local state
max_local_disk_gib=max_local_disk_gib,
Expand Down
50 changes: 49 additions & 1 deletion tests/netflix/test_cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def test_high_write_throughput():
assert (
300_000
> high_writes_result.count * high_writes_result.attached_drives[0].size_gib
>= 100_000
>= 70_000
)

cluster_cost = cap_plan.candidate_clusters.annual_costs["cassandra.zonal-clusters"]
Expand Down Expand Up @@ -353,3 +353,51 @@ def test_plan_certain():
lr_clusters = cap_plan[0].candidate_clusters.zonal[0]
assert lr_clusters.count == 8
assert lr_clusters.instance.cpu == 16


def test_plan_certain_disk_space():
"""
Disk space is adjusted based on EBS and ephemeral. Takes lesser vCPUs. Correct
adjustment of disk space attributes to lower node density and hence provides
lower vCPUs.
"""
cluster_capacity = CurrentClusterCapacity(
cluster_instance_name="i4i.8xlarge",
cluster_instance_count=Interval(low=32, mid=32, high=32, confidence=1),
cpu_utilization=Interval(low=2.96, mid=4.36, high=7.47, confidence=1),
)

worn_desire = CapacityDesires(
service_tier=1,
current_clusters=CurrentClusters(zonal=[cluster_capacity]),
query_pattern=QueryPattern(
access_pattern=AccessPattern(AccessPattern.latency),
estimated_read_per_second=Interval(
low=583, mid=933, high=2790, confidence=0.98
),
estimated_write_per_second=Interval(
low=11310, mid=16491, high=20501, confidence=0.98
),
),
data_shape=DataShape(
estimated_state_size_gib=Interval(
low=71734.83, mid=72232.16, high=72385.33, confidence=0.98
),
estimated_compression_ratio=Interval(low=1, mid=1, high=1, confidence=1),
),
)
cap_plan = planner.plan_certain(
model_name="org.netflix.cassandra",
region="us-east-1",
num_results=3,
num_regions=4,
desires=worn_desire,
extra_model_arguments={
"current_asg_size": 3,
"max_disk_used_gib": 2520.8339739371695,
"max_local_disk_gib": 16384,
"required_cluster_size": 32,
},
)
lr_clusters = cap_plan[0].candidate_clusters.zonal[0]
assert lr_clusters.instance.cpu < 32
3 changes: 2 additions & 1 deletion tests/netflix/test_cassandra_uncertain.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def test_increasing_qps_simple():
if lr.instance.drive is None:
assert sum(dr.size_gib for dr in lr.attached_drives) >= 100
else:
assert lr.instance.drive.size_gib >= 100
assert lr.instance.drive.size_gib >= 60

result.append(
(lr_family, lr_cpu, lr_cost, cap_plan.least_regret[0].requirements.zonal[0])
Expand Down Expand Up @@ -147,6 +147,7 @@ def test_worn_dataset():
extra_model_arguments={
"max_regional_size": 200,
"copies_per_region": 2,
"require_attached_disks": True,
},
)

Expand Down
2 changes: 1 addition & 1 deletion tests/netflix/test_key_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_kv_increasing_qps_simple():
if zlr.instance.drive is None:
assert sum(dr.size_gib for dr in zlr.attached_drives) >= 100
else:
assert zlr.instance.drive.size_gib >= 100
assert zlr.instance.drive.size_gib >= 60

zonal_result.append(
(
Expand Down
2 changes: 1 addition & 1 deletion tests/netflix/test_time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_timeseries_increasing_qps_simple():
if zlr.instance.drive is None:
assert sum(dr.size_gib for dr in zlr.attached_drives) >= 100
else:
assert zlr.instance.drive.size_gib >= 100
assert zlr.instance.drive.size_gib >= 60

zonal_result.append(
(
Expand Down
Loading