use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class TokenTransferBasicLoadTest method activeTokenAssociatesFactory.
private Function<HapiApiSpec, OpProvider> activeTokenAssociatesFactory(PerfTestLoadSettings settings) {
int numTotalTokens = settings.getTotalTokens();
int numActiveTokenAccounts = settings.getTotalTestTokenAccounts();
int totalClients = settings.getTotalClients();
int numActiveTokens = (totalClients >= 1) ? numTotalTokens / totalClients : numTotalTokens;
AtomicLong remainingAssociations = new AtomicLong(numActiveTokens * numActiveTokenAccounts - 1);
if (log.isDebugEnabled()) {
log.debug("Total active token accounts {}, total test tokens {}, my portion of tokens {}", numActiveTokenAccounts, numTotalTokens, numActiveTokens);
}
long startAccountId = settings.getTestTreasureStartAccount();
return spec -> new OpProvider() {
@Override
public List<HapiSpecOperation> suggestedInitializers() {
return Collections.emptyList();
}
@Override
public Optional<HapiSpecOperation> get() {
long nextAssocId;
if ((nextAssocId = remainingAssociations.getAndDecrement()) < 0) {
return Optional.empty();
}
int curToken = (int) nextAssocId / numActiveTokenAccounts;
long curAccount = nextAssocId % numActiveTokenAccounts;
var accountId = "0.0." + (startAccountId + curAccount);
var op = tokenAssociate(accountId, tokenRegistryName(curToken)).payingWith(DEFAULT_PAYER).signedBy(DEFAULT_PAYER).hasRetryPrecheckFrom(BUSY, PLATFORM_TRANSACTION_NOT_CREATED, DUPLICATE_TRANSACTION, INSUFFICIENT_PAYER_BALANCE).hasPrecheckFrom(DUPLICATE_TRANSACTION, OK).hasKnownStatusFrom(SUCCESS, TOKEN_ALREADY_ASSOCIATED_TO_ACCOUNT, INVALID_TOKEN_ID, TRANSACTION_EXPIRED, TOKENS_PER_ACCOUNT_LIMIT_EXCEEDED, FAIL_INVALID, OK).fee(ONE_HUNDRED_HBARS).noLogging().suppressStats(true).deferStatusResolution();
return Optional.of(op);
}
};
}
use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class MixedTransferAndSubmitLoadTest method runMixedTransferAndSubmits.
private HapiApiSpec runMixedTransferAndSubmits() {
PerfTestLoadSettings settings = new PerfTestLoadSettings();
final AtomicInteger submittedSoFar = new AtomicInteger(0);
Supplier<HapiSpecOperation[]> transferBurst = () -> new HapiSpecOperation[] { inParallel(flattened(IntStream.range(0, settings.getBurstSize() / 2).mapToObj(ignore -> cryptoTransfer(tinyBarsFromTo("sender", "receiver", 1L)).noLogging().hasPrecheckFrom(OK, BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution()).toArray(n -> new HapiSpecOperation[n]), IntStream.range(0, settings.getBurstSize() / 2).mapToObj(ignore -> submitMessageTo("topic").message("A fascinating item of general interest!").noLogging().hasPrecheckFrom(OK, BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution()).toArray(n -> new HapiSpecOperation[n]))), logIt(ignore -> String.format("Now a 50/50 mix of %d transfers and messages submitted in total.", submittedSoFar.addAndGet(settings.getBurstSize()))) };
return defaultHapiSpec("RunMixedTransferAndSubmits").given(withOpContext((spec, ignore) -> settings.setFrom(spec.setup().ciPropertiesMap())), logIt(ignore -> settings.toString())).when(createTopic("topic"), cryptoCreate("sender").balance(ignore -> settings.getInitialBalance()), cryptoCreate("receiver")).then(runLoadTest(transferBurst).tps(settings::getTps).tolerance(settings::getTolerancePercentage).allowedSecsBelow(settings::getAllowedSecsBelow).lasting(settings::getMins, () -> MINUTES));
}
use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class CreateFilesBeforeReconnect method runCreateFiles.
private HapiApiSpec runCreateFiles() {
PerfTestLoadSettings settings = new PerfTestLoadSettings(FILE_CREATION_RECONNECT_TPS, DEFAULT_MINS_FOR_RECONNECT_TESTS, DEFAULT_THREADS_FOR_RECONNECT_TESTS);
Supplier<HapiSpecOperation[]> createBurst = () -> new HapiSpecOperation[] { generateFileCreateOperation() };
return defaultHapiSpec("RunCreateFiles").given(logIt(ignore -> settings.toString())).when().then(defaultLoadTest(createBurst, settings));
}
use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class CreateSchedulesBeforeReconnect method runCreateSchedules.
private HapiApiSpec runCreateSchedules() {
PerfTestLoadSettings settings = new PerfTestLoadSettings(SCHEDULE_CREATION_RECONNECT_TPS, DEFAULT_MINS_FOR_RECONNECT_TESTS, DEFAULT_THREADS_FOR_RECONNECT_TESTS);
Supplier<HapiSpecOperation[]> createBurst = () -> new HapiSpecOperation[] { generateScheduleCreateOperation() };
return defaultHapiSpec("RunCreateSchedules").given(scheduleOpsEnablement(), logIt(ignore -> settings.toString()), cryptoCreate("scheduleSender").balance(initialBalance.getAsLong()).key(GENESIS).hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution(), cryptoCreate("scheduleReceiver").key(GENESIS).hasRetryPrecheckFrom(BUSY, DUPLICATE_TRANSACTION, PLATFORM_TRANSACTION_NOT_CREATED).deferStatusResolution(), sleepFor(10000), scheduleCreate("schedule-" + getHostName() + "-" + scheduleNumber.getAndIncrement(), cryptoTransfer(tinyBarsFromTo("scheduleSender", "scheduleReceiver", 1))).signedBy(DEFAULT_PAYER).fee(ONE_HUNDRED_HBARS).alsoSigningWith("scheduleSender").hasPrecheckFrom(STANDARD_PERMISSIBLE_PRECHECKS).hasAnyKnownStatus().deferStatusResolution().adminKey(DEFAULT_PAYER).noLogging().advertisingCreation()).when(fileUpdate(APP_PROPERTIES).payingWith(GENESIS).overridingProps(Map.of("ledger.schedule.txExpiryTimeSecs", "" + 60)), sleepFor(10000)).then(scheduleCreate("schedule-" + getHostName() + "-" + scheduleNumber.getAndIncrement(), cryptoTransfer(tinyBarsFromTo("scheduleSender", "scheduleReceiver", 1))).signedBy(DEFAULT_PAYER).fee(ONE_HUNDRED_HBARS).alsoSigningWith("scheduleSender").hasPrecheckFrom(STANDARD_PERMISSIBLE_PRECHECKS).hasAnyKnownStatus().deferStatusResolution().adminKey(DEFAULT_PAYER).noLogging().advertisingCreation(), defaultLoadTest(createBurst, settings));
}
use of com.hedera.services.bdd.suites.perf.PerfTestLoadSettings in project hedera-services by hashgraph.
the class CreateTokensBeforeReconnect method runCreateTopics.
private HapiApiSpec runCreateTopics() {
PerfTestLoadSettings settings = new PerfTestLoadSettings(TOKEN_CREATION_RECONNECT_TPS, DEFAULT_MINS_FOR_RECONNECT_TESTS, DEFAULT_TOKEN_THREADS_FOR_RECONNECT_TESTS);
Supplier<HapiSpecOperation[]> createBurst = () -> new HapiSpecOperation[] { generateTopicCreateOperation() };
return defaultHapiSpec("RunCreateTokens").given(logIt(ignore -> settings.toString())).when().then(defaultLoadTest(createBurst, settings));
}
Aggregations