mirror of
https://github.com/digital-asset/daml.git
synced 2024-11-10 10:46:11 +03:00
Port PerformanceEnvelope.TransactionSize perf test from Canton (#5955)
* Port PerformanceEnvelope.TransactionSize perf test from Canton to LedgerApiTestTool --perf-tests changelog_begin [Ledger Api Test Tool] Added the TransactionSize performance benchmark test. changelog_end * Review feedback from Samir * Formatting
This commit is contained in:
parent
294c881a2a
commit
cc880e290b
@ -73,6 +73,7 @@ object Tests {
|
||||
{
|
||||
val throughputKey: String = performanceEnvelopeThroughputTestKey(envelope)
|
||||
val latencyKey: String = performanceEnvelopeLatencyTestKey(envelope)
|
||||
val transactionSizeKey: String = performanceEnvelopeTransactionSizeTestKey(envelope)
|
||||
List(
|
||||
throughputKey -> (new testtool.tests.PerformanceEnvelope.ThroughputTest(
|
||||
logger = LoggerFactory.getLogger(throughputKey),
|
||||
@ -84,6 +85,10 @@ object Tests {
|
||||
envelope = envelope,
|
||||
reporter = reporter,
|
||||
)(_)),
|
||||
transactionSizeKey -> (new testtool.tests.PerformanceEnvelope.TransactionSizeScaleTest(
|
||||
logger = LoggerFactory.getLogger(transactionSizeKey),
|
||||
envelope = envelope,
|
||||
)(_)),
|
||||
)
|
||||
}
|
||||
}
|
||||
@ -93,11 +98,14 @@ object Tests {
|
||||
s"PerformanceEnvelope.${envelope.name}.Throughput"
|
||||
private[this] def performanceEnvelopeLatencyTestKey(envelope: Envelope): String =
|
||||
s"PerformanceEnvelope.${envelope.name}.Latency"
|
||||
private[this] def performanceEnvelopeTransactionSizeTestKey(envelope: Envelope): String =
|
||||
s"PerformanceEnvelope.${envelope.name}.TransactionSize"
|
||||
|
||||
private[testtool] val PerformanceTestsKeys =
|
||||
Envelope.values.flatMap { envelope =>
|
||||
List(
|
||||
performanceEnvelopeThroughputTestKey(envelope),
|
||||
performanceEnvelopeLatencyTestKey(envelope))
|
||||
performanceEnvelopeLatencyTestKey(envelope),
|
||||
performanceEnvelopeTransactionSizeTestKey(envelope)),
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ import scalaz.syntax.tag._
|
||||
|
||||
import scala.collection.concurrent.TrieMap
|
||||
import scala.concurrent.{ExecutionContext, Future, Promise, blocking}
|
||||
import scala.util.{Failure, Success, Try}
|
||||
import scala.util.{Failure, Random, Success, Try}
|
||||
import com.daml.ledger.test.performance.{PingPong => PingPongModule}
|
||||
import org.slf4j.Logger
|
||||
|
||||
@ -356,9 +356,9 @@ object PerformanceEnvelope {
|
||||
|
||||
def runTest(num: Int, description: String): Future[(Duration, List[Duration])] =
|
||||
sendPings(
|
||||
participants.participants.head,
|
||||
participants.participants(1),
|
||||
(1 to num).map(x => s"$description-$x").toList,
|
||||
from = participants.participants.head,
|
||||
to = participants.participants(1),
|
||||
workflowIds = (1 to num).map(x => s"$description-$x").toList,
|
||||
payload = description)
|
||||
for {
|
||||
_ <- runTest(numWarmupPings, "throughput-warmup")
|
||||
@ -398,10 +398,11 @@ object PerformanceEnvelope {
|
||||
waitForParties(participants.participants)
|
||||
|
||||
sendPings(
|
||||
participants.participants.head,
|
||||
participants.participants(1),
|
||||
(1 to (numPings + numWarmupPings)).map(x => s"latency-$x").toList,
|
||||
payload = "latency").map {
|
||||
from = participants.participants.head,
|
||||
to = participants.participants(1),
|
||||
workflowIds = (1 to (numPings + numWarmupPings)).map(x => s"latency-$x").toList,
|
||||
payload = "latency"
|
||||
).map {
|
||||
case (_, latencies) =>
|
||||
val sample = latencies.drop(numWarmupPings).map(_.toMillis).sorted
|
||||
require(sample.length == numPings)
|
||||
@ -426,4 +427,26 @@ object PerformanceEnvelope {
|
||||
s"Sample size of ${sample.length}: avg=${"%.0f" format avg} ms, median=$med ms, stdev=${"%.0f" format stddev} ms"
|
||||
}
|
||||
|
||||
class TransactionSizeScaleTest(val logger: Logger, val envelope: Envelope)(session: LedgerSession)
|
||||
extends LedgerTestSuite(session)
|
||||
with PerformanceEnvelope {
|
||||
|
||||
val maxInflight = 10
|
||||
|
||||
test(
|
||||
"perf-envelope-transaction-size",
|
||||
s"Verify that ledger passes the ${envelope.name} transaction size envelope",
|
||||
allocate(SingleParty, SingleParty),
|
||||
) { participants =>
|
||||
waitForParties(participants.participants)
|
||||
|
||||
sendPings(
|
||||
from = participants.participants.head,
|
||||
to = participants.participants(1),
|
||||
workflowIds = List("transaction-size"),
|
||||
payload = Random.alphanumeric.take(envelope.transactionSizeKb * 1024).mkString("")
|
||||
).map(_ => ())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -170,6 +170,7 @@ conformance_test(
|
||||
"--verbose",
|
||||
"--perf-tests=PerformanceEnvelope.Beta.Throughput",
|
||||
"--perf-tests=PerformanceEnvelope.Beta.Latency",
|
||||
"--perf-tests=PerformanceEnvelope.Beta.TransactionSize",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -272,6 +272,7 @@ da_scala_test_suite(
|
||||
"--verbose",
|
||||
"--perf-tests=PerformanceEnvelope.Beta.Throughput",
|
||||
"--perf-tests=PerformanceEnvelope.Beta.Latency",
|
||||
"--perf-tests=PerformanceEnvelope.Beta.TransactionSize",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user