Skip to content
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

locust executes more number of times than I expected #455

Closed
lyenliang opened this issue Jul 22, 2016 · 1 comment
Closed

locust executes more number of times than I expected #455

lyenliang opened this issue Jul 22, 2016 · 1 comment

Comments

@lyenliang
Copy link

I'm trying to use locust to login my server for 100 times.

Each user has a unique identification number which is represented by id in the code below.

from locust import HttpLocust, TaskSet, task

class UserBehavior(TaskSet):

    @task(1)
    def login(self):
        WebsiteUser.id += 1
        print("WebsiteUser.id: " + str(WebsiteUser.id))
        self.client.post("/index.html", data={})

class WebsiteUser(HttpLocust):
    id = 0
    task_set = UserBehavior
    min_wait=500
    max_wait=500

The way I execute locustfile.py is

locust --host=http://127.0.0.1 -c 100 -r 100 -n 100 --no-web --print-stats

I expected that in the end of the execution, I would see WebsiteUser.id: 100 being printed on my screen.

But I saw WebsiteUser.id: 300. Why is this happening?

The index.html under 127.0.0.1 is a simple file which contains

<html><body><h1>It works!</h1></body></html>.

Here's the final report of the execution:

locust_result2

@giantryansaul
Copy link
Contributor

@lyenliang are you looking at the last request's response time? In your screenshot I see 100 requests being fired.

@cyberw cyberw closed this as completed Oct 18, 2019
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

No branches or pull requests

3 participants