简体   繁体   中英

Mule 4 DB Pooling Configuration

I want to use db pooling for mule using below connector:

<db:mysql-config name="dbConfig" host="localhost" port="3306" user="root"
   password="" database="esb" doc:name="MySQL Configuration">
   <db:pooling-profile maxPoolSize="17" minPoolSize="13" acquireIncrement="1"/>
</db:mysql-config>

Reference - https://docs.mulesoft.com/mule-runtime/4.3/tuning-pooling-profiles

My question is, suppose if application is on peek load 4000 queries/sec going to db and turnaround time time is 0.4 sec for every query. My question what maxPoolSize should need to set?

Second question, according to mule documentation acquireIncrement property use is 'Determines how many connections at a time to try to acquire when the pool is exhausted'. Does this mean if maxPoolSize is exhausted a new connection got created and later dropped, is that fair understanding?

If a query takes 0.4 seconds then a connection could be used theoretically to execute 2.5 queries per second. So for 4000 queries per second you would need at least 4000/2.5=1600 connections. You should add some more to be covered by peaks, longer queries, etc. That really depends on the usage pattern of your application. You should try to measure the usage in load testing or tracking real life usage. To be on the safe side I would guess no less than 2000.

acquireIncrement is used when there are no available idle connections at the moment, the total number of connections doesn't exceed maxPoolSize and a request for a new connection arrive. You might want to create 3 connections instead of just 1, because of the usage pattern expected for your application. The number of total connections will never exceed maxPoolSize in any case. For example using the configuration you shared, there might be 14 active connections in use and a new query arrives. If acquireIncrement is 2 the pool will create 2 additional connections for a total of 16.

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