purge wallet after a specified amount of iterations
This commit is contained in:
parent
612275df61
commit
ba198eab4a
@ -28,6 +28,7 @@ import {
|
|||||||
getDefaultNodeWallet,
|
getDefaultNodeWallet,
|
||||||
NodeHttpLib,
|
NodeHttpLib,
|
||||||
WalletApiOperation,
|
WalletApiOperation,
|
||||||
|
Wallet,
|
||||||
} from "@gnu-taler/taler-wallet-core";
|
} from "@gnu-taler/taler-wallet-core";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -48,20 +49,25 @@ export async function runBench1(configJson: any): Promise<void> {
|
|||||||
|
|
||||||
const numIter = b1conf.iterations ?? 1;
|
const numIter = b1conf.iterations ?? 1;
|
||||||
const numDeposits = b1conf.deposits ?? 5;
|
const numDeposits = b1conf.deposits ?? 5;
|
||||||
|
const restartWallet = b1conf.restartAfter ?? 20;
|
||||||
|
|
||||||
const withdrawAmount = (numDeposits + 1) * 10;
|
const withdrawAmount = (numDeposits + 1) * 10;
|
||||||
|
|
||||||
logger.info(`Starting Benchmark iterations=${numIter} deposits=${numDeposits}`);
|
logger.info(`Starting Benchmark iterations=${numIter} deposits=${numDeposits}`);
|
||||||
|
|
||||||
|
let wallet = {} as Wallet;
|
||||||
|
|
||||||
for (let i = 0; i < numIter; i++) {
|
for (let i = 0; i < numIter; i++) {
|
||||||
// Create a new wallet in each iteration
|
// Create a new wallet in each iteration
|
||||||
// otherwise the TPS go down
|
// otherwise the TPS go down
|
||||||
// my assumption is that the in-memory db file gets too large
|
// my assumption is that the in-memory db file gets too large
|
||||||
const wallet = await getDefaultNodeWallet({
|
if (i % restartWallet == 0) {
|
||||||
// No persistent DB storage.
|
wallet = await getDefaultNodeWallet({
|
||||||
persistentStoragePath: undefined,
|
// No persistent DB storage.
|
||||||
httpLib: myHttpLib,
|
persistentStoragePath: undefined,
|
||||||
});
|
httpLib: myHttpLib,
|
||||||
|
});
|
||||||
|
}
|
||||||
await wallet.client.call(WalletApiOperation.InitWallet, {});
|
await wallet.client.call(WalletApiOperation.InitWallet, {});
|
||||||
|
|
||||||
logger.trace(`Starting withdrawal amount=${withdrawAmount}`);
|
logger.trace(`Starting withdrawal amount=${withdrawAmount}`);
|
||||||
@ -128,6 +134,12 @@ interface Bench1Config {
|
|||||||
currency: string;
|
currency: string;
|
||||||
|
|
||||||
deposits?: number;
|
deposits?: number;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* How any iterations run until the wallet db gets purged
|
||||||
|
* Defaults to 20.
|
||||||
|
*/
|
||||||
|
restartAfter?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -141,4 +153,5 @@ const codecForBench1Config = () =>
|
|||||||
.property("iterations", codecOptional(codecForNumber()))
|
.property("iterations", codecOptional(codecForNumber()))
|
||||||
.property("deposits", codecOptional(codecForNumber()))
|
.property("deposits", codecOptional(codecForNumber()))
|
||||||
.property("currency", codecForString())
|
.property("currency", codecForString())
|
||||||
|
.property("restartAfter", codecOptional(codecForNumber()))
|
||||||
.build("Bench1Config");
|
.build("Bench1Config");
|
||||||
|
Loading…
Reference in New Issue
Block a user