use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class ContractCallLoadTest method runContractCalls.
private HapiApiSpec runContractCalls() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
final AtomicInteger submittedSoFar = new AtomicInteger(0);
final String DEPOSIT_MEMO = "So we out-danced thought, body perfection brought...";
Supplier<HapiSpecOperation[]> callBurst = () -> new HapiSpecOperation[] { inParallel(IntStream.range(0, settings.getBurstSize()).mapToObj(i -> contractCall("perf", ContractResources.VERBOSE_DEPOSIT_ABI, i + 1, 0, DEPOSIT_MEMO).sending(i + 1).noLogging().suppressStats(true).hasRetryPrecheckFrom(PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution()).toArray(n -> new HapiSpecOperation[n])), logIt(ignore -> String.format("Now a total of %d transactions submitted.", submittedSoFar.addAndGet(settings.getBurstSize()))) };
return defaultHapiSpec("runContractCalls").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), logIt(ignore -> settings.toString())).when(fileCreate("contractBytecode").path(ContractResources.VERBOSE_DEPOSIT_BYTECODE_PATH), contractCreate("perf").bytecode("contractBytecode"), fileCreate("lookupBytecode").path(ContractResources.BALANCE_LOOKUP_BYTECODE_PATH), contractCreate("balanceLookup").bytecode("lookupBytecode").balance(1L), getContractInfo("perf").hasExpectedInfo().logged()).then(defaultLoadTest(callBurst, settings));
}
use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class CryptoTransferLoadTest method runCryptoTransfers.
protected HapiApiSpec runCryptoTransfers() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
Supplier<HapiSpecOperation[]> transferBurst = () -> {
String sender = "sender";
String receiver = "receiver";
if (settings.getTotalAccounts() > 2) {
int s = r.nextInt(settings.getTotalAccounts());
int re = 0;
do {
re = r.nextInt(settings.getTotalAccounts());
} while (re == s);
sender = String.format("0.0.%d", TEST_ACCOUNT_STARTS_FROM + s);
receiver = String.format("0.0.%d", TEST_ACCOUNT_STARTS_FROM + re);
}
return new HapiSpecOperation[] { cryptoTransfer(tinyBarsFromTo(sender, receiver, 1L)).noLogging().payingWith(sender).signedBy(GENESIS).suppressStats(true).fee(100_000_000L).hasKnownStatusFrom(SUCCESS, OK, INSUFFICIENT_PAYER_BALANCE, UNKNOWN, TRANSACTION_EXPIRED, INSUFFICIENT_ACCOUNT_BALANCE).hasRetryPrecheckFrom(BUSY, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution() };
};
return defaultHapiSpec("RunCryptoTransfers").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), logIt(ignore -> settings.toString())).when(cryptoCreate("sender").balance(ignore -> settings.getInitialBalance()).payingWith(GENESIS).withRecharging().key(GENESIS).rechargeWindow(3).logging().hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED), cryptoCreate("receiver").payingWith(GENESIS).hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).key(GENESIS).logging()).then(defaultLoadTest(transferBurst, settings), getAccountBalance("sender").logged());
}
use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class HCSChunkingRealisticPerfSuite method fragmentLongMessageIntoChunks.
private static HapiApiSpec fragmentLongMessageIntoChunks() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
Supplier<HapiSpecOperation[]> submitBurst = () -> new HapiSpecOperation[] { chunkAFile(LARGE_FILE, CHUNK_SIZE, PAYER, TOPIC, totalMsgSubmitted) };
return defaultHapiSpec("fragmentLongMessageIntoChunks").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), newKeyNamed("submitKey"), logIt(ignore -> settings.toString())).when(cryptoCreate(PAYER).balance(initialBalance.getAsLong()).withRecharging().rechargeWindow(30).hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED), withOpContext((spec, ignore) -> {
int factor = settings.getIntProperty("collisionAvoidanceFactor", DEFAULT_COLLISION_AVOIDANCE_FACTOR);
List<HapiSpecOperation> opsList = new ArrayList<HapiSpecOperation>();
for (int i = 0; i < settings.getThreads() * factor; i++) {
var op = createTopic(TOPIC + i).submitKeyName("submitKey").hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED);
opsList.add(op);
}
CustomSpecAssert.allRunFor(spec, inParallel(flattened(opsList)));
}), // wait all other thread ready
sleepFor(5000)).then(defaultLoadTest(submitBurst, settings));
}
use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class createTopicLoadTest method runCreateTopics.
private static HapiApiSpec runCreateTopics() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
final AtomicInteger submittedSoFar = new AtomicInteger(0);
KeyShape submitKeyShape = threshOf(2, SIMPLE, SIMPLE, listOf(2));
Supplier<HapiSpecOperation[]> submitBurst = () -> new HapiSpecOperation[] { createTopic("testTopic" + submittedSoFar.addAndGet(1)).submitKeyShape(submitKeyShape).noLogging().hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution() };
return defaultHapiSpec("runCreateTopics").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), logIt(ignore -> settings.toString())).when().then(defaultLoadTest(submitBurst, settings));
}
Aggregations