Should I use Oracle's UCP or HikariCP for a modern application?

5.5k Views Asked by At

Which one should I use for a modern backend Java application using Oracle OLTP database as a datasource?

To me HikariCP looks like a de-facto standard pool for a modern Java application. But now I need to maintain some project from the past, which is currently stuck at Oracle drivers v11 and using UCP. I am wondering now: does Oracle's UCP have any advantages over HikariCP? Would you use UCP or HikariCP?

Fresh Spring Boot project generated at start.spring.io will use HikariCP by default (Even though since 2.4 there is a support for UPC), until you explicitly enforce UCP in application.properties:

spring.datasource.type=oracle.ucp.jdbc.PoolDataSource

The Spring Boot docs say:

1. We prefer HikariCP for its performance and concurrency. If HikariCP is available, we always choose it.
...
4. If none of HikariCP, Tomcat, and DBCP2 are available and if Oracle UCP is available, we use it.

The Oracle website contains tutorials (1, 2) on how to use UCP with Spring Boot, but not explaining any advantages of such setup. I found an old StackOverflow answer mentioning some "non-blocking architecture", but I am still not sure if it makes UCP more valuable or reliable than HikariCP.

1

There are 1 best solutions below

1
On

The Oracle UCP pool has a lot more features than HikariCP: "labelling" allows you to label special connections for later reuse, "request boundaries" is a new standard in JDK9 that provides a hint to the driver when a connection is borrowed or released into the pool, diagnostics and observability MBean and a bunch of integrated features that are specific to the Oracle Database such as Application Continuity, RAC Failover, Sharding, etc.

UCP also performs really well. It undergoes performance evaluation on a regular basis and, because of its non-blocking infrastructure, can maintain a very large number of connections being shared by 1000s of threads.

Note that UCP has a very large community of users among the Oracle Database users in the cloud and on-prem.