Skip to content

WIP: Implement POC incremental mode #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
28 changes: 24 additions & 4 deletions src/guidellm/scheduler/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,12 @@ def request_times(self) -> Generator[float, None, None]:

:return: A generator that yields timestamps for request scheduling.
"""
incremental_mode = "linear" # constant, linear, exponential
linear_increment = 0.1
exponential_base = 1.1

start_time = time.time()
constant_increment = 1.0 / self.rate
base_increment = 1.0 / self.rate

# handle bursts first to get to the desired rate
if self.initial_burst is not None:
Expand All @@ -400,15 +404,31 @@ def request_times(self) -> Generator[float, None, None]:
for _ in range(burst_count):
yield start_time

start_time += constant_increment
start_time += base_increment

counter = 0
current_time = start_time

# continue with constant rate after bursting
# continue with the given rate after bursting
while True:
yield start_time + constant_increment * counter
yield current_time
counter += 1

if incremental_mode == "constant":
current_time = start_time + base_increment * counter

elif incremental_mode == "linear":
elapsed_time = current_time - start_time
current_rate = self.rate + (linear_increment * elapsed_time)
increment = 1.0 / current_rate
current_time += increment

elif incremental_mode == "exponential":
elapsed_time = current_time - start_time
current_rate = self.rate * (exponential_base ** elapsed_time)
increment = 1.0 / current_rate
current_time += increment


class AsyncPoissonStrategy(ThroughputStrategy):
"""
Expand Down