locust icon indicating copy to clipboard operation
locust copied to clipboard

Enhance benchmark: fixed_count Users, process_time, gc, test case repetition, argparse

Open tdadela opened this issue 1 year ago • 0 comments

Various improvements to the benchmark to make testing changes easier.

Main changes:

  • Disable garbage collector during benchmark.
  • Use time.process_time instead of time.perf_counter.
  • Run only test case with the highest values by default. Run full test matrix with CL flag.
  • Add possibility to test both: fixed_count Users and weight Users.
  • Add possibility to run test cases multiple time with the same arguments.
  • Make saving result files optional.

python benchmarks/dispatch.py --help

usage: dispatch.py [-h] [-f] [-i] [-r REPEAT] [-s]

options:
  -h, --help            show this help message and exit
  -f, --full-benchmark  run benchmark on full test matrix
  -i, --include-fixed-users
                        add test cases when 50 percent of users use User.fixed_count instead of User.weight
  -r REPEAT, --repeat REPEAT
                        number of test cases with the same parameters
  -s, --save-output     save test results to files

Sample output:

python benchmarks/dispatch.py --repeat 3 -i

0001/0006 - 1,000 workers - 1,000,000 users - 1000 user classes - 10,000 users/s - instantiate: 97.862ms - new_dispatch (ramp-up/ramp-down): 12.023ms/18.046ms - cpu_ramp_up: 35.146/26.435/210.435ms - cpu_ramp_down: 17.677/16.491/21.115ms
0002/0006 - 1,000 workers - 1,000,000 users - 1000 user classes - 10,000 users/s - instantiate: 100.659ms - new_dispatch (ramp-up/ramp-down): 12.148ms/12.109ms - cpu_ramp_up: 36.371/19.666/224.432ms - cpu_ramp_down: 8.613/7.935/10.415ms
0003/0006 - 1,000 workers - 1,000,000 users - 1000 user classes - 10,000 users/s - instantiate: 74.954ms - new_dispatch (ramp-up/ramp-down): 11.812ms/13.974ms - cpu_ramp_up: 27.423/17.807/222.145ms - cpu_ramp_down: 8.601/7.928/14.957ms
0004/0006 - 1,000 workers - 1,000,000 users - 1000 user classes - 10,000 users/s - instantiate: 76.153ms - new_dispatch (ramp-up/ramp-down): 12.257ms/12.327ms - cpu_ramp_up: 25.409/17.397/191.678ms - cpu_ramp_down: 8.495/7.844/10.994ms
0005/0006 - 1,000 workers - 1,000,000 users - 1000 user classes - 10,000 users/s - instantiate: 76.443ms - new_dispatch (ramp-up/ramp-down): 12.252ms/12.080ms - cpu_ramp_up: 27.196/17.533/192.777ms - cpu_ramp_down: 8.860/8.057/13.826ms
0006/0006 - 1,000 workers - 1,000,000 users - 1000 user classes - 10,000 users/s - instantiate: 76.852ms - new_dispatch (ramp-up/ramp-down): 12.895ms/12.093ms - cpu_ramp_up: 27.088/17.711/186.650ms - cpu_ramp_down: 8.363/7.826/13.615ms

+---------+-----------+--------------+------------+-------------+-----------+----------------------------+------------------------------+
| Workers | Users     | User Classes | Spawn Rate | Fixed Users | Iteration | Ramp-Up (avg/min/max) (ms) | Ramp-Down (avg/min/max) (ms) |
+---------+-----------+--------------+------------+-------------+-----------+----------------------------+------------------------------+
| 1,000   | 1,000,000 | 1000         | 10,000     | 0%          |     1     |   35.146/26.435/210.435    |     17.677/16.491/21.115     |
| 1,000   | 1,000,000 | 1000         | 10,000     | 0%          |     2     |   36.371/19.666/224.432    |      8.613/7.935/10.415      |
| 1,000   | 1,000,000 | 1000         | 10,000     | 0%          |     3     |   27.423/17.807/222.145    |      8.601/7.928/14.957      |
| 1,000   | 1,000,000 | 1000         | 10,000     | 50%         |     1     |   25.409/17.397/191.678    |      8.495/7.844/10.994      |
| 1,000   | 1,000,000 | 1000         | 10,000     | 50%         |     2     |   27.196/17.533/192.777    |      8.860/8.057/13.826      |
| 1,000   | 1,000,000 | 1000         | 10,000     | 50%         |     3     |   27.088/17.711/186.650    |      8.363/7.826/13.615      |
+---------+-----------+--------------+------------+-------------+-----------+----------------------------+------------------------------+

tdadela avatar Jun 30 '24 20:06 tdadela