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.CommandLineProgram
Command-line utility for load-testing LaBB-CAT servers.

This simulates a number of simultaneous clients performing the same search task a number of times, to simulate load conditions.

The search task is:

  1. search - Start a search
  2. getMatches - Get all matches (with 5 tokens context)
  3. getMatchAnnotations - Get annotations on two layers for all matches
  4. getFragments - Get TextGrids with two tiers for all matches
  5. getSoundFragments - 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=password

Other 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 Details

    • seconds

      public static DecimalFormat seconds
      Decimal format for seconds.
  • Constructor Details

    • LoadTester

      public LoadTester()
      Default constructor.
  • Method Details

    • main

      public static void main(String[] argv)
      Main entrypoint.
      Parameters:
      argv - An array of command line parameters.
    • getLabbcatUrl

      public String getLabbcatUrl()
      Getter for labbcatUrl: 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 for labbcatUrl: 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 for username: Username for LaBB-CAT.
      Returns:
      Username for LaBB-CAT.
    • setUsername

      @Switch("Username for LaBB-CAT.") public LoadTester setUsername(String newUsername)
      Setter for username: 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 for password: Password for LaBB-CAT.
      Returns:
      Password for LaBB-CAT.
    • setPassword

      @Switch("Password for LaBB-CAT.") public LoadTester setPassword(String newPassword)
      Setter for password: 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 for clients: 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 for clients: 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 for repetitions: 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 for repetitions: 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 for clientDelay: 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 for clientDelay: 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 for searchFor: 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 for searchFor: 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 for otherLayer: 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 for otherLayer: 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 for maxMatches: 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 for maxMatches: 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 for matchAnnotations: 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 for matchAnnotations: 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 for fragments: 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 for fragments: 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 for soundFragments: 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 for soundFragments: 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 for verbose: Whether to produce verbose logging.
      Returns:
      Whether to produce verbose logging.
    • setVerbose

      @Switch("Whether to produce verbose logging.") public LoadTester setVerbose(Boolean newVerbose)
      Setter for verbose: 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