Applies load to your YDB topics, using them as message queues. You can use a variety of input parameters to simulate production load: message number, message size, target write rate, and number of consumers and producers.
As you apply load to your topic, the console displays the results (the number of written messages, message write rate, and others).
Before executing the load, you need to initialize it. During initialization, you will create a topic named workload-topic with the specified options. To initialize the load, run the following command:
Consumer name prefix. Default value: workload-consumer. For example, if the number of consumers --consumers is 2 and the prefix --consumer-prefix is workload-consumer, then the following consumer names will be used: workload-consumer-0, workload-consumer-1.
To create a topic with 256 partitions and 2 consumers, run this command:
View the description of the command that generates the write load:
ydb workload topic run write --help
Subcommand options:
Option name
Option description
--seconds, -s
Test duration in seconds. Default value: 60.
--window, -w
Statistics window in seconds. Default value: 1.
--quiet, -q
Output only the final test result.
--print-timestamp
Print the time together with the statistics of each time window.
--warmup
Test warm-up period (in seconds). Within the period, no statistics are calculated. It's needed to eliminate the effect of transition processes at startup. Default value: 5.
--percentile
Percentile that is output in statistics. Default value: 50.
--topic
Topic name. Default value: workload-topic.
--threads, -t
Number of producer threads. Default value: 1.
--message-size, -m
Message size in bytes. Use the K, M, or G suffix to set the size in KB, MB, or GB, respectively. Default value: 10K.
--message-rate
Total target write rate in messages per second. Can't be used together with the --byte-rate option. Default value: 0 (no limit).
--byte-rate
Total target write rate in bytes per second. Can't be used together with the --message-rate option. Use the K, M, or G suffix to set the rate in KB/s, MB/s, or GB/s, respectively. Default value: 0 (no limit).
--codec
Codec used to compress messages on the client before sending them to the server. Compression increases CPU usage on the client when reading and writing messages, but usually enables you to reduce the amounts of data stored and transmitted over the network. When consumers read messages, they decompress them by the codec that was used to write the messages, with no special options needed. Acceptable values: RAW - no compression (default), GZIP, ZSTD.
To write data to 100 producer threads at the target rate of 80 MB/s for 10 seconds, run this command:
Write speed: Message write rate in messages per second and MB/s.
Write time: Percentile of the message write time, in milliseconds.
Inflight: Maximum number of messages awaiting commit across all partitions.
Read load
This type of load reads messages from the topic asynchronously. To make sure that the topic includes messages, run the write load before you start reading.
General format of the command to generate the read load:
ydb [global options...] workload topic run read [options...]
View the description of the command to generate the read load:
ydb workload topic run read --help
Subcommand options:
Option name
Option description
--seconds, -s
Test duration in seconds. Default value: 60.
--window, -w
Statistics window in seconds. Default value: 1.
--quiet, -q
Output only the final test result.
--print-timestamp
Print the time together with the statistics of each time window.
--warmup
Test warm-up period (in seconds). Within the period, no statistics are calculated. It's needed to eliminate the effect of transition processes at startup. Default value: 5.
--percentile
Percentile that is output in statistics. Default value: 50.
--topic
Topic name. Default value: workload-topic.
--consumers, -c
Number of consumers. Default value: 1.
--consumer-prefix
Consumer name prefix. Default value: workload-consumer. For example, if the number of consumers --consumers is 2 and the prefix --consumer-prefix is workload-consumer, then the following consumer names will be used: workload-consumer-0, workload-consumer-1.
--threads, -t
Number of consumer threads. Default value: 1.
To use 2 consumers to read data from the topic, with 100 threads per consumer, run the following command:
You will see statistics for in-progress time windows and final statistics when the test is complete:
Window Lag Lag time Read speed Full time
# percentile,msg percentile,ms msg/s MB/s percentile,ms
1 0 0 0 0 0
2 30176 0 66578 650 0
3 30176 0 68999 674 0
4 30176 0 66907 653 0
5 27835 0 67628 661 0
6 30176 0 67938 664 0
7 30176 0 71628 700 0
8 20338 0 61367 599 0
9 30176 0 61770 603 0
10 30176 0 58291 569 0
Window Lag Lag time Read speed Full time
# percentile,msg percentile,ms msg/s MB/s percentile,ms
Total 30176 0 80267 784 0
Window: Sequence number of the statistics window.
Lag: Maximum consumer lag in the statistics window. Messages across all partitions are included.
Lag time: Percentile of the message lag time in milliseconds.
Read: Message read rate for the consumer (in messages per second and MB/s).
Full time: Percentile of the full message processing time (from writing by the producer to reading by the consumer), in milliseconds.
Read and write load
This type of load both reads messages from the topic and writes them to the topic asynchronously. This command is equivalent to running both read and write loads in parallel.
General format of the command to generate the read and write load:
ydb [global options...] workload topic run full [options...]
View the description of the command to run the read and write load:
ydb workload topic run full --help
Subcommand options:
Option name
Option description
--seconds, -s
Test duration in seconds. Default value: 60.
--window, -w
Statistics window in seconds. Default value: 1.
--quiet, -q
Output only the final test result.
--print-timestamp
Print the time together with the statistics of each time window.
--warmup
Test warm-up period (in seconds). Within the period, no statistics are calculated. It's needed to eliminate the effect of transition processes at startup. Default value: 5.
--percentile
Percentile that is output in statistics. Default value: 50.
--topic
Topic name. Default value: workload-topic.
--producer-threads, -p
Number of producer threads. Default value: 1.
--message-size, -m
Message size in bytes. Use the K, M, or G suffix to set the size in KB, MB, or GB, respectively. Default value: 10K.
--message-rate
Total target write rate in messages per second. Can't be used together with the --message-rate option. Default value: 0 (no limit).
--byte-rate
Total target write rate in bytes per second. Can't be used together with the --byte-rate option. Use the K, M, or G suffix to set the rate in KB/s, MB/s, or GB/s, respectively. Default value: 0 (no limit).
--codec
Codec used to compress messages on the client before sending them to the server. Compression increases CPU usage on the client when reading and writing messages, but usually enables you to reduce the amounts of data stored and transmitted over the network. When consumers read messages, they decompress them by the codec that was used to write the messages, with no special options needed. Acceptable values: RAW - no compression (default), GZIP, ZSTD.
--consumers, -c
Number of consumers. Default value: 1.
--consumer-prefix
Consumer name prefix. Default value: workload-consumer. For example, if the number of consumers --consumers is 2 and the prefix --consumer-prefix is workload-consumer, then the following consumer names will be used: workload-consumer-0, workload-consumer-1.
--threads, -t
Number of consumer threads. Default value: 1.
Example of a command that reads 50 threads by 2 consumers and writes data to 100 producer threads at the target rate of 80 MB/s and duration of 10 seconds:
ydb --profile quickstart workload topic run full --producer-threads 100 --consumers 2 --consumer-threads 50 --byte-rate 80M
You will see statistics for in-progress time windows and final statistics when the test is complete: