[Java] HikariCP Connection Pool

Java/Java 2014.10.12 00:46

링크: https://github.com/brettwooldridge/HikariCP

링크: https://github.com/brettwooldridge/HikariCP/wiki/Hibernate4

링크: https://github.com/brettwooldridge/HikariCP/wiki/MySQL-Configuration

링크: https://github.com/brettwooldridge/HikariCP/wiki/Spring-Hibernate


국내 링크: http://netframework.tistory.com/431


성능이 좋다는 말이 있다. 우선 테스트로 사용해 보고 판단하자.


Springframework datasource (context-datasource.xml)

<!-- HikariCP configuration -->

<bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource" destroy-method="shutdown">

    <constructor-arg>

        <bean class="com.zaxxer.hikari.HikariConfig">

            <constructor-arg>

                <props>

                    <prop key="dataSource.url">jdbc:mysql://localhost/database</prop>

                    <prop key="dataSource.user">username</prop>

                    <prop key="dataSource.password">password</prop>

                    <prop key="dataSource.cachePrepStmts">true</prop>

                    <prop key="dataSource.prepStmtCacheSize">250</prop>

                    <prop key="dataSource.prepStmtCacheSqlLimit">2048</prop>

                    <prop key="dataSource.useServerPrepStmts">true</prop>

                </props>

            </constructor-arg>

            <property name="dataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" />

            <property name="minimumIdle" value="5" />

            <property name="maximumPoolSize" value="10" />

            <property name="connectionTestQuery" value="SELECT 1" />

            <property name="connectionTimeout"  value="300000" />

        </bean>

    </constructor-arg>

</bean>



Tomcat + Jndi (context.xml)

<Resource name="jdbc/myJndiName"

          auth="Container"

          factory="com.zaxxer.hikari.HikariJNDIFactory"

          type="javax.sql.DataSource"

          dataSourceClassName="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"

          minimumIdle="5"

          maximumPoolSize="10"

          connectionTimeout="300000"

          connectionTestQuery="SELECT 1"


          dataSource.url="jdbc:mysql://localhost/database"

          dataSource.user="username"

          dataSource.password="password"

          dataSource.cachePrepStmts="true"

          dataSource.prepStmtCacheSize="250"

          dataSource.prepStmtCacheSqlLimit="2048"

          dataSource.useServerPrepStmts="true"

          />


저작자 표시 비영리 변경 금지
신고

'Java > Java' 카테고리의 다른 글

[Java] tattletale (프로젝트 구성을 볼수 있음)  (0) 2015.03.08
[Java] 자바 매크로  (0) 2015.01.20
[Java] HikariCP Connection Pool  (0) 2014.10.12
[Java] Java Installer IzPack  (0) 2014.06.24
[Java] Current Project classpath  (0) 2014.05.31
[Java] Cron 문법  (0) 2014.03.31
posted by 뚱2