Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate config connection pool size

Tags:

hibernate

why set 10 in hibernate config file for connection pooling ? size = 1 is built in size.why need to increase size ?

<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>

    <session-factory>
     ....

       <property name="connection.pool_size">10</property>

     ....
    </session-factory>

</hibernate-configuration>
like image 315
Sweety Avatar asked Mar 21 '12 10:03

Sweety


People also ask

Which connection pool is best for hibernate?

C3P0 is an open source JDBC connection pool distributed along with Hibernate in the lib directory. Hibernate will use its org. hibernate.

What is connection pool size?

A connection pool maintains a specific number of open database connections to an application in the main memory. The default size of the database connection pool is eight, but you can change this number while deploying or updating an application in the SAP BTP cockpit.


1 Answers

From the Hibernate API Docs.

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.

like image 152
ManuPK Avatar answered Sep 19 '22 11:09

ManuPK