Skip to content

Commit 7bfc8a2

Browse files
committed
Fix: Interleave RPS worker timings
1 parent e9b59a3 commit 7bfc8a2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/guidellm/scheduler/strategy.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -693,17 +693,20 @@ def create_request_timings(
693693
Divides the total rate evenly across all worker processes to maintain
694694
the specified aggregate rate.
695695
696-
:param local_rank: The rank of the worker process (unused).
696+
:param local_rank: The rank of the worker process.
697697
:param local_world_size: Total number of worker processes for rate division.
698698
:param local_max_concurrency: The maximum number of concurrent requests
699699
for the worker process.
700700
:return: ConstantRateRequestTimings instance with per-worker rate.
701701
"""
702702
# Divide the rate evenly across all worker processes
703703
worker_rate = self.rate / local_world_size
704+
# Start each worker with an offset to interleave rates
705+
worker_offset = (1 / self.rate) * local_rank
704706

705707
return ConstantRateRequestTimings(
706708
rate=worker_rate,
709+
offset=worker_offset,
707710
)
708711

709712

@@ -768,7 +771,11 @@ def create_request_timings(
768771
worker_rate = self.rate / local_world_size
769772
# Use a different seed for each worker to ensure different sequences
770773
worker_seed = self.random_seed + local_rank
774+
# Start each worker with an offset to interleave rates
775+
worker_offset = (1 / self.rate) * local_rank
776+
771777
return PoissonRateRequestTimings(
772778
rate=worker_rate,
773779
random_seed=worker_seed,
780+
offset=worker_offset,
774781
)

0 commit comments

Comments
 (0)