Skip to content

guidellm.benchmark.profiles.throughput

Throughput benchmark profile.

ThroughputProfile

Bases: Profile

Maximize system throughput with optional concurrency constraints.

Maximizes system throughput by maintaining maximum concurrent requests, optionally constrained by a concurrency limit.

Source code in src/guidellm/benchmark/profiles/throughput.py
@ProfileFactory.register("throughput")
class ThroughputProfile(Profile):
    """
    Maximize system throughput with optional concurrency constraints.

    Maximizes system throughput by maintaining maximum concurrent requests,
    optionally constrained by a concurrency limit.
    """

    args: ThroughputProfileArgs

    def __init__(
        self,
        args: ThroughputProfileArgs,
        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 throughput strategy type
        """
        return [self.kind]

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

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

        return ThroughputStrategy(
            max_concurrency=self.args.max_concurrency,
            rampup_duration=self.args.rampup_duration,
        )

strategy_types property

Returns:

Type Description
list[str]

Single throughput strategy type

next_strategy(prev_strategy, prev_benchmark)

Generate throughput 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
ThroughputStrategy | None

ThroughputStrategy for first execution, None afterward

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

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

    return ThroughputStrategy(
        max_concurrency=self.args.max_concurrency,
        rampup_duration=self.args.rampup_duration,
    )

ThroughputProfileArgs

Bases: ProfileArgs

Pydantic model for throughput profile creation arguments.

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

    kind: Literal["throughput"] = Field(
        default="throughput",
        description="Profile type discriminator for throughput scheduling",
    )
    max_concurrency: PositiveInt | None = Field(
        description="Maximum concurrent requests to schedule",
        examples=[10],
    )