shardingsphere
shardingsphere copied to clipboard
Is there any way to monitor the connection pool
Question
Is there any way to monitor the connection pool like druid monitor?
Recently, I have encountered several times in the online environment that the sharding proxy database connection is unavailable, which will occur one day to one month after the server is started.
At this time, I try to use Navicat to test the direct connection to MySQL. It can connect, but it can't connect to sharding proxy.
The log is as follows:
### Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConne
ctionException: Failed to obtain JDBC Connection; nested exception is java.sql.S
QLTransientConnectionException: HikariPool-1 - Connection is not available, requ
est timed out after 30001ms.
### The error may exist in com/xxx/dao/XXDao.java (b
est guess)
### The error may involve com.xxx.dao.XXDao.selectXXByID
### The error occurred while executing a query
### Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to
obtain JDBC Connection; nested exception is java.sql.SQLTransientConnectionExcep
tion: HikariPool-1 - Connection is not available, request timed out after 30001m
s.
I hope there is a way to monitor the status of sharding proxy connection pool. Can you give me some suggestions.
Thanks.
Did you mean database connection pool monitor by JDBC layer?
@terrymanu
Yes, I want to monitor the connection pool used by sharding proxy when connecting to the real database.
I tried to change the configuration to Druid, but sharding proxy doesn't seem to support it.
org.apache. shardingsphere.proxy. backend.config.yaml.Yamlproxydatasourceconfiguration
does not provide a similar spring.datasource. type=com. alibaba. druid. pool. Druiddatasource
configuration. It uses Hikari by default.
Then I used jconsole to check the MBean and found no information related to the database connection pool.
HikariCP can export the monitor data to Prometheus, but the codes do not implement in ShardingSphere yet. Do you interest to finish the feature?
Let me try it.
Hikari metrics could be exported by JMX.
There is a related issue https://github.com/apache/shardingsphere/issues/15695
Hello , this issue has not received a reply for several days. This issue is supposed to be closed.
@wingkingbobo
-
Druid Monitor seems to have been a Servlet application that lacked maintenance. Isn't APM a better choice if you're just thinking about monitoring SQL and execution? I'm assuming you're using Apache Skywalking.
-
For JDBC pool properties, do you not know how to wrap DistSQL results into a visual platform like Apache SuperSet?
follow open-telemetry report by gauges for active/total/waiting/idle numbers ?
now, can ShardingSphere get monitor data of HikariCP and export it to Prometheus, which version? and how to configure this.