简体   繁体   中英

how to set particular value for c3p0's property in hibernate?

I'm using hibernate for my web application and it's working fine. I have set the properties of connection pooling like below.

  <property name="hibernate.c3p0.min_size">5</property>
  <property name="hibernate.c3p0.max_size">20</property>
  <property name="hibernate.c3p0.timeout">300</property>
  <property name="hibernate.c3p0.max_statements">50</property>
  <property name="hibernate.c3p0.idle_test_period">3000</property>

I have set min_size = 5, max_size=20, max_statements=50

but it could be min_size=1, max_size=100, max_statements=500

so, at what basis should I set these values? I have read some tutorials about hibernate connection pooling but didm't get any specific idea how to set these properties' values

that totally depends on how much load your application have, to check how much db activities are happening on c3p0 side you have to monitor the internal stats of objects and you need JMX to see that stats and based on that you can manage and configure pool, plz check below link

Configuring and Managing c3p0 via JMX

I would also recommend you to Check HikariCP , as its way much better than c3p0.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM