OSBandThreadPools

Overview

A Work Manager defines a set of request classes and thread constraints that manage work performed by WebLogic Servers. Global Work Managers are defined at the domain level. You can also define application-level and module-level Work Managers. WebLogic Server allows you to configure how your application prioritizes the execution of its work based on rules you define and by monitoring actual runtime performance. You define the rules and constraints for your application by defining a Work Manger and applying it either globally to WebLogic Server domain or to a specific application component. For example, you have two services, first one is often used but less important, and the second one is used less frequently but highly important, you can create Work Manager to accomplish service priority.

It’s a good practice to allocate a work manager to each Proxy Service rather than leaving the default. By leaving the default, the proxy will run in the default thread pool with all the other unallocated threads. This may affect the proxy processing times and throughput which may potentially lead to bottlenecks. By explicitly setting the Dispatch Policy of the proxy, you can then allocate the resources required.


Benefit of Work Managers

Script Detail

It is not unusual for an ESB Administrator to oversee hundreds of proxies and therefore manually creating and allocating Work Managers through the console is not practical. One of the best ways to do this is to automate this process using WebLogic Server Scripting Tool (WLST). Using a script also gives you the benefit of the process being repeatable and able to be version controlled.

A Work Manager can be created and allocated to a JMS Proxy Service by the following WLST commands:

1. Connect to the Admin Server and start an edit session.

connect(‘weblogic’, ‘weblogic’, 't3://localhost:7001')
edit()
startEdit()


2. Once connected to the Admin server, set your current path to the Self Tuning – Domain directory.

path = '/SelfTuning/' + domainName + '/'
cd (path)

3. Format the name of your Maximum Thread Constraint and try and fetch the Mbean by that name. If the fetched Mbean is not null, then the Maximum Thread Constraint already exists. If it is null, then create your Maximum Thread Constraint. At the same time, you set your maximum threads and deployment target.

maxthreadWorkManager = workmanagerPrefix + 'WorkManager.MaxThreads'
maxthr_bean = getMBean (path+'/MaxThreadsConstraints/' + maxthreadWorkManager)

if maxthr_bean:
print 'Max Thread Constraint: ' + maxthreadWorkManager + ' already exists'
else:
maxthr_bean = create(maxthreadWorkManager,'MaxThreadsConstraints')
maxthr_bean.setCount(int(count))
maxthr_bean.addTarget(getMBean(target))

4. The next step is to create your Work Manager. As with the previous step, format the Work Manager name and then try and fetch the Mbean. If the fetched Mbean is not null, them the Work Manager exists. If it is null, then create the Work Manager. At the same time, set the deployment target and Max Thread Constraint from the previous step.

workManager = workmanagerPrefix + 'WorkManager'
wm_bean = getMBean (path + '/WorkManagers/' + workManager)

if wm_bean:
print 'Work Manager: ' + workManager + ' already exists'
else:
wm_bean = create(workManager,'WorkManagers')
wm_bean.addTarget(getMBean(target))
wm_bean.setMaxThreadsConstraint(maxthr_bean)

5. Save and activate the WLS session. Now change to the domain runtime context and start an ALSB session. From the session, get an instance of the ALSBConfigurationMBean.

save()
activate(block="true")

domainRuntime()
SessionMBean = getSessionMBean(sessionName)
alsbConfig = findService(String("ALSBConfiguration.").concat(sessionName), "com.bea.wli.sb.management.configuration.ALSBConfigurationMBean")

6. Now set up the path to the respective proxy service and create the Work Manager non-qualified environment object. Combine the two into a qualified environment object. Using the instance of the ALSBConfigurationMBean, assign the Work Manager to the proxy.

proxyPath = [projectName,folderName,proxyName]
nonQualifiedEnv = NonQualifiedEnvValue("Work Manager", None, wmName)
qualifiedEnv = QualifiedEnvValue(Ref(TypeIds.PROXY_REF,proxyPath),nonQualifiedEnv)
newWorkManager = ArrayList()
newWorkManager.add(qualifiedEnv)
alsbConfig.assignEnvValues(newWorkManager)

7. Finally, activate the ALSB session and disconnect from the server.

SessionMBean.activateSession(sessionName, "Create and Assign Work Manager")

disconnect()

Prerequisites

Before running this example, you must have the following:
  • A running ALSB domain (Either single server or cluster)
  • An JMS ALSB Proxy Service

Download

The ALSB Work Manager example can be downloaded at the following address: https://msmith.projects.dev2dev.bea.com/alm-process/2-WLST/documents/esb_workmanager_example.zip






mark.ms.smith
mark.ms.smith
Latest page update: made by mark.ms.smith , Jul 21 2008, 9:55 PM EDT (about this update About This Update mark.ms.smith Edited by mark.ms.smith

1 word added
9 words deleted

view changes

- complete history)
Keyword tags: Oracle Service Bus Threads
More Info: links to this page

There are no threads for this page. 

Anonymous  (Get credit for your thread)


Related Content

  (what's this?Related ContentThanks to keyword tags, links to related pages and threads are added to the bottom of your pages. Up to 15 links are shown, determined by matching tags and by how recently the content was updated; keeping the most current at the top. Share your feedback on Wetpaint Central.)