diff --git a/tools/jmeter/README.md b/tools/jmeter/README.md index 6e67cce028..b555e7c982 100644 --- a/tools/jmeter/README.md +++ b/tools/jmeter/README.md @@ -55,3 +55,12 @@ remote user name is different from the current user name, `-XsshUser ", "The X500 name of the payee.") + val coinSelection = Argument("useCoinSelection", "true", "", "True to use coin selection and false (or anything else) to avoid coin selection.") } lateinit var counterParty: Party + var useCoinSelection: Boolean = true override fun setupTest(rpcProxy: CordaRPCOps, testContext: JavaSamplerContext) { getNotaryIdentity(rpcProxy,testContext) counterParty = getIdentity(rpcProxy, testContext, otherParty) + useCoinSelection = testContext.getParameter(coinSelection.name, coinSelection.value).toBoolean() } override fun createFlowInvoke(rpcProxy: CordaRPCOps, testContext: JavaSamplerContext): FlowInvoke<*> { val amount = 2_000_000.POUNDS - return FlowInvoke(CashIssueAndPaymentFlow::class.java, arrayOf(amount, OpaqueBytes.of(1), counterParty, true, notaryIdentity)) + if (useCoinSelection) { + return FlowInvoke(CashIssueAndPaymentFlow::class.java, arrayOf(amount, OpaqueBytes.of(1), counterParty, true, notaryIdentity)) + } else { + return FlowInvoke(CashIssueAndPaymentNoSelection::class.java, arrayOf(amount, OpaqueBytes.of(1), counterParty, true, notaryIdentity)) + } } override fun teardownTest(rpcProxy: CordaRPCOps, testContext: JavaSamplerContext) { } override val additionalArgs: Set - get() = setOf(notary, otherParty) + get() = setOf(notary, otherParty, coinSelection) } \ No newline at end of file diff --git a/tools/jmeter/src/main/resources/LocalIssueAndPay Request.jmx b/tools/jmeter/src/main/resources/LocalIssueAndPay Request.jmx new file mode 100644 index 0000000000..d36d667bca --- /dev/null +++ b/tools/jmeter/src/main/resources/LocalIssueAndPay Request.jmx @@ -0,0 +1,187 @@ + + + + + + false + false + + + + + + + + continue + + false + 100 + + 3 + + 1509455820000 + 1509455820000 + false + + + + + + + + + host + localhost + = + + + port + 10004 + = + + + username + perf + = + + + password + perf + = + + + notaryName + O=Notary Service,L=Zurich,C=CH,CN=corda.notary.simple + = + + + otherPartyName + O=Bank B,L=New York,C=US + = + + + useCoinSelection + true + = + + + + com.r3.corda.jmeter.CashIssueAndPaySampler + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + false + + saveConfig + + + true + true + true + + true + true + true + true + false + true + true + false + false + false + true + false + false + false + true + 0 + true + true + true + true + true + + + + + + + + true + + + + diff --git a/tools/jmeter/src/test/kotlin/com/r3/corda/jmeter/StartLocalPerfCorDapp.kt b/tools/jmeter/src/test/kotlin/com/r3/corda/jmeter/StartLocalPerfCorDapp.kt new file mode 100644 index 0000000000..359398d44f --- /dev/null +++ b/tools/jmeter/src/test/kotlin/com/r3/corda/jmeter/StartLocalPerfCorDapp.kt @@ -0,0 +1,36 @@ +package com.r3.corda.jmeter + +import net.corda.core.utilities.getOrThrow +import net.corda.nodeapi.User +import net.corda.testing.DUMMY_NOTARY +import net.corda.testing.node.NotarySpec +import java.io.BufferedReader +import java.io.InputStreamReader + +class StartLocalPerfCorDapp { + companion object { + @JvmStatic + fun main(args: Array) { + // Typically the RPC port of Bank A is 10004. + val demoUser = User("perf", "perf", setOf(net.corda.node.services.Permissions.Companion.all())) + net.corda.testing.driver.driver(startNodesInProcess = false, + waitForAllNodesToFinish = true, + notarySpecs = listOf(NotarySpec(DUMMY_NOTARY.name, validating = false)), + extraCordappPackagesToScan = listOf("com.r3.corda.enterprise.perftestcordapp")) { + val (nodeA, nodeB) = listOf( + startNode(providedName = net.corda.testing.DUMMY_BANK_A.name, rpcUsers = listOf(demoUser)), + startNode(providedName = net.corda.testing.DUMMY_BANK_B.name, rpcUsers = listOf(demoUser)) + ).map { it.getOrThrow() } + println("Nodes started!") + val input = BufferedReader(InputStreamReader(System.`in`)) + do { + Ssh.log.info("Type 'quit' to exit cleanly.") + } while (input.readLine() != "quit") + println("Quitting... (this sometimes takes a while)") + nodeA.stop() + nodeB.stop() + defaultNotaryHandle.nodeHandles.getOrThrow().map { it.stop() } + } + } + } +} \ No newline at end of file