Skip to content

Commit

Permalink
Adding support for multiregion aurora
Browse files Browse the repository at this point in the history
  • Loading branch information
coleapz committed Dec 9, 2024
1 parent f0df08a commit 8c526bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 28 deletions.
22 changes: 1 addition & 21 deletions service_capacity_modeling/models/org/netflix/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,35 +34,15 @@ def capacity_plan(
if desires.service_tier == 0:
return None

require_multi_region: bool = context.num_regions > 1
plan = None
if Platform.aurora_postgres in instance.platforms and not require_multi_region:
if Platform.aurora_postgres in instance.platforms:
plan = nflx_aurora_capacity_model.capacity_plan(
instance=instance,
drive=drive,
context=context,
desires=desires,
extra_model_arguments=extra_model_arguments,
)

if plan is not None:
return plan

if set(nflx_cockroachdb_capacity_model.allowed_platforms()).intersection(
instance.platforms
):
plan = nflx_cockroachdb_capacity_model.capacity_plan(
instance=instance,
drive=drive,
context=context,
desires=desires,
extra_model_arguments=extra_model_arguments,
)
if plan is not None:
# We want to lower the rank so this plan will only be chosen when no other
# workaround
plan.rank = 1

return plan

@staticmethod
Expand Down
10 changes: 3 additions & 7 deletions tests/netflix/test_postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def test_small_footprint_multi_region():
desires=small_footprint,
num_regions=3,
)
assert cap_plan[0].candidate_clusters.zonal[0].instance.name == "m5d.xlarge"
assert cap_plan[0].candidate_clusters.regional[0].instance.name == "db.r5.large"

assert 2000 < cap_plan[0].candidate_clusters.total_annual_cost < 4000

Expand All @@ -126,12 +126,8 @@ def test_large_footprint():
desires=large_footprint,
num_regions=1,
)
# Aurora cannot handle the scale, so pick crdb
assert cap_plan[0].candidate_clusters.zonal[0].instance.name == "i3.xlarge"
assert cap_plan[0].candidate_clusters.zonal[0].count == 41

assert 100_000 < cap_plan[0].candidate_clusters.total_annual_cost < 150_000

#Aurora cannot handle the scale, so don't recommend anything
assert cap_plan == []

def test_tier_3():
cap_plan = planner.plan_certain(
Expand Down

0 comments on commit 8c526bb

Please sign in to comment.