shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Is there any way to monitor the connection pool

Open wingkingbobo opened this issue 1 year ago • 6 comments

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.

wingkingbobo avatar Jul 13 '22 04:07 wingkingbobo

Did you mean database connection pool monitor by JDBC layer?

terrymanu avatar Jul 15 '22 16:07 terrymanu

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

wingkingbobo avatar Jul 18 '22 01:07 wingkingbobo

HikariCP can export the monitor data to Prometheus, but the codes do not implement in ShardingSphere yet. Do you interest to finish the feature?

terrymanu avatar Jul 25 '22 04:07 terrymanu

Let me try it.

sunkai-cai avatar Aug 02 '22 02:08 sunkai-cai

Hikari metrics could be exported by JMX.

TeslaCN avatar Aug 04 '22 08:08 TeslaCN

There is a related issue https://github.com/apache/shardingsphere/issues/15695

TeslaCN avatar Aug 04 '22 08:08 TeslaCN

Hello , this issue has not received a reply for several days. This issue is supposed to be closed.

github-actions[bot] avatar Oct 08 '22 16:10 github-actions[bot]

@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?

linghengqian avatar Dec 29 '22 08:12 linghengqian

follow open-telemetry report by gauges for active/total/waiting/idle numbers ?

susongyan avatar Jan 12 '23 05:01 susongyan

now, can ShardingSphere get monitor data of HikariCP and export it to Prometheus, which version? and how to configure this.

huang714669 avatar Mar 30 '23 08:03 huang714669