问题
First of all please note: question is about values of parameters not methods of configuration. Also, my question is customized to my system requirement.
My system is going to be used by 20 concurrent users who make requests, and I believe max time that each query would be responded would be 300 seconds. Although I used JMeter and the application worked, I suspect the value of idle_test_period should not be more than timeout value but in most tutorials online they are not. I am wondering if the following configuration is sufficient for my requirement. And whether the value of idle_test_period should be more than timeout or not?
<property name="hibernate.c3p0.min_size">5</property>
<property name="hibernate.c3p0.max_size">100</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>
<property name="current_session_context_class">thread</property>
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
Most websites configurations are the same such as : this and this
回答1:
Setting a connection pool size is not a trivial thing to do. Any RDBMS will impose a max concurrent connnection limit, and I see you have already chosen a max size of 100 connections.
Typically, based on the RDBMS engine, the OS and the hardware you might get 100-300 max concurrent connections per DB node (matser/slave).
So if you plan to load balance this app, or run different apps all concurring for the limited db connections then things get really complicated.
I dedicated some time to find the best connection pool sizing strategy o here are my findings:
The anatomy of Connection Pooling
FlexyPool, reactive connection pooling
Professional connection pool sizing
So, I build an open source project called FlexyPool that allows you to:
- monitor the connection pool behaviour (connection lease time, connection acquire time, retries, pool size grow)
- gives you the possibility of finding the right pool size by using a pool increment on time threshold strategy
I hope it can help you finding the right pool size.
来源:https://stackoverflow.com/questions/23795632/whats-the-best-way-to-set-the-values-of-c3p0-parameters-when-it-is-in-conjunctio