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

independent LoadTestShapes for users #1583

Closed
stanislawskwark opened this issue Oct 6, 2020 · 7 comments
Closed

independent LoadTestShapes for users #1583

stanislawskwark opened this issue Oct 6, 2020 · 7 comments
Labels
feature request non-critical stale Issue had no activity. Might still be worth fixing, but dont expect someone else to fix it

Comments

@stanislawskwark
Copy link
Contributor

Describe the solution you'd like

I have a locustfile with 2 users and I would like to have independent LoadTestShapes for them.
Some examples of usage:
constant number of users A and number of users B changing over time
initially big number of users A and small number of users B, and opposite at the end of test
more types of users with independent shapes

Describe alternatives you've considered

I've been thinking about adjusting weights dynamically, but didn't really come up with any nice solution

Additional context

example of shape I would like to get:
image

@cyberw
Copy link
Collaborator

cyberw commented Oct 6, 2020

Makes sense. If it can be done without complicating things too much, I think it is a good idea.

@stanislawskwark
Copy link
Contributor Author

@max-rocket-internet I've seen you are the one who implemented LoadTestShapes functionality, could you guide me a little in this topic? I don't have any experience with development of locust

@max-rocket-internet
Copy link
Contributor

Hi @stanislawskwark, the LoadTestShape class is manipulating the user count during a test on the master. This user count is kind of "global", not per HttpUser. I've not touched any of the HttpUser or weights code so can't really say how it could be implemented but I think not in the same way as LoadTestShape. Sorry I can't offer you any help here 🙂

@aek
Copy link
Contributor

aek commented Dec 11, 2020

Maybe this could be done like the TaskSet nested class or tasks class member with a (list/set/dict) of task/tasksets

Something like this:

class CustomShape1(LoadTestShape):
    def tick(self):
        pass

class CustomUser1(HttpUser):
    shape = CustomShape1

class CustomUser2(HttpUser):
    @shape
    class CustomShape2(LoadTestShape):
        def tick(self):
            pass

To use that design, the method shape_worker should be modified in order to look at the environment user_classes to retrieve custom user shapes to spawn different user count at different spawn_rate. All of this specified at the User level.
I think this could be a good fine grained way to manage user distributions where all the Users should be spawned at least once.

Related to:
#1618
#1635
#1621

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

@github-actions github-actions bot added the stale Issue had no activity. Might still be worth fixing, but dont expect someone else to fix it label Apr 11, 2021
@github-actions
Copy link

This issue was closed because it has been stalled for 10 days with no activity.

@suiluj
Copy link

suiluj commented Jul 10, 2022

Are there any plans on this feature? I just started with locust and look for a solution to define different custom load shapes for different users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request non-critical stale Issue had no activity. Might still be worth fixing, but dont expect someone else to fix it
Projects
None yet
Development

No branches or pull requests

5 participants