Tuesday, April 30, 2013

WLS Work Manager & Thread Pool Tuning


As per Oracle Documentation, from WLS 9.0 onwards we don’t have pre-defined option available in WLS console to set maximum number of threads. Oracle recommends to create a custom Work Manager (to change the thread count value) and assign that WorkManager for the application instead of tuning default WorkManager.

The default WorkManager belongs to a thread-pool, as initial thread-pool comes with only five threads. If the application has to face a large number of hits, we may need to start with more than that. We have two options to achieve it.
------------------------------------------------------------------------------------------------------
Option1:Modify the config.xml -- Add the following line(s) in your server definition :

   <server> 
   <name>AdminServer</name> 
   <self-tuning-thread-pool-size-min>100</self-tuning-thread-pool-size-min> 
   <self-tuning-thread-pool-size-max>200</self-tuning-thread-pool-size-max> 
   [...] 
   </server> 

Option2:Adding some JVM parameters  --  Add the following system property in setDomainEnv.sh or startWebLogic.sh:
-Dweblogic.threadpool.MinPoolSize=100 
-Dweblogic.threadpool.MaxPoolSize=200  

Reboot WLS and see the option has been taken into account .
------------------------------------------------------------------------------------------------------

If we want to go with Oracle recommended approach, we have to create a custom WorkManager. Steps are given below.

a) Login to WebLogic Admin Console and click on the left Panel "Work Manager".
b) Then click on "Lock and Edit" button and click on "New" button from right panel
c) Select "Work Manager" radio button from Select Work Manager Definition type then click on Next.
d) Give the work Manager Name and click Next.
e) Now Target it to any Server or Cluster.
f)  Now go to custom Work Manager and set Max and Min thread count.
g) Now click on "Finish" and then "Activate Changes".

To make it available for specific application, we have to modify weblogic-application.xml, weblogic-ejb-jar.xml & weblogic.xml. Details are provided in below link.

We have a choice to use user-defined execute queues(old pattern) in a WebLogic Server 10.x domain. We need to include the use81-style-execute-queues sub-element of the server element in the config.xml file and reboot the server.

<use81-style-execute-queues>true</use81-style-execute-queues>

After rebooting the server, Configured work managers are converted to execute queues at runtime by the server instance. To change default thread count, refer following link.

No comments:

Post a Comment

Provide your thoughts !