averemee-si/oracdc

How can i limit oracle connection size

Felix0525 opened this issue · 2 comments

Hi Aleksei,I modified the code at OraConnectionObjects.class

Before:
pds = PoolDataSourceFactory.getPoolDataSource();
pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
pds.setConnectionPoolName(poolName);
pds.setURL(dbUrl);
pds.setInitialPoolSize(INITIAL_SIZE);
pds.setMinPoolSize(INITIAL_SIZE);

After:
pds = PoolDataSourceFactory.getPoolDataSource();
pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
pds.setConnectionPoolName(poolName);
pds.setURL(dbUrl);
pds.setInitialPoolSize(1);
pds.setMinPoolSize(1);
pds.setMaxPoolSize(1);

When i running a new connector again, the connector failed with exception: Can't acquire new connection from pool

So how can i limit oracle connection size as 1

Hi Felix,

oracdc uses in any configuration at least two connections to Oracle Database:

  1. Connection for execution of DBMS_LOGMNR.START_LOGMNR and SELECT * FROM V$LOGMNR_CONTENTS. This connection is acquired when the connector starts and is then used exclusively for these operations.
    2.Connection for querying Oracle Database data dictionary, this connection required on-demand in request-respond style, i.e. when oracdc needs to read definition of new table/LOB/partition this connection is obtained from pool and after reading the data dictionary is immediately returned to the connection pool.

So this is impossible to

pds.setMaxPoolSize(1);

Based on my experience with Oracle performance tuning, there is usually no performance penalty due to one or two sleep connections in the connection pool.

Hope this helps.

Best regards,
Aleksei

Hi Aleksei,
Thank you for your reply.
For my case, I create a connector for a table and mining data to a kafka topic, Tables are separated from each other.
That's why I need to limit the connection size.