Skip to content

Fixes #3134 - Improve the performance of the /stats/requests endpoint #3136

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

Merged
merged 1 commit into from
May 11, 2025

Conversation

orf
Copy link
Contributor

@orf orf commented May 9, 2025

With the following pathological locustfile, the following change hugely reduces the time it takes to call the /stats/requests endpoint.

import uuid
from locust import FastHttpUser, between, task 

class User(FastHttpUser):
    wait_time = between(1, 5)

    @task
    def call(self):
        self.client.get(
            f"/some-endpoint?a={uuid.uuid4()}",
            json=None,
        )

With the existing code, the endpoint almost immediately takes >100ms to execute:

Screenshot 2025-05-09 at 14 04 18

Whereas with this branch, it stays around 50ms consistently:

Screenshot 2025-05-09 at 14 07 06

Fixes #3134

@cyberw
Copy link
Collaborator

cyberw commented May 9, 2025

Love it! But leave some version of the comment in place, to explain why we're truncating.

@orf orf force-pushed the fix-perf-issue branch from 2153f17 to 1e64cc1 Compare May 10, 2025 19:12
@orf
Copy link
Contributor Author

orf commented May 10, 2025

Thanks @cyberw! I've updated the branch to retain the comment

@cyberw cyberw merged commit b0c3ff3 into locustio:master May 11, 2025
16 checks passed
@orf orf deleted the fix-perf-issue branch May 11, 2025 18:52
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.

p95 response time increases with the number of unique URLs
2 participants