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

Need Clarification #70

Closed
sumeetb opened this issue May 3, 2013 · 5 comments
Closed

Need Clarification #70

sumeetb opened this issue May 3, 2013 · 5 comments

Comments

@sumeetb
Copy link

sumeetb commented May 3, 2013

Hi,

I faced lot of issues with Jmeter and other performance tool and this tool seems to be really nice. I have just started learning locust tool for performance testing. I have some basic questions regarding the same.

1.Single Locust class resembles single user as per the document, is it mean if we want to simulate thousands of user’s then we need to define thousand locust classes? –c command line option represents number of clients (users) but I think it would create multiple instance of same class which would represent cloning of users. Please clarify.
2.How the test data can be controlled? Does it provide mechanism to input test data for example users information’s (username and password), different files to be uploaded by different users etc from external file like csv/excel/xml? I didn’t find anything in documents

Could you please clarify above queries?

Thanks,
Sumeet

@Jahaja
Copy link
Member

Jahaja commented May 3, 2013

Hi Sumeet,

  1. No, the idea is that you write a Locust class that simulates some kind of user. Most often you only need one Locust class that simulates the normal user. What sets them apart is the randomness of the tasks picked for each instance/user and the state that you can save for each user - and use in subsequent requests. Normally you write code yourself to assign each user/instance a unique id or username so it can perceed to login or something similar.
  2. I've partially already answer that in 1, but to clarify you need to write your own code to set data each user/instance. Perhaps just randomizing from a list or between some number range is sufficient for your use-case. This list could of course be read from a csv or similar using the normal python libraries.

@sumeetb
Copy link
Author

sumeetb commented May 16, 2013

Hi Jahaja,

Thanks a lot for clarifying my doubts. I did use external CSV as test data and passed on to different user/instance. It is working fine now. I have couple of more questions and hope you don’t mind to clarify the same. :)

1.Host parameter needs to be set either from command line or in main locust class. But in my scenarios we have multiple hosts to be used to send and receive data. Like POST on host1, GET on host2 etc. Is there any way I can have multiple host parameters to be used in the “taskset” for the different requests in locust class? The hard coded URL can be used while sending/receiving requests in task-set class but then it will create connection at the time of sending/receiving request which I think won’t be right way to do it.

2.Any user can pick any task as per the weighted for the task decorator even after completing their assigned task? Or at the start of test if particular user has been assigned specific random task then it is going to run the same task again and again throughout the test?

Thanks,
Sumeet

@heyman
Copy link
Member

heyman commented May 16, 2013

Hi sumeet!

  1. By default Locust's client runs with keep_alive turned off. So normally, a connection will be made for each request anyway. There are plans for making the client more "pluggable" so that you can easily roll your own client, but until that is implemented, you could override the init method of the Locust class (
    def __init__(self):
    ) to initialize the client with the base host of your choice.
  2. Once a Locust user has executed a task in a taskset, it will pick another task randomly as per the tasks' weight, to execute (after it has been idling during it's wait time).

@heyman
Copy link
Member

heyman commented May 21, 2013

I'm closing this now, but feel free to re-open it if you have more questions.

@heyman heyman closed this as completed May 21, 2013
pancaprima added a commit to pancaprima/locust that referenced this issue Aug 21, 2018
* find locustfile in the root directory

* Add ability to write out csv file data as part of command line run

* Update minimum version of gevent to fix locustio#598

* CSV flag, review comments

* Modify gevent wsgi and libev dependencies

* Sort all python imports

* Sort setup.py imports

* Standardize utf8 file coding declarations

* Bump version to 0.8a3 for another pre-release candidate

* Changed from deprecated method name

* Added test_suite argument to setup.py’s setup() method call

Not specifying the test_suite argument (using the default one) resulted in all tests being run multiple times (on Python 3.5). I haven’t looked in to why, since specifying “locust.test” should be correct, and fixes it.

* Suppress a warning that appears when running the tests on Python 3, that can cause tests (that depends on output to stderr) to fail.

* Apply gevent monkey patching before we import requests, to avoid infinite recursion error when doing SSL requests. Should fix locustio#655.

* Also patch threading when applying gevent monkey patch. Should fix locustio#569.

* Bumped version to 0.8a4

* Improved changelog

* Update main.py

Code comment and slightly more descriptive variable name

* More info about 0.8 to the Changelog

* Added some random examples that maybe could be useful to someone

* Bumped version to 0.8

* Upgrade pyzmq to latest stable version, and changed so that we do not pin the version (will make it easier to install Locust on Windows)

* Better installation instructions for Windows

* Bumped version to 0.8.1
pancaprima added a commit to pancaprima/locust that referenced this issue Aug 27, 2018
* Prima Update locust base version to 0.8.1 (locustio#70)

* find locustfile in the root directory

* Add ability to write out csv file data as part of command line run

* Update minimum version of gevent to fix locustio#598

* CSV flag, review comments

* Modify gevent wsgi and libev dependencies

* Sort all python imports

* Sort setup.py imports

* Standardize utf8 file coding declarations

* Bump version to 0.8a3 for another pre-release candidate

* Changed from deprecated method name

* Added test_suite argument to setup.py’s setup() method call

Not specifying the test_suite argument (using the default one) resulted in all tests being run multiple times (on Python 3.5). I haven’t looked in to why, since specifying “locust.test” should be correct, and fixes it.

* Suppress a warning that appears when running the tests on Python 3, that can cause tests (that depends on output to stderr) to fail.

* Apply gevent monkey patching before we import requests, to avoid infinite recursion error when doing SSL requests. Should fix locustio#655.

* Also patch threading when applying gevent monkey patch. Should fix locustio#569.

* Bumped version to 0.8a4

* Improved changelog

* Update main.py

Code comment and slightly more descriptive variable name

* More info about 0.8 to the Changelog

* Added some random examples that maybe could be useful to someone

* Bumped version to 0.8

* Upgrade pyzmq to latest stable version, and changed so that we do not pin the version (will make it easier to install Locust on Windows)

* Better installation instructions for Windows

* Bumped version to 0.8.1

* Erlangga Add team_configuration property (locustio#72)

* add get team configuration

* change read json path

* Rizal upload json file for team configuration (locustio#68)

* enabling json uploading

* fix modal ui in upload json

* enabling upload on json also

* modify ui a bit and avoid duplicated message

* unify the function

* bug fix team configuration function (locustio#88)

* change team_configuration function

* update configuration works
@ruchikaChawla
Copy link

Hello Everyone,

I were using jmeter till now but i saw it is taking lots of resources and memory to run,
so now i started reading locust. i am new to locust.
i want to use locust in no-web mode e.g $ locust -f locust_files/my_locust_file.py --no-web -c 1000 -r 100 but same as above question , i dont want to hard code the URL or you can say header parameter like unique request id and all, i want to pass it from command line, like we can pass in jmeter and we can get it in configuration file using __P() function.
how we can get the same thing in locust, i know the way of using environment variables but i do not want to use this.

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

4 participants