Skip to content

auto-calculate --users from --requests_per_sec to target QPS is achieved#343

Merged
ajit-vijayakumar merged 1 commit intomainfrom
zeke-set-users-to-achieve-qps
Mar 4, 2026
Merged

auto-calculate --users from --requests_per_sec to target QPS is achieved#343
ajit-vijayakumar merged 1 commit intomainfrom
zeke-set-users-to-achieve-qps

Conversation

@zeke-emerson
Copy link
Contributor

Problem

When --requests_per_sec is set but --users is left at its default of 1, the benchmark often can't achieve the target QPS. Each user issues requests sequentially, so a single user's max throughput is bounded by request latency (1 / latency). Users have to manually calculate and set --users to work around this, which is error-prone.

Solution

Auto-calculate --users from --requests_per_sec when not explicitly provided. Assuming a conservative 500ms request latency, each user can do ~2 req/s, so we provision ceil(qps * 0.5) users. Explicit --users still overrides the calculation. When --requests_per_sec is not set (unlimited), defaults to 1 user as before.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update
  • Infrastructure change (CI configs, etc)
  • Non-code change (docs, etc)
  • None of the above: (explain here)

Test Plan

  • Run with --requests_per_sec=100 and no --users: startup log shows users=50
  • Run with no --requests_per_sec and no --users: startup log shows users=1 (backward compat)
  • Run with --requests_per_sec=100 --users=10: startup log shows users=10 (explicit override)
  • Run with --requests_per_sec=1 and no --users: startup log shows users=1 (low QPS edge case)

Copy link

@ajit-vijayakumar ajit-vijayakumar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ajit-vijayakumar ajit-vijayakumar merged commit 44938a4 into main Mar 4, 2026
4 checks passed
@ajit-vijayakumar ajit-vijayakumar deleted the zeke-set-users-to-achieve-qps branch March 4, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants