Thread Items offer a range of sophisticated options for configuration of how they start, stop and execute threads. This section explains these configuration options in detail.
For reference, a diagram below is shown of the Thread Item properties page:
When you begin load testing a web site you need to determine how much load you wish to try and create. This in turn depends on many factors and constraints, and of course, on the requirements of your web site. The following are points to consider when setting the maximum number of Threads:
When you start Threads, they do not continue running forever. Rather, they run for a programmed amount of time that is controlled by settings in the Thread Item properties. The primary setting for this is the Duration. Badboy offers three options for how to control the duration of a Thread Item's threads:
If you find your threads don't seem to be running, check if you chose "Stop when step exits" for duration. If you choose this option and your Script finishes playing your threads may be aborting before they even started. Try setting a fixed interval to experiment with playing your threads.
Often it is not desirable to have threads all start at once because all the steps are then "synchronized" which does not mirror normal user behavior. For example, while it might be common for your web site to have 100 users at any one time, it would be very unusual for all those users to decide to login at exactly the same instant. Another problem is that starting all the threads at the same time does not allow you to observe the effects of how the system behaves as load increases. Badboy allows you therefore to start and stop threads gradually by setting a number of threads to start and an interval in seconds to space each group of threads by.
In addition to the limitations mentioned for the different Browser Engines, there are some obvious limitations when you are running items in threads as opposed to executing them in a real browser, since many items in Badboy depend on the presence of a real browser interface in order to work. These include
To see if items are not playing correctly in background threads, enable the log file and set it to INFO level in the Preferences. Then after playing your Thread Item you can look for any warnings in the log file which will tell you any items that are unable to play properly because of being embedded in a Thread Item. Of course, you can also add Content Checks to validate the returned HTML as well.
You may encounter situations where your script needs to ensure different data is used by each thread. For example, each thread might need its own login account if your system only allows a user to login to a single session at a time.
To achieve this easily, Badboy provides a special "threadNum" variable that you can use to access different data in different threads. An example of how to do this is illustrated in the following steps:
This will cause your script to access the value of "foo" according to the index $threadNum, which is set by Badboy for each thread automatically for you.
Badboy has elementary support for Basic Authentication in threads. You can enable this by setting environment variables as described in the table below:
|BADBOY_AUTH_USER||User name supplied for HTTP Basic Authentication|
|BADBOY_AUTH_PASSWORD||Password supplied for HTTP Basic Authentication|
|BADBOY_PROXY_AUTH_USER||User name supplied for Proxy Authentication|
|BADBOY_PROXY_AUTH_PASSWORD||Password supplied for Proxy Authentication|