traffic_replay: Add a max-members option to cap group size
authorTim Beale <timbeale@catalyst.net.nz>
Tue, 27 Nov 2018 00:50:32 +0000 (13:50 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 4 Dec 2018 11:22:50 +0000 (12:22 +0100)
commit5517d60653b0aa25a354c3a35cbfb2aa89afb41a
tree8c6c73ac13abfa03a33a8221e22b71c6479ec44a
parent13f57a7f80ea49830509e16b6fb8776962eba74f
traffic_replay: Add a max-members option to cap group size

traffic_replay tries to distribute the users among the groups in a
realistic manner - some groups will have almost all users in them.
However, this becomes a problem when testing a really large database,
e.g. we may want 100K users, but no more than 5K users in each group.

This patch adds a max-member option so we can limit how big the groups
actually get.

If we detect that a group exceeds the max-members, we reset the group's
probability (of getting selected) to zero, and then recalculate the
cumulative distribution. The means that the group should no longer get
selected by generate_random_membership(). (Note we can't completely
remove the group from the list because that changes the
list-index-to-group-ID mapping).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Tue Dec  4 12:22:50 CET 2018 on sn-devel-144
python/samba/emulate/traffic.py
script/traffic_replay