Performance degradation with using DB_MAXSHAREDPOOLSIZE parameter on mod-inventory-storage

Description

Overview:

PTF team has discovered that there is performance degradation with using DB_MAXSHAREDPOOLSIZE parameter on mod-inventory-storage while testing CheckIn/CheckOut workflow on Mobius like cluster (61 tenants without consortia enabled).
With increasing parameter value (500,700,1000,1500,2000,2500) we can't see much improvements between each of a test and comparing to baseline test (without this parameter) it's always worse. Most of CPU time being consumed by SET ROLE,SET SCHEMA queries which looks like is happening with every query coming to DB.

Steps to Reproduce:

  1. Run CICO without DB_MAXSHAREDPOOLSIZE parameter, gather data like response times of CICO, RDS CPU usage, connections, etc. 

  2. Run CICO with DB_MAXSHAREDPOOLSIZE and compare results. 

Expected Results:

No performance degradation

Actual Results:

PTF team contacted several tests with various values on shared pool parameter for mod-inventory-storage (500,700,1000,1500,2000,2500). and even with 2500 connections shared pool was not able to achieve same performance on CICO. Moreover DB CPU usage increases up to 50% (while it's 20 on baseline test). connections rate don't change with increasing of parameter value

Additional Information:
report with additional information can be found here 
https://folio-org.atlassian.net/wiki/display/FOLIJET/DB_MAXSHAREDPOOLSIZE+experiments

Interested parties:
, , , , , ,  

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

is continued by

Checklist

hide

TestRail: Results

Activity

Show:

Mikhail Fokanov October 20, 2023 at 9:12 AM
Edited

, ,
The explanation of the problem: If connections are separate for each tenant, then you do not need to constantly switch to the desired tenant after receiving a connection. But in such case , there will be too many of them (number of modules * number of tenants).
If a shared connection pool is created, then it cannot be as productive as a non-shared one, since in this case the connections have to constantly switch between tenants (each time before the query execution). And hence we see the performance degradation in the test results.

, I see only one enhancement that can be implemented in RMB. If there are free connection in the pool, which was previously used for the desired tenant, this connection should be taken instead of random one and in such case the "SET ROLE '" + schemaName + "'; SET SCHEMA '" + schemaName + "'" should not be executed for it.
This changes would be done in PostgresClient .
But it is extremely tricky, because the PgConnection is vertex class and it is virtually impossible to set some properties (e.g. modify the PgConnectOptions.properties) for it or identify it somehow (to have mapping between connection and last used schema in PostgreClient). Maybe it can be done by means of wrapper for the vertx connection.
Also it worth to mention, that it is not architecturally clear, because connections in the pool are supposed to be identical (e.g. immutable) by design. But, the way I see it, this is the only thing that could be done.

Details

Assignee

Reporter

Priority

Development Team

Core: Platform

RCA Group

TBD

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created October 19, 2023 at 3:54 PM
Updated December 18, 2023 at 8:48 PM
TestRail: Cases
TestRail: Runs

Flag notifications