Class LoadTester
- java.lang.Object
-
- nzilbb.util.CommandLineProgram
-
- nzilbb.labbcat.util.LoadTester
-
@ProgramDescription("A utility for load-testing LaBB-CAT servers.") public class LoadTester extends nzilbb.util.CommandLineProgramCommand-line utility for load-testing LaBB-CAT servers.This simulates
a numberof simultaneous clients performing the same search taska numberof times, to simulate load conditions.The search task is:
search
- Start a searchgetMatches
- Get all matches (with 5 tokens context)getMatchAnnotations
- Get annotations on two layers for all matchesgetFragments
- Get TextGrids with two tiers for all matchesgetSoundFragments
- Get audio for all matches
Firstly, the total time for each of these, for one client, is measured for "idle" conditions comparison. Then simultaneous clients are started, each repeating the task. When all have finished, the mean time for each of the above is shown.
To invoke the load tester from the command line:
java -classpath lib/nzilbb.ag.jar:bin/nzilbb.labbcat.jar nzilbb.labbcat.util.LoadTester --labbcaturl=url --username=user --password=passwordOther command line options include:
- --clients=n - Number of clients to simulate (default is 3).
- --repetitions=n - Number of clients to simulate (default is 1)
- --clientdelay=n - Number of seconds to wait before starting each new client (default is 5).
- --searchfor=s - The orthography to search for when running searches
(default is
i
) - --maxMatches=n - The maximum number of matches to process (default is 200).
- --verbose - Produce verbose logging.
Once the utility is complete, a report is printed showing the mean time for each step of the task, compared with the idle-conditions time for the same step, e.g.:
Getting statistics when idle......... Match count from searching for "i": 910 Idle conditions: search: 4.339s getMatches: 3.208s getMatchAnnotations: 0.133s getFragments: 66.088s getSoundFragments: 0.675s Simulating 10 clients doing 1 search each............................................................... Load conditions: search: 14.960s (idle: 4.339s) getMatches: 7.820s (idle: 3.208s) getMatchAnnotations: 0.184s (idle: 0.133s) getFragments: 292.374s (idle: 66.088s) getSoundFragments: 0.948s (idle: 0.675s)- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Field Summary
Fields Modifier and Type Field Description static DecimalFormatsecondsDecimal format for seconds.
-
Constructor Summary
Constructors Constructor Description LoadTester()Default constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description IntegergetClientDelay()Getter forclientDelay: Number of seconds to wait before starting each new client.IntegergetClients()Getter forclients: Number of clients to simulate.BooleangetFragments()Getter forfragments: Call getFragments as part of the test.StringgetLabbcatUrl()Getter forlabbcatUrl: Base URL for the LaBB-CAT server.BooleangetMatchAnnotations()Getter formatchAnnotations: Call getMatchAnnotations as part of the test.IntegergetMaxMatches()Getter formaxMatches: The maximum number of matches to process (for annotations and fragments).StringgetOtherLayer()Getter forotherLayer: ID of other layer (apart from orthography) to get annotations from (default is "phonemes").StringgetPassword()Getter forpassword: Password for LaBB-CAT.IntegergetRepetitions()Getter forrepetitions: Number of times each client should repeat the test task.StringgetSearchFor()Getter forsearchFor: The orthography to search for when running searches.BooleangetSoundFragments()Getter forsoundFragments: Call getSoundFragments as part of the test.StringgetUsername()Getter forusername: Username for LaBB-CAT.BooleangetVerbose()Getter forverbose: Whether to produce verbose logging.static voidmain(String[] argv)Main entrypoint.LoadTestersetClientDelay(Integer newClientDelay)Setter forclientDelay: Number of seconds to wait before starting each new client.LoadTestersetClients(Integer newClients)Setter forclients: Number of clients to simulate.LoadTestersetFragments(Boolean newFragments)Setter forfragments: Call getFragments as part of the test.LoadTestersetLabbcatUrl(String newLabbcatUrl)Setter forlabbcatUrl: Base URL for the LaBB-CAT server.LoadTestersetMatchAnnotations(Boolean newMatchAnnotations)Setter formatchAnnotations: Call getMatchAnnotations as part of the test.LoadTestersetMaxMatches(Integer newMaxMatches)Setter formaxMatches: The maximum number of matches to process (for annotations and fragments).LoadTestersetOtherLayer(String newOtherLayer)Setter forotherLayer: ID of other layer (apart from orthography) to get annotations from (default is "phonemes").LoadTestersetPassword(String newPassword)Setter forpassword: Password for LaBB-CAT.LoadTestersetRepetitions(Integer newRepetitions)Setter forrepetitions: Number of times each client should repeat the test task.LoadTestersetSearchFor(String newSearchFor)Setter forsearchFor: The orthography to search for when running searches.LoadTestersetSoundFragments(Boolean newSoundFragments)Setter forsoundFragments: Call getSoundFragments as part of the test.LoadTestersetUsername(String newUsername)Setter forusername: Username for LaBB-CAT.LoadTestersetVerbose(Boolean newVerbose)Setter forverbose: Whether to produce verbose logging.voidstart()Start the utility
-
-
-
Field Detail
-
seconds
public static DecimalFormat seconds
Decimal format for seconds.
-
-
Method Detail
-
main
public static void main(String[] argv)
Main entrypoint.- Parameters:
argv- An array of command line parameters.
-
getLabbcatUrl
public String getLabbcatUrl()
Getter forlabbcatUrl: Base URL for the LaBB-CAT server.- Returns:
- Base URL for the LaBB-CAT server.
-
setLabbcatUrl
@Switch(value="Base URL for the LaBB-CAT server.", compulsory=true) public LoadTester setLabbcatUrl(String newLabbcatUrl)Setter forlabbcatUrl: Base URL for the LaBB-CAT server.- Parameters:
newLabbcatUrl- Base URL for the LaBB-CAT server.- Returns:
- A reference to this object, so that setters can be chained.
-
getUsername
public String getUsername()
Getter forusername: Username for LaBB-CAT.- Returns:
- Username for LaBB-CAT.
-
setUsername
@Switch("Username for LaBB-CAT.") public LoadTester setUsername(String newUsername)Setter forusername: Username for LaBB-CAT.- Parameters:
newUsername- Username for LaBB-CAT.- Returns:
- A reference to this object, so that setters can be chained.
-
getPassword
public String getPassword()
Getter forpassword: Password for LaBB-CAT.- Returns:
- Password for LaBB-CAT.
-
setPassword
@Switch("Password for LaBB-CAT.") public LoadTester setPassword(String newPassword)Setter forpassword: Password for LaBB-CAT.- Parameters:
newPassword- Password for LaBB-CAT.- Returns:
- A reference to this object, so that setters can be chained.
-
getClients
public Integer getClients()
Getter forclients: Number of clients to simulate.- Returns:
- Number of clients to simulate.
-
setClients
@Switch("Number of clients to simulate (default is 3).") public LoadTester setClients(Integer newClients)Setter forclients: Number of clients to simulate.- Parameters:
newClients- Number of clients to simulate.- Returns:
- A reference to this object, so that setters can be chained.
-
getRepetitions
public Integer getRepetitions()
Getter forrepetitions: Number of times each client should repeat the test task.- Returns:
- Number of times each client should repeat the test task.
-
setRepetitions
@Switch("Number of times each client should repeat the test task (default is 1).") public LoadTester setRepetitions(Integer newRepetitions)Setter forrepetitions: Number of times each client should repeat the test task.- Parameters:
newRepetitions- Number of times each client should repeat the test task.- Returns:
- A reference to this object, so that setters can be chained.
-
getClientDelay
public Integer getClientDelay()
Getter forclientDelay: Number of seconds to wait before starting each new client.- Returns:
- Number of seconds to wait before starting each new client.
-
setClientDelay
@Switch("Number of seconds to wait before starting each new client (default is 5).") public LoadTester setClientDelay(Integer newClientDelay)Setter forclientDelay: Number of seconds to wait before starting each new client.- Parameters:
newClientDelay- Number of seconds to wait before starting each new client.- Returns:
- A reference to this object, so that setters can be chained.
-
getSearchFor
public String getSearchFor()
Getter forsearchFor: The orthography to search for when running searches.- Returns:
- The orthography to search for when running searches.
-
setSearchFor
@Switch("The orthography to search for when running searches (default is \"i\").") public LoadTester setSearchFor(String newSearchFor)Setter forsearchFor: The orthography to search for when running searches.- Parameters:
newSearchFor- The orthography to search for when running searches.- Returns:
- A reference to this object, so that setters can be chained.
-
getOtherLayer
public String getOtherLayer()
Getter forotherLayer: ID of other layer (apart from orthography) to get annotations from (default is "phonemes").- Returns:
- ID of other layer (apart from orthography) to get annotations from (default is "phonemes").
-
setOtherLayer
@Switch("ID of other layer (apart from orthography) to get annotations from (default is \"phonemes\").") public LoadTester setOtherLayer(String newOtherLayer)Setter forotherLayer: ID of other layer (apart from orthography) to get annotations from (default is "phonemes").- Parameters:
newOtherLayer- ID of other layer (apart from orthography) to get annotations from (default is "phonemes").- Returns:
- A reference to this object, so that setters can be chained.
-
getMaxMatches
public Integer getMaxMatches()
Getter formaxMatches: The maximum number of matches to process (for annotations and fragments).- Returns:
- The maximum number of matches to process (for annotations and fragments).
-
setMaxMatches
@Switch("The maximum number of matches to process (default is 200).") public LoadTester setMaxMatches(Integer newMaxMatches)Setter formaxMatches: The maximum number of matches to process (for annotations and fragments).- Parameters:
newMaxMatches- The maximum number of matches to process (for annotations and fragments).- Returns:
- A reference to this object, so that setters can be chained.
-
getMatchAnnotations
public Boolean getMatchAnnotations()
Getter formatchAnnotations: Call getMatchAnnotations as part of the test.- Returns:
- Call getMatchAnnotations as part of the test.
-
setMatchAnnotations
@Switch("Call getMatchAnnotations as part of the test (default is TRUE).") public LoadTester setMatchAnnotations(Boolean newMatchAnnotations)Setter formatchAnnotations: Call getMatchAnnotations as part of the test.- Parameters:
newMatchAnnotations- Call getMatchAnnotations as part of the test.- Returns:
- A reference to this object, so that setters can be chained.
-
getFragments
public Boolean getFragments()
Getter forfragments: Call getFragments as part of the test.- Returns:
- Call getFragments as part of the test.
-
setFragments
@Switch("Call getFragments as part of the test (default is TRUE).") public LoadTester setFragments(Boolean newFragments)Setter forfragments: Call getFragments as part of the test.- Parameters:
newFragments- Call getFragments as part of the test.- Returns:
- A reference to this object, so that setters can be chained.
-
getSoundFragments
public Boolean getSoundFragments()
Getter forsoundFragments: Call getSoundFragments as part of the test.- Returns:
- Call getSoundFragments as part of the test.
-
setSoundFragments
@Switch("Call getSoundFragments as part of the test (default is TRUE).") public LoadTester setSoundFragments(Boolean newSoundFragments)Setter forsoundFragments: Call getSoundFragments as part of the test.- Parameters:
newSoundFragments- Call getSoundFragments as part of the test.- Returns:
- A reference to this object, so that setters can be chained.
-
getVerbose
public Boolean getVerbose()
Getter forverbose: Whether to produce verbose logging.- Returns:
- Whether to produce verbose logging.
-
setVerbose
@Switch("Whether to produce verbose logging.") public LoadTester setVerbose(Boolean newVerbose)Setter forverbose: Whether to produce verbose logging.- Parameters:
newVerbose- Whether to produce verbose logging.- Returns:
- A reference to this object, so that setters can be chained.
-
start
public void start()
Start the utility
-
-