Simulation tools

    The simulation client is a machine which will create and subscribe to topics with configurable message rates and sizes. Because it is sometimes necessary in simulating large load to use multiple client machines, the user does not interact with the simulation client directly, but instead delegates their requests to the simulation controller, which will then send signals to clients to start incurring load. The client implementation is in the class .

    To Start a simulation client, use the pulsar-perf script with the command simulation-client as follows:

    The client will then be ready to receive controller commands.

    To start a simulation controller, use the pulsar-perf script with the command simulation-controller as follows:

    The clients should already be started before the controller is started. You will then be presented with a simple prompt, where you can issue commands to simulation clients. Arguments often refer to tenant names, namespace names, and topic names. In all cases, the BASE name of the tenants, namespaces, and topics are used. For example, for the topic persistent://my_tenant/my_cluster/my_namespace/my_topic, the tenant name is my_tenant, the namespace name is my_namespace, and the topic name is my_topic. The controller can perform the following actions:

    • Create a group of topics with a producer and a consumer
      • trade_group <tenant> <group> <num_namespaces> [--rate <message rate per second>] [--rand-rate <lower bound>,<upper bound>] [--separation <separation between creating topics in ms>] [--size <message size in bytes>] [--topics-per-namespace <number of topics to create per namespace>]
    • Change the configuration of an existing topic
      • change <tenant> <namespace> <topic> [--rate <message rate per second>] [--rand-rate <lower bound>,<upper bound>] [--size <message size in bytes>]
    • Change the configuration of a group of topics
    • Shutdown a previously created group of topics
      • stop_group <tenant> <group>
    • Copy the historical data from one ZooKeeper to another and simulate based on the message rates and sizes in that history
      • copy <tenant> <source zookeeper> <target zookeeper> [--rate-multiplier value]
    • Simulate the load of the historical data on the current ZooKeeper (should be same ZooKeeper being simulated on)
      • simulate <tenant> <zookeeper> [--rate-multiplier value]

    The “group” arguments in these commands allow the user to create or affect multiple topics at once. Groups are created when calling the trade_group command, and all topics from these groups may be subsequently modified or stopped with the change_group and stop_group commands respectively. All ZooKeeper arguments are of the form zookeeper_host:port.

    To observe the behavior of the load manager in these simulations, one may utilize the broker monitor, which is implemented in org.apache.pulsar.testclient.BrokerMonitor. The broker monitor will print tabular load data to the console as it is updated using watchers.

    To start a broker monitor, use the monitor-brokers command in the pulsar-perf script:

    The console will then continuously print load data until it is interrupted.