I would to understand more about the connection pool handling using Hikari.
The problem I'm facing is connection will hit the maximum which is 250 then back to 10. There are 2 things I would like to know/tune
The scenario is as below
Check out the attached picture. It's Hikari Mbean during runtime. The darker color of active connection means it's hitting the maximum. The lighter green color means active connection pool drop back to 10.
These are the database settings:
<Resource name="jdbc/maxpool" auth="Container"
factory="com.zaxxer.hikari.HikariJNDIFactory"
type="javax.sql.DataSource"
poolName="ah pool"
idleTimeout="0"
registerMbeans="true"
maximumPoolSize="250"
maxLifetime="3000"
minimumIdle="5"
leakDetectionThreshold="90000"
dataSourceClassName="org.postgresql.ds.PGSimpleDataSource"
dataSource.url="jdbc:postgresql://10.1.1.1:5444/xxxx"
dataSource.user="ereport"
dataSource.password="zzzz"/>
#hibernate.hbm2ddl.auto=create
#hibernate.generate_statistics=true
#hibernate.cache.use_structured_entries=true
#hibernate.ejb.naming_strategy=my.mimos.jpa.naming.CustomImprovedNamingStrategy
javax.persistence.lock.timeout=5000
hibernate.id.new_generator_mappings=true
hibernate.id.optimizer.pooled.prefer_lo=true
hibernate.default_batch_fetch_size=20
hibernate.jdbc.fetch_size=50
hibernate.jdbc.batch_size=60
hibernate.jdbc.lob.non_contextual_creation=true
hibernate.order_inserts=true
#hibernate.connection.release_mode=after_statement
## uncomment the following 2 properties if batch update is required
#hibernate.order_updates=true
#hibernate.jdbc.batch_versioned_data=true
# Hibernate Envers (audit trail) properties
## There are 2 strategies: DefaultAuditStrategy and ValidityAuditStrategy
## ValidityAuditStrategy will store both the start revision and the end revision instead of storing start revision only
org.hibernate.envers.audit_strategy=org.hibernate.envers.strategy.DefaultAuditStrategy
org.hibernate.envers.audit_table_suffix=_h
org.hibernate.envers.do_not_audit_optimistic_locking_field=false
"efamily-persistence.properties" 40L, 2039C
to debug this issue, i found a SQL command quite useful. The issue is because some of the tables are locked. Run this when the insertion is slow, then can get some clues where the problem is.
SELECT * FROM pg_stat_activity
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.