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.
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.