Skip to content

Commit

Permalink
Adds support for disk_io in evcache
Browse files Browse the repository at this point in the history
  • Loading branch information
akashdeepgoel committed May 27, 2024
1 parent d070890 commit a3ada63
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
17 changes: 17 additions & 0 deletions service_capacity_modeling/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,15 @@ def compute_stateful_zone(
# Some stateful clusters have preferences on per zone sizing
cluster_size: Callable[[int], int] = lambda x: x,
min_count: int = 0,
adjusted_disk_io_needed: Optional[float] = 0.0,
read_write_ratio: Optional[float] = 0.0
) -> ZoneClusterCapacity:


#If only reads, then max burst is X reads/s
#If only writes, then max burst is Y writes/s


# Normalize the cores of this instance type to the latency reference
needed_cores = math.ceil(
max(1, needed_cores // (instance.cpu_ghz / core_reference_ghz))
Expand Down Expand Up @@ -269,6 +277,15 @@ def compute_stateful_zone(
):
disk_per_node = min(max_local_disk_gib, instance.drive.size_gib)
count = max(count, math.ceil(needed_disk_gib / disk_per_node))
if adjusted_disk_io_needed != 0.0:
instance_read_iops = drive.read_io_per_s
instance_write_iops = drive.write_io_per_s
instance_adjusted_io = (read_write_ratio * instance_read_iops + \
(1.0 - read_write_ratio) * instance_write_iops) * \
drive.block_size_kib * 1024
if instance_adjusted_io != 0.0:
count = max(count, math.ceil(adjusted_disk_io_needed / instance_adjusted_io))


count = max(cluster_size(count), min_count)
cost = count * instance.annual_cost
Expand Down
16 changes: 16 additions & 0 deletions service_capacity_modeling/models/org/netflix/evcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,20 @@ def reserve_memory(instance_mem_gib):
if desires.service_tier < 1:
min_count = 2

is_disk_io_constraint: bool = requirement.disk_gib > 0.0
adjusted_disk_io_needed = 0.0
read_write_ratio = 0.0
if is_disk_io_constraint:
reads_per_sec = desires.query_pattern.estimated_read_per_second.mid
writes_per_sec = desires.query_pattern.estimated_write_per_second.mid
read_size = desires.query_pattern.estimated_mean_read_size_bytes.mid
write_size = desires.query_pattern.estimated_mean_write_size_bytes.mid
read_disk_io_needed = reads_per_sec * read_size
write_disk_io_needed = writes_per_sec * write_size
adjusted_disk_io_needed = (reads_per_sec * read_disk_io_needed + writes_per_sec * write_disk_io_needed) / \
(reads_per_sec + writes_per_sec)
read_write_ratio = reads_per_sec / (reads_per_sec + writes_per_sec)

cluster = compute_stateful_zone(
instance=instance,
drive=drive,
Expand All @@ -248,6 +262,8 @@ def reserve_memory(instance_mem_gib):
# Sidecars and Variable OS Memory
reserve_memory=lambda x: base_mem,
core_reference_ghz=requirement.core_reference_ghz,
adjusted_disk_io_needed = adjusted_disk_io_needed,
read_write_ratio = read_write_ratio
)
# Communicate to the actual provision that if we want reduced RF
params = {"evcache.copies": copies_per_region}
Expand Down

0 comments on commit a3ada63

Please sign in to comment.