Wso2 APIM Analytics 2.6.0 DB connections

Viewed 130

I Have my wso2 APIM (all-in-one deployment), that need to send and consumes info for my Analytics (wso2 Stream Processor). The integration goes well in the first day. Normally in the second day my Analytics starts to give me the follow db connection error:

ERROR {org.wso2.extension.siddhi.io.mgwfile.task.MGWFileReaderTask} - Error occurred while publishing micro-gateway API Usage data. org.wso2.extension.siddhi.io.mgwfile.exception.MGWFileSourceException: Error occurred while getting the next files to process.
        at org.wso2.extension.siddhi.io.mgwfile.dao.MGWFileSourceDAO.getNextFilesToProcess(MGWFileSourceDAO.java:148)
        at org.wso2.extension.siddhi.io.mgwfile.task.MGWFileReaderTask.run(MGWFileReaderTask.java:59)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
Caused by: java.sql.SQLTransientConnectionException: HikariPool-5 - Connection is not available, request timed out after 30258ms.
        at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:213)
        at com.zaxxer.hikari.pool.HikariPool.getConnection(HikariPool.java:163)
        at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:85)
        at org.wso2.extension.siddhi.io.mgwfile.util.MGWFileSourceDBUtil.getConnection(MGWFileSourceDBUtil.java:47)
        at org.wso2.extension.siddhi.io.mgwfile.dao.MGWFileSourceDAO.getNextFilesToProcess(MGWFileSourceDAO.java:107)
        ... 3 more

It´s looks like this Hikari don´t clear the db sessions how to proceed to avoid the db connection of my analytics stay health?

2 Answers

This issue also could be due to the lack of more DB connection. For that, you can try to increase the max pool size in the data source configuration APIM_ANALYTICS_DB. ex:

    maxPoolSize: 100

Also, make sure DB is supported max connection defined in the maxPoolSize. If not increase it in the DB too.


In my case, the problem lies in the fact that som of my datasources are set to use H2 local DB. So, at a given moment, APIM starts sending a lot of information to Analytics, making the machine use 99% CPU. This behavior make the Local H2 DB stop do respond the HikariPool request... I stil have the problem but now I know that is more than a DB connection.
Related