0

I have configured openliberty (version 21) with a database (oracle) connection as follows in the server.xml :

<dataSource jndiName="jdbc/myds" transactional="true">
        <connectionManager maxPoolSize="20" minPoolSize="5" agedTimeout="120s" connectionTimeout="10s"/> 
        <jdbcDriver libraryRef="jdbcLib" />
        <properties.oracle URL="jdbc:oracle:thin:@..." user="..." password="..."/>
    </dataSource>

The server starts and I can make queries to the database via my rest api but I have noticed that I only use 1 active database connection and parallel http queries result in queuing databases queries over that 1 connection. I have verified this by monitoring the active open database connections in combination with slow queries (I make several rest calls in parallel). Only 1 connection is opened and 1 query is processes after the other. How do I open a connection pool with for example 5-20 connections for parallel operation.

egu
  • 1
  • 1
    Add code where you are getting the connection. As from the configuration you should be using pool, but maybe your app limits number of open connections. – Gas Sep 13 '21 at 14:49

1 Answers1

0

Based on your described usage, the connection pool should be creating connections as requests come in if there are no connections available in the free pool.

Your connectionTimeout is configured to be 10 seconds. To ensure that your test really is running in parallel would be to make two requests to the server. The server should create a connection, use it, wait 11 seconds, then close the connection.

If your requests are NOT running in parallel, you will not get any exception since the second request won't start until after the first one finished and that would be an issue with your test procedure.

If your requests are running in parallel, and you do not get any exception output from Liberty. Then Liberty likely is making multiple connections and that can be confirmed by enabling J2C trace.

See: https://openliberty.io/docs/21.0.0.9/log-trace-configuration.html

Enable: J2C=ALL

If your requests are running in parallel, and no more than one connection is being created, then you will get a ConnectionWaitTimeoutException. This could be caused by the driver not being able to create more than one connection, incorrect use of the Oracle Connection Pool (UCP), or a number of other factors. I would need more information to debug that issue.

KyleAure
  • 465
  • 4
  • 15