How to do it...

After you have downloaded the latest HTest executable (within the releases section of the GitHub page), you can simply call HTest:

./htest  

By default, HTest will listen on port 8000 on 127.0.0.1 and be ready to serve requests. There's a basic web page, which is returned as part of the result and looks like this:

As each request comes in, the hit counter will be incremented, and if any flags for delays, failures, or jitter have been set, then these will also be shown.

We can easily start HTest on different ports, which when testing a load balancer on a single server, is required:

./htest -port 8001  

Details such as the response delay can be set in either of two ways. If you want to start HTest with a delay, this can also be done via a command-line flag:

./htest -responsedelay 20  

This value is in milliseconds (ms). Alternatively, we can also set the delay after the program has started with a simple cURL call:

curl http://localhost:8000/svar/?responsedelay=10  

The advantage to this is that it can be scripted so that you have a stepped test routine, or you can vary it manually to measure the effect it has on your overall load balancer configuration. Here's the full reference table for configuration items:

Field

Value

Example

responsedelay

Delay time (in ms)

10

failurerate

Failure rate of requests (in percent)

5

jitter

Variance of the results (in percent)

2