Skip to content

Commit

Permalink
test: rw performance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
karenc-bq committed Oct 25, 2024
1 parent cb12907 commit c332625
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion pg/lib/pg_pool_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export class AwsPgPoolClient implements AwsPoolClient {
}

async end(poolClient: any) {
await poolClient?.release(true);
if (poolClient) {
await poolClient.release(true);
}
}

getIdleCount(): number {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ describe("rwperformance", () => {
ConnectionProviderManager.setConnectionProvider(new InternalPooledConnectionProvider());
const rwPluginWithPoolConfig = initReadWritePluginConfig(env.databaseInfo.clusterEndpoint, env.databaseInfo.clusterEndpointPort);
const rwPluginWithPoolData = await measurePerformance(rwPluginWithPoolConfig);
await ConnectionProviderManager.releaseResources();
ConnectionProviderManager.resetProvider();

readerData = calculateReaderOverhead("Switch to reader", rwPluginWithPoolData, noPluginData);
writerData = calculateWriterOverhead("Switch to writer (using cached connection)", rwPluginWithPoolData, noPluginData);
Expand All @@ -92,6 +90,9 @@ describe("rwperformance", () => {
"InternalConnectionPool"
);

await ConnectionProviderManager.releaseResources();
ConnectionProviderManager.resetProvider();

setReadOnlyPerfDataList = [];

// Internal connection pool results with warm up.
Expand All @@ -102,12 +103,12 @@ describe("rwperformance", () => {
if (instance.host && instance.port) {
const client = DriverHelper.getClient(driver)(initReadWritePluginConfig(instance.host, instance.port));
await PerfTestUtility.connectWithRetry(client);
await client.setReadOnly(true);
await client.setReadOnly(false);
}
}

const rwPluginWithPoolWithWarmUpData = await measurePerformance(rwPluginWithPoolConfig);
await ConnectionProviderManager.releaseResources();
ConnectionProviderManager.resetProvider();

readerData = calculateReaderOverhead("Switch to reader", rwPluginWithPoolWithWarmUpData, noPluginData);
writerData = calculateWriterOverhead("Switch to writer (using cached connection)", rwPluginWithPoolWithWarmUpData, noPluginData);
Expand All @@ -117,6 +118,9 @@ describe("rwperformance", () => {
`ReadWriteSplittingPerformanceResults_${env.engine}_Instances_${env.instances.length}_SwitchReaderWriterConnection.xlsx`,
"InternalConnectionPoolWithWarmUp"
);

await ConnectionProviderManager.releaseResources();
ConnectionProviderManager.resetProvider();
},
13200000
);
Expand Down

0 comments on commit c332625

Please sign in to comment.