14
I am wondering what would be a reasonable number for my connection.pool_size? to what aspects is it related? Also need to know how to test the application once a size is defined for it.
My application is going to be used by AT LEAST 100 users concurrently, it has more than 20 tables in its database. My database is MySQL and AT LEAST 12 systems are using my application at the same time. Please let me know if you need to know more.
I have also found the following which helps to define the connection pool size but still not sure what the reasonable number is.
Hibernate's own connection pooling algorithm is, however, quite rudimentary.
It is intended to help you get started and is not intended for use in a production
system, or even for performance testing. You should use a third party pool for
best performance and stability. Just replace the hibernate.connection.pool_size
property with connection pool specific settings. This will turn off Hibernate's
internal pool. For example, you might like to use c3p0.
connection.pool_size indicates the maximum number of pooled connections. So it is
better to keep it at a logical count. It depends on your application and DB how
much it can handle. 10 is a reasonable count that will typically used as it is
sufficient for most cases.
My hibernateUtil is as following
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
public class HibernateUtil {
private static ServiceRegistry serviceRegistry;
private static final ThreadLocal<Session> threadLocal = new ThreadLocal();
private static SessionFactory sessionFactory;
private static SessionFactory configureSessionFactory(