service_capacity_modeling/models/org/netflix/evcache.py
def _estimate_evcache_requirement(
    instance: Instance,
    desires: CapacityDesires,
    working_set: float,
    copies_per_region: int,
    zones_per_region: int = 3,
) -> Tuple[CapacityRequirement, Tuple[str, ...]]:
    """Estimate the capacity required for one zone given a regional desire

    The input desires should be the **regional** desire, and this function will
    return the zonal capacity requirement
    """
    # EVCache can run at full CPU utilization
    needed_cores = sqrt_staffed_cores(desires)

    # (Arun): Keep 20% of available bandwidth for cache warmer
    needed_network_mbps = simple_network_mbps(desires) * 1.25

    needed_disk = math.ceil(
        desires.data_shape.estimated_state_size_gib.mid * copies_per_region,
    )

    regrets: Tuple[str, ...] = ("spend", "mem")
    # (Arun): As of 2021 we are using ephemerals exclusively and do not
    # use cloud drives
    if instance.drive is None:
        # We can't currently store data on cloud drives, but we can put the
        # dataset into memory!
        needed_memory = float(needed_disk)
        needed_disk = 0
    else:
        # We can store data on fast ephems (reducing the working set that must
        # be kept in RAM)
        needed_memory = float(working_set) * float(needed_disk)
        regrets = ("spend", "disk", "mem")

    # Now convert to per zone
    needed_cores = max(1, needed_cores // zones_per_region)
    if needed_disk > 0:
        needed_disk = max(1, needed_disk // zones_per_region)
    else:
        needed_disk = needed_disk // zones_per_region
    needed_memory = max(1, int(needed_memory // zones_per_region))
    logger.debug(
        "Need (cpu, mem, disk, working) = (%s, %s, %s, %f)",
        needed_cores,
        needed_memory,
        needed_disk,
        working_set,
    )

    return (
        CapacityRequirement(
            requirement_type="evcache-zonal",
            core_reference_ghz=desires.core_reference_ghz,
            cpu_cores=certain_int(needed_cores),
            mem_gib=certain_float(needed_memory),
            disk_gib=certain_float(needed_disk),
            network_mbps=certain_float(needed_network_mbps),
            context={
                "working_set": working_set,
                "replication_factor": copies_per_region,
            },
        ),
        regrets,
    )
Estimate the capacity required for one zone given a regional desire

    The input desires should be the **regional** desire, and this function will
    return the zonal capacity requirement
    
Estimate the capacity required for one zone given a regional desire
The input desires should be the **regional** desire, and this function will
return the zonal capacity requirement
Estimate the capacity required for one zone given a regional desire The input desires should be the ** regional ** desire and this function will return the zonal capacity requirement
def _estimate_evcache_requirement(
    instance: Instance,
    desires: CapacityDesires,
    working_set: float,
    copies_per_region: int,
    zones_per_region: int = 3,
) -> Tuple[CapacityRequirement, Tuple[str, ...]]:
    needed_cores = sqrt_staffed_cores(desires)
    needed_network_mbps = simple_network_mbps(desires) * 1.25
    needed_disk = math.ceil(
        desires.data_shape.estimated_state_size_gib.mid * copies_per_region,
    )
    regrets: Tuple[str, ...] = ("spend", "mem")
    if instance.drive is None:
        needed_memory = float(needed_disk)
        needed_disk = 0
    else:
        needed_memory = float(working_set) * float(needed_disk)
        regrets = ("spend", "disk", "mem")
    needed_cores = max(1, needed_cores // zones_per_region)
    if needed_disk > 0:
        needed_disk = max(1, needed_disk // zones_per_region)
    else:
        needed_disk = needed_disk // zones_per_region
    needed_memory = max(1, int(needed_memory // zones_per_region))
    logger.debug(
        "Need (cpu, mem, disk, working) = (%s, %s, %s, %f)",
        needed_cores,
        needed_memory,
        needed_disk,
        working_set,
    )
    return (
        CapacityRequirement(
            requirement_type="evcache-zonal",
            core_reference_ghz=desires.core_reference_ghz,
            cpu_cores=certain_int(needed_cores),
            mem_gib=certain_float(needed_memory),
            disk_gib=certain_float(needed_disk),
            network_mbps=certain_float(needed_network_mbps),
            context={
                "working_set": working_set,
                "replication_factor": copies_per_region,
            },
        ),
        regrets,
    )
def _estimate_evcache_requirement ( instance : Instance , desires : CapacityDesires , working_set : float , copies_per_region : int , zones_per_region : int = 3 , ) -> Tuple [ CapacityRequirement , Tuple [ str , ... ] ] : needed_cores = sqrt_staffed_cores ( desires ) needed_network_mbps = simple_network_mbps ( desires ) * 1.25 needed_disk = math . ceil ( desires . data_shape . estimated_state_size_gib . mid * copies_per_region , ) regrets : Tuple [ str , ... ] = ( "spend" , "mem" ) if instance . drive is None : needed_memory = float ( needed_disk ) needed_disk = 0 else : needed_memory = float ( working_set ) * float ( needed_disk ) regrets = ( "spend" , "disk" , "mem" ) needed_cores = max ( 1 , needed_cores // zones_per_region ) if needed_disk > 0 : needed_disk = max ( 1 , needed_disk // zones_per_region ) else : needed_disk = needed_disk // zones_per_region needed_memory = max ( 1 , int ( needed_memory // zones_per_region ) ) logger . debug ( "Need (cpu, mem, disk, working) = (%s, %s, %s, %f)" , needed_cores , needed_memory , needed_disk , working_set , ) return ( CapacityRequirement ( requirement_type = "evcache-zonal" , core_reference_ghz = desires . core_reference_ghz , cpu_cores = certain_int ( needed_cores ) , mem_gib = certain_float ( needed_memory ) , disk_gib = certain_float ( needed_disk ) , network_mbps = certain_float ( needed_network_mbps ) , context = { "working_set" : working_set , "replication_factor" : copies_per_region , } , ) , regrets , )
Estimate the capacity required for one zone given a regional desire
The input desires should be the **regional** desire, and this function will
return the zonal capacity requirement
Estimate the capacity required for one zone given a regional desire The input desires should be the ** regional ** desire and this function will return the zonal capacity requirement
"""Estimate the capacity required for one zone given a regional desire

    The input desires should be the **regional** desire, and this function will
    return the zonal capacity requirement
    """ # EVCache can run at full CPU utilization # (Arun): Keep 20% of available bandwidth for cache warmer # (Arun): As of 2021 we are using ephemerals exclusively and do not # use cloud drives # We can't currently store data on cloud drives, but we can put the # dataset into memory! # We can store data on fast ephems (reducing the working set that must # be kept in RAM) # Now convert to per zone
instance
Instance
desires
CapacityDesires
working_set
float
copies_per_region
int
zones_per_region
int