Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 3 additions & 5 deletions llmdbenchmark/analysis/scripts/nop-analyze_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,9 @@ def write_fma_metrics( # pylint: disable=too-many-locals,too-many-statements

file.write("\n\n")
file.write("Actuation Conditions:\n")
file.write(
" T_luke_warm: when new launcher created by Dual Pod Controller + new vLLM\n"
)
file.write(" T_warm: when existing launcher creates new vLLM\n")
file.write(" T_hot: when waking up sleeping vLLM\n\n")
file.write(" T_cold_launcher: DPC creates new launcher + new vLLM instance\n")
file.write(" T_warm: existing launcher creates new vLLM instance\n")
file.write(" T_hot: waking sleeping vLLM instance\n\n")
file.write("T_actuation: Time for the Requester Pod to be ready\n")
file.write("TTRD: Time for the Requester Pod to have dual label set\n")
file.write("T_first_token: Time for vLLM server to return first token\n")
Expand Down
83 changes: 74 additions & 9 deletions workload/harnesses/fma_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ class FMALauncherInfo: # pylint: disable=too-many-instance-attributes
vllm_endpoint: str = ""
ttft: float = 0.0
actuation_condition: FMAActuationCondition | None = None
launcher_creation_timestamp: float = 0.0
t_wake: float | None = None
t_instance_create: float | None = None
t_cold_launcher: float | None = None

def dump(self) -> dict[str, Any]:
"""Convert FMALauncherInfo to dict.
Expand All @@ -102,9 +106,9 @@ def dump(self) -> dict[str, Any]:
class FMAActuationCondition(StrEnum):
"""Type of actuation"""

T_LUKE_WARM = "T_luke_warm" # when new launcher created by DPC + new vllm
T_WARM = "T_warm" # when existing launcher creates new vllm
T_HOT = "T_hot" # when waking up sleeping vllm
T_COLD_LAUNCHER = "T_cold_launcher" # DPC creates new launcher + new vllm
T_WARM = "T_warm" # existing launcher creates new vllm
T_HOT = "T_hot" # waking sleeping vllm

def dump(self) -> str:
"""Convert FMAActuationCondition to str.
Expand All @@ -121,6 +125,9 @@ class FMAMetricsIteration:

iteration: int
launcher_infos: list[FMALauncherInfo]
hot_hit_rate: float = 0.0
warm_hit_rate: float = 0.0
cold_launcher_rate: float = 0.0
Comment thread
aavarghese marked this conversation as resolved.
Outdated

def dump(self) -> dict[str, Any]:
"""Convert FMAMetricsIteration to dict.
Expand Down Expand Up @@ -268,6 +275,11 @@ def get_fma_launcher_infos( # pylint: disable=too-many-locals,too-many-argument
launcher_info.container_name = container.name
launcher_info.name = engine.name
launcher_info.requester_info = requester_info
launcher_info.launcher_creation_timestamp = (
launcher_pod.metadata.creation_timestamp.astimezone(
timezone.utc
).timestamp()
)
launcher_info.launcher_endpoint = (
f"http://{launcher_pod_ip}:{fma_launcher_port}"
)
Expand Down Expand Up @@ -832,20 +844,73 @@ def benchmark_fma( # pylint: disable=too-many-arguments,too-many-positional-arg
FMAActuationCondition.T_HOT
)

# TODO: Improve the warm/luke_warm check instead of pod name
if launcher_info.actuation_condition is None:
launcher_info.actuation_condition = (
FMAActuationCondition.T_WARM
if launcher_info.name.startswith("launcher-fma-")
else FMAActuationCondition.T_LUKE_WARM
if (
launcher_info.launcher_creation_timestamp > 0.0
and launcher_info.requester_info.creation_timestamp
> 0.0
and launcher_info.launcher_creation_timestamp
< launcher_info.requester_info.creation_timestamp
):
launcher_info.actuation_condition = (
FMAActuationCondition.T_WARM
)
else:
launcher_info.actuation_condition = (
FMAActuationCondition.T_COLD_LAUNCHER
)

# Compute per-path timing (upper bound via Kube timestamps)
ready_ts = launcher_info.requester_info.ready_timestamp
Comment thread
aavarghese marked this conversation as resolved.
creation_ts = launcher_info.requester_info.creation_timestamp
if (
launcher_info.actuation_condition
== FMAActuationCondition.T_HOT
and ready_ts > 0.0
):
launcher_info.t_wake = ready_ts - creation_ts
elif (
launcher_info.actuation_condition
== FMAActuationCondition.T_WARM
and ready_ts > 0.0
):
launcher_info.t_instance_create = ready_ts - creation_ts
elif (
launcher_info.actuation_condition
== FMAActuationCondition.T_COLD_LAUNCHER
and ready_ts > 0.0
and launcher_info.launcher_creation_timestamp > 0.0
):
launcher_info.t_cold_launcher = (
ready_ts - launcher_info.launcher_creation_timestamp
)

except Exception as e:
raise RuntimeError(
f"error on benchmark FMA '{launcher_info.name}' launcher"
) from e

fma_metrics_iteration = FMAMetricsIteration(iteration, launcher_infos)
# Compute hit rates for this iteration
total = len(launcher_infos)
hot_count = sum(
li.actuation_condition == FMAActuationCondition.T_HOT
for li in launcher_infos
)
warm_count = sum(
li.actuation_condition == FMAActuationCondition.T_WARM
for li in launcher_infos
)
cold_count = sum(
li.actuation_condition == FMAActuationCondition.T_COLD_LAUNCHER
for li in launcher_infos
)
fma_metrics_iteration = FMAMetricsIteration(
iteration,
launcher_infos,
hot_hit_rate=hot_count / total if total > 0 else 0.0,
warm_hit_rate=warm_count / total if total > 0 else 0.0,
cold_launcher_rate=cold_count / total if total > 0 else 0.0,
)
fma_metrics.iterations.append(fma_metrics_iteration)
finally:
logger.info("Benchmark FMA iteration '%d' end.", iteration)
Expand Down
Loading