Skip to content

guidellm.benchmark.profiles.synchronous

Synchronous benchmark profile.

SynchronousProfile

Bases: Profile

Execute single synchronous strategy for baseline performance metrics.

Executes requests sequentially with one request at a time, establishing baseline performance metrics without concurrent execution overhead.

Source code in src/guidellm/benchmark/profiles/synchronous.py
@ProfileFactory.register("synchronous")
class SynchronousProfile(Profile):
    """
    Execute single synchronous strategy for baseline performance metrics.

    Executes requests sequentially with one request at a time, establishing
    baseline performance metrics without concurrent execution overhead.
    """

    args: SynchronousProfileArgs

    def __init__(
        self,
        args: SynchronousProfileArgs,
        random_seed: int,
        constraints: MutableMapping[str, ConstraintInitializer | Any] | None,
        **kwargs: Any,
    ):
        super().__init__(args, random_seed, constraints, **kwargs)
        self.args = args

    @property
    def strategy_types(self) -> list[str]:
        """
        :return: Single synchronous strategy type
        """
        return [self.kind]

    def next_strategy(
        self,
        prev_strategy: SchedulingStrategy | None,
        prev_benchmark: Benchmark | None,
    ) -> SynchronousStrategy | None:
        """
        Generate synchronous strategy for first execution only.

        :param prev_strategy: Previously completed strategy (unused)
        :param prev_benchmark: Benchmark results from previous execution (unused)
        :return: SynchronousStrategy for first execution, None afterward
        """
        _ = (prev_strategy, prev_benchmark)  # unused
        if len(self.completed_strategies) >= 1:
            return None

        return SynchronousStrategy()

strategy_types property

Returns:

Type Description
list[str]

Single synchronous strategy type

next_strategy(prev_strategy, prev_benchmark)

Generate synchronous strategy for first execution only.

Parameters:

Name Type Description Default
prev_strategy SchedulingStrategy | None

Previously completed strategy (unused)

required
prev_benchmark Benchmark | None

Benchmark results from previous execution (unused)

required

Returns:

Type Description
SynchronousStrategy | None

SynchronousStrategy for first execution, None afterward

Source code in src/guidellm/benchmark/profiles/synchronous.py
def next_strategy(
    self,
    prev_strategy: SchedulingStrategy | None,
    prev_benchmark: Benchmark | None,
) -> SynchronousStrategy | None:
    """
    Generate synchronous strategy for first execution only.

    :param prev_strategy: Previously completed strategy (unused)
    :param prev_benchmark: Benchmark results from previous execution (unused)
    :return: SynchronousStrategy for first execution, None afterward
    """
    _ = (prev_strategy, prev_benchmark)  # unused
    if len(self.completed_strategies) >= 1:
        return None

    return SynchronousStrategy()

SynchronousProfileArgs

Bases: ProfileArgs

Pydantic model for synchronous profile creation arguments.

Source code in src/guidellm/benchmark/profiles/synchronous.py
@ProfileArgs.register("synchronous")
class SynchronousProfileArgs(ProfileArgs):
    """Pydantic model for synchronous profile creation arguments."""

    kind: Literal["synchronous"] = Field(
        default="synchronous",
        description="Profile type discriminator for synchronous scheduling",
    )