JDBC Pool Manager - Max Pool Size Tuning

Max pool size is the maximum number of connections to the database at any point of time. This value can be configured as a jdbc connection pool attribute "max–pool–size". The default value of this attribute is 32. 

Some databases have license restrictions on how many connections it can allow. This attribute is configured based on such parameters.  This parameter can also be configured from the Performance Advisor page in administration console of GlassFish. Some important points to note here :


  • If one or more jdbc connection pools are selected in the JDBC Pool Manager, there is an option to specify a "Max Connections" value for each pool according to the requirement. 

  • The Default Max Connections set to a certain value overrides the settings of the max–pool–size of the selected jdbc connection pools.


On a clustered environment, when new instances are added to the cluster, the max–pool–size on each instance may need a reconfiguration. This should also be based on the instance weights. A particular instance may have a higher instance weight, say, to provide faster service to privileged customers.
Steps

  • Create a node–agent called na1

  • Create a cluster "mycluster" with 2 instances "instance1" (weight 40) and "instance2" (weight 60)

  • Start the cluster "mycluster"

  • Create a new JDBC Connection pool "mypool" with default settings

  • Create a new JDBC resource referring the above connection pool for target "mycluster" : "jdbc/myresource"

  • Create an application that refers this jdbc resource on "mycluster" target


Clustered environment


  • In the performance advisor link of admin console, specify the default max connections for "mypool" as 100. Enable this rule on "mycluster" by choosing "mycluster" for target. Jdbc Rule Manager


Setting target as mycluster

After these steps, the "mycluster" should be restarted to see the max pool size reconfiguration in each of the instances "instance1" and "instance2".

You would see, for "instance1", the max pool size is recalculated to 40

instance1 log from admin console

and "instance2" to 60 based on their instance weights.

instance2 log from admin console


  • Add another new instance "instance3" to "mycluster" with weight of 100.

  • Restart "mycluster".


Once the cluster is restarted with the new instances addition, the max pool size of instance1 becomes 20, instance2 becomes 30 and instance3 becomes 50. This is based on the instance weights and the default max connections value we specified for the jdbc connection pool. instance3 gets more number of max connections to the database since its instance weight is higher.

instance1 log from admin console after instance addition
instance2 log from admin console after instance addition
instance3 log from admin console after instance addition

This is a very useful rule to configure the maximum pool size of jdbc connection pools on cluster startup. Manual intervention is prevented and this easy–to–use feature can be configured to avoid errors in complex cluster scenarios.

Comments:

Very nice descriptions (this one & prev one), Shalini.

--Bhavani.

Posted by Bhavanishankara Sapaliga on February 10, 2009 at 03:47 PM IST #

reqr

Posted by guest on February 28, 2011 at 01:21 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed
About

shalini_m

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today