Now, transaction basic development has been completed. The user must test the performance of the transaction before using the transaction. Developers also need to test the transaction to ensure that the performance of the transaction meets the needs of the production environment.
What we need to do is create or update perf test tools to test the performance of the transaction component.
transactionBuffer
:PendingAck
:TransactionCoordinator
We implemented the performance tests of the three components of transaction separately.
PerformanceProducer
———test TransactionBuffer
isTransactionEnable
to control whether transactions need to be opened.numMessagesPerTransaction
to control the number messages of a transaction producedPerformanceConsumer
———test PendingAckHnadler
isTransactionEnable
to control whether transactions need to be opened.numMessagesPerTransaction
to control the number messages of a transaction ack.PerformanceTransaction
. ———test TransactionCoordinator
numTestThreads
We can create a ThreadPool with a fixed number of threads and use it to run normal transaction flow. When the number of messages produced and consumed in the transaction is small, the transaction will be frequently created and terminated, which is executed by transactionCoordinator. Every thread we will create a producer and consumer to produce or consume specified topic. Try to reduce the impact of client-side production and consumption on transaction op(CommandNewTxn
, CommandAddPartitionToTxn
etc.)isTrasnactionEnable
to control whether transactions need to be opened.PerformanceTransaction
don‘t handle complexity logic of produce or consume and focus on the performance test of transaction coordinator. so we don’t need to care about message size etc. If you want to test PendingAck
or TransactionBuffer
, you can use PerformanceProducer
or PerformanceConsumer
and enable transaction.isCommitedTransaction
= true; isEnableTransaction
= false; when this option is true, we will do any op with transaction.numMessagesPerTransaction
= 1; this num is how many messages to produce or consume per transaction.transactionTimeout
= 5; transaction timeout time.