Example to use P6Spy as Proxy Datasource with Quarkus Application

331 Views Asked by At

I am new to Microservices. In our project, we are creating DB Connections at every service per container.

I was trying to migrate this to a data source but have this problem. Let's say I have Service A and a data source of 10 initial connections is added. If there are 2 containers created based on the load, the system is initializing 20 DB connections; 10 per container. This matrix is increasing based on the number of containers.

Wanted to check if I can centralize all the connection request to P6Spy and P6Spy will be hosted as a separate container which will help to support DB access for all the Microservices. Thinking of Weblogic-Datasource in microservice world.

A similar concept is implemented by Heimdall Data as given below. Any suggestion of achiving this.

Expected

2

There are 2 best solutions below

0
On

I think P6Spy only works on JDBC (Connection or DataSource) and cannot work as a Database Proxy like you mentioned Heimdall Data Proxy, or MySQL Router, ProxySQL, ShardingSphere, MyCAT, etc.

To centralize your SQL logs with P6Spy, you can config each P6Spy log into a centralized log collection system such as Graylog, Logstash or Fluentd.

0
On

You simply need to use a connection pooling solution. 2 popular connection pooling products that won't break the bank compared to Heimdall, are Pgpool-II and pgBouncer.

Elasticache supports up to 65,000 connections. I doubt you have a connection count issue there.