Skip to content
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
650 changes: 650 additions & 0 deletions asyncflow_queue_limit/asyncflow_mm1_notebook.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions examples/builder_input/event_injection/lb_two_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
from asyncflow.workload import RqsGenerator

# Runner + Analyzer
from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner


def build_and_run() -> ResultsAnalyzer:
Expand Down
4 changes: 2 additions & 2 deletions examples/builder_input/event_injection/single_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
from asyncflow.workload import RqsGenerator

# Runner + Analyzer
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer


def build_and_run() -> ResultsAnalyzer:
Expand Down
4 changes: 2 additions & 2 deletions examples/builder_input/load_balancer/two_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
from asyncflow.workload import RqsGenerator

# Runner + Analyzer
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer


def main() -> None:
Expand Down
Binary file modified examples/builder_input/single_server/builder_service_plots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions examples/builder_input/single_server/single_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
from asyncflow.workload import RqsGenerator

# Runner + Analyzer
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer


def build_and_run() -> ResultsAnalyzer:
Expand Down
4 changes: 2 additions & 2 deletions examples/yaml_input/event_injections/heavy_single_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import matplotlib.pyplot as plt
import simpy

from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner


def main() -> None:
Expand Down
4 changes: 2 additions & 2 deletions examples/yaml_input/event_injections/lb_two_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import matplotlib.pyplot as plt
import simpy

from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner


def main() -> None:
Expand Down
4 changes: 2 additions & 2 deletions examples/yaml_input/event_injections/single_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import matplotlib.pyplot as plt
import simpy

from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner


def main() -> None:
Expand Down
4 changes: 2 additions & 2 deletions examples/yaml_input/load_balancer/two_servers.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import simpy
import matplotlib.pyplot as plt

from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer


def main() -> None:
Expand Down
4 changes: 2 additions & 2 deletions examples/yaml_input/single_server/single_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
import matplotlib.pyplot as plt

# The only imports a user needs to run a simulation
from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer
from asyncflow.runner.simulation import SimulationRunner

# --- Basic Logging Setup ---
logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s")
Expand Down
5 changes: 3 additions & 2 deletions src/asyncflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from __future__ import annotations

from asyncflow.builder.asyncflow_builder import AsyncFlow
from asyncflow.runtime.simulation_runner import SimulationRunner
from asyncflow.runner.simulation import SimulationRunner
from asyncflow.runner.sweep import Sweep

__all__ = ["AsyncFlow", "SimulationRunner"]
__all__ = ["AsyncFlow", "SimulationRunner", "Sweep"]
6 changes: 4 additions & 2 deletions src/asyncflow/analysis/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"""Public module exposing the results analyzer"""

from asyncflow.metrics.analyzer import ResultsAnalyzer
from asyncflow.metrics.simulation_analyzer import ResultsAnalyzer
from asyncflow.metrics.sweep_analyzer import SweepAnalyzer
from asyncflow.queue_theory_analysis.mm1 import MM1

__all__ = ["ResultsAnalyzer"]
__all__ = ["MM1", "ResultsAnalyzer", "SweepAnalyzer"]
18 changes: 16 additions & 2 deletions src/asyncflow/config/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class SamplePeriods(float, Enum):

STANDARD_TIME = 0.01 # 10 MILLISECONDS
MINIMUM_TIME = 0.001 # 1 MILLISECOND
MAXIMUM_TIME = 0.1 # 100 MILLISECONDS
MAXIMUM_TIME = 0.5 # 500 MILLISECONDS

# ======================================================================
# CONSTANTS FOR EVENT METRICS
Expand All @@ -227,7 +227,13 @@ class EventMetricName(StrEnum):

# Mandatory
RQS_CLOCK = "rqs_clock" # useful to collect starting and finishing time of rqs
# Not mandatory
RQS_SERVER_CLOCK = "rqs_server_clock" #useful for latency and throughput of the server
SERVICE_TIME = "service_time"
IO_TIME = "io_time"
WAITING_TIME = "waiting_time"


# Not mandatory now not implemented
LLM_COST = "llm_cost"


Expand All @@ -240,6 +246,14 @@ class AggregatedMetricName(StrEnum):

LATENCY_STATS = "latency_stats"
THROUGHPUT = "throughput_rps"
SERVER_THROUGHPUT = "server_throughput"
SERVER_LATENCY_STATS = "server_latency_stats"
SERVICE_TIME_STATS = "service_time_stats"
IO_TIME_STATS = "io_time_stats"
WAITING_TIME_STATS = "waiting_time_stats"
UTILIZATION = "utilization"

# now not implemented
LLM_STATS = "llm_stats"

# ======================================================================
Expand Down
4 changes: 3 additions & 1 deletion src/asyncflow/metrics/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
class RqsClock(NamedTuple):
"""
structure to register time of generation and
time of elaboration for each request
time of elaboration for each request during
all the cycle of elaboration starting and ending
with the client
"""

start: float
Expand Down
15 changes: 13 additions & 2 deletions src/asyncflow/metrics/server.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""
initialization of the structure to gather the sampled metrics
for the server of the system
and event metrics for the server of the system
"""

from collections.abc import Iterable
from dataclasses import dataclass

from asyncflow.config.constants import SampledMetricName

Expand Down Expand Up @@ -32,3 +32,14 @@ def build_server_metrics(
metric: [] for metric in SERVER_METRICS
if metric in enabled_sample_metrics
}

# For the client we choosed a named tuple, here we prefer
# a dataclass because we need mutability since start and
# are updated in two different steps
@dataclass
class ServerClock:
"""Server-side request timing: start + finish."""

start: float
finish: float | None = None

Loading