To use a script to tune bus-enabled web services,
use the wsadmin
scripting client to run a script similar to the following example.
The values in this script indicate parameters that you should investigate
in terms of performance, so make sure that you understand the impact that
changing these parameters will have on the system, especially in cases where
bus-enabled web services might not be the only work that your application server
handles. Note: Run the script from within QShell.
#--------------------------------------------------------------------
# Bus-enabled web services WebSphere Tuning Script
#--------------------------------------------------------------------
##
# This script is designed to modify some of the tuning pertinent to a
# bus-enabled web services deployment.
# In order to tune the config parameters, change the values
# provided below. This script assumes that all server names in a
# cluster configuration are unique.
#
# To invoke the script, type:
# wsadmin -f tuneWAS.py <scope> <id>
# scope - 'cluster' or 'server'
# id - name of target object within scope (i.e. servername)
#
# Example:
# wsadmin -f tuneWAS.py server server1
# wsadmin -f tuneWAS.py cluster WSGWCluster
#
#
#--------------------------------------------------------------------
import sys
AdminConfig.setValidationLevel("NONE")
print "Starting script..."
print "Reaqding config parameters..."
#--------------------------------------------------------------------
# COMMON CONFIG PARAMETERS
# - Adjust these parameters based on the intended target system (Defaults in parentheses)
#--------------------------------------------------------------------
# WebContainer Thread Pool (10,50)
minWebPool=10
maxWebPool=15
# Default Thread Pool - (Multiprotocol MDB) (10,50)
minDefaultPool=10
maxDefaultPool=15
# Mediations Thread Pool (1,5)
minMediationPool=10
maxMediationPool=15
# HTTP KeepAlive settings (true, 100)
keepAliveEnabled="true"
maxPersistentRequests=-1
# Inactivity Timeouts for thread pools (3500)
inactivity=3500
# JVM properties
minHeap=1280
maxHeap=1280
verboseGC="false"
genericArgs=""
# J2CActivationSpec for the SIB_RA Resource adapter
SIB_RA_maxConcurrency=40
SIB_RA_maxBatchSize=5
# Jav2 Security (false for 5.1 and true for 6.0)
j2Security="false"
# Parallel server startup
parallelStart="false"
#---------------------------------------------
# Check/Print Usage
#---------------------------------------------
def printUsageAndExit():
print
print "Usage: wsadmin -f tuneWAS.py <cluster | server> <name>"
sys.exit(0)
#---------------------------------------------
# Misc Procedures
#---------------------------------------------
def getName(objectid):
endIndex=objectid.index("(")
return objectId[0:endIndex]
#---------------------------------------------
# Parse command line arguments
#---------------------------------------------
print "Parsing command line arguments..."
if len(sys.argv)<2:
printUsageAndExit()
else:
scope=sys.argv[0]
print "Scope: %s" % scope
if scope=="cluster":
clustername=sys.argv[1]
print "Cluster: %s" % clustername
elif scope=="server":
servername=sys.argv[1]
print "Server: %s" % servername
else:
print "Error: Invalid Argument (%s)" % scope
printUsageAndExit()
#---------------------------------------------
# Obtain server list
#---------------------------------------------
print
print "Obtaining server list..."
serverList=[]
if scope=="cluster":
cluster=AdminConfig.getid("/ServerCluster:%s/" % clustername)
temp=AdminConfig.showAttribute(cluster , "members")
memberList=" ".split(temp[1:-1])
for member in memberList:
memberName=getName(member)
serverList.insert(0,AdminConfig.getid("/Server:%s/" % memberName))
else:
server=AdminConfig.getid("/Server:%s/" % servername)
serverList.insert(0,server)
#---------------------------------------------
# Print config properties
#---------------------------------------------
print
print "WebSphere configuration"
print "-----------------------"
print ""
print " Enforce Java2 Security: %s" % j2Security
print
print "Servers:"
for server in serverList:
print " %s" % getName(server)
print
print " Web --------------------------------------------"
print " Min WebContainer Pool Size: %s" % minWebPool
print " Max WebContainer Pool Size: %s" % maxWebPool
print " JVM --------------------------------------------"
print " Min JVM Heap Size: %s" % minHeap
print " Max JVM Heap Size: %s" % maxHeap
print " Verbose GC: %s" % verboseGC
print
#---------------------------------------------
# Modify cell parameters
#---------------------------------------------
# Accessing cell based security config
print "Accessing security configuration..."
sec=AdminConfig.list("Security")
attrs=[["enforceJava2Security",j2Security]]
print "Updating secuirty..."
AdminConfig.modify(sec,attrs)
#---------------------------------------------
# Modify server parameters
#---------------------------------------------
for server in serverList:
servername=getName(server)
print
print "Serevr: %s" % servername
print
# Accessing server startup config
print "Accessing server startup configuration..."
print "Parallel Startup (old/new): %s/%s"
print % (AdminConfig.showAttribute(server,"parallelStartEnabled") , parallelStart)
attrs=[['parallelStartEnabled' , parallelStart]]
print "Updating server startup..."
print
AdminConfig.modify(server , attrs)
# Accessing web container thread pool config
print "Accessing web container thread pool configuration..."
tpList=AdminConfig.list('ThreadPool',server).splitlines()
webPool=filter(lambda x: re.search("WebContainer" , x) , tpList)[0]
print "ThreadPool MaxSize (old/new): %s/%s"
print % (AdminConfig.showAttribute(webPool , "maximumSize") , maxWebPool)
print "ThreadPool MinSize (old/new): %s/%s"
print % (AdminConfig.showAttribute(webPool , "minimumSize") , minWebPool)
print "ThreadPool Inactivity Timeout (old/new): %s/%s"
print % (AdminConfig.showAttribute(webPool , "inactivityTimeout") , inactivity)
attrs=[["maximumSize" , maxWebPool] , ["minimumSize" , minWebPool] ,
["inactivityTimeout" , inactivity]]
print "Updating web container thread pool..."
print
AdminConfig.modify(webPool , attrs)
# Accessing default thread pool config
print "Accessing default thread pool configuration..."
tpList=AdminConfig.list("ThreadPool" , server)
webPool=filter(lambda x: re.search("Default" , x) , tpList)[0]
print "ThreadPool MaxSize (old/new): %s/%s"
print % (AdminConfig.showAttribute(webPool , "maximumSize") , maxDefaultPool)
print "ThreadPool MinSize (old/new): %s/%s"
print % (AdminConfig.showAttribute(webPool , "minimumSize") , minDefaultPool)
print "ThreadPool Inactivity Timeout (old/new): %s/%s"
print % (AdminConfig.showAttribute(webPool , "inactivityTimeout") , inactivity)
attrs=[["maximumSize" , maxDefaultPool] , ["minimumSize" , minDefaultPool] ,
["inactivityTimeout" , inactivity]]
print "Updating default thread pool..."
print
AdminConfig.modify(webPool , attrs)
# Creating Mediations Thread Pool
print "Creating Mediations thread pool"
me=AdminConfig.list(SIBMessagingEngine)
mtpName="%s-mediationThreadPool" % AdminConfig.showAttribute(me , "name")
tpAttrs=[["name" , mtpName] , ["minimumSize" , minMediationPool] ,
["maximumSize" , maxMediationPool]]
print "ThreadPool Name : %s" % mtpName
print "ThreadPool MaxSize : %s" % maxMediationPool
print "ThreadPool MinSize : %s" % minMediationPool
AdminConfig.create("ThreadPool" , me , tpAttrs , "mediationThreadPool")
print "Mediations Thread Pool Created"
print
# Accessing HTTP keepalive config
print "Accessing HTTP KeepAlive configuration..."
HTTPInbound=AdminConfig.list("HTTPInboundChannel" , server)
http2=filter(lambda x: re.search("HTTP_2" , x) , HTTPInbound)[0]
print "KeepAlive Enabled (old/new): %s/%s"
print % (AdminConfig.showAttribute(http2 , "keepAlive") ,keepAliveEnabled)
print "Max Persistent Requests (old/new): %s/%s"
print % (AdminConfig.showAttribute(http2 ,
print "maximumPersistentRequests") , maxPersistentRequests)
attrs=[["keepAlive" , keepAliveEnabled] ,
print ["maximumPersistentRequests" , maxPersistentRequests]]
print "Updating HTTP KeepAlives"
print
AdminConfig.modify(http2 , attr)
# Accessing JVM config
print "Accessing JVM configuration..."
jvm=AdminConfig.list("JavaVirtualMachine" , server)
print "Initial Heap Size (old/new): %s/%s"
print % (AdminConfig.showAttribute(jvm , "initialHeapSize") , minHeap)
print "Maximum Heap Size (old/new): %s/%s"
print % (AdminConfig.showAttribute(jvm , "maximumHeapSize") , maxHeap)
print "VerboseGC Enabled (old/new): %s/%s"
print % (AdminConfig.showAttribute(jvm , "verboseModeGarbageCollection") , verboseGC)
attrs=[["initialHeapSize" , minHeap] , ["maximumHeapSize" , maxHeap],
["verboseModeGarbageCollection" , verboseGC]]
print "Updating JVM..."
print
AdminConfig.modify(jvm , attrs)
# Accessing J2CActivationSpec for the SIB Resource Adapter
print "Modifying the J2CActivationSpec for the SIB Resource Adapter"
actSpec=AdminConfig.getid("/J2CActivationSpec:SIBWS_OUTBOUND_MDB/")
propSet=AdminConfig.showAttribute(actSpec , "resourceProperties").splitlines()
propSet=propSet[0]
maxConcurrency=["value" , SIB_RA_maxConcurrency]
maxConcurrency=[maxConcurrency]
maxBatchSize=["value" , SIB_RA_maxBatchSize]
maxBatchSize=[maxBatchSize]
for propId in propSet:
if AdminConfig.showAttribute(propId , "name")=="maxConcurrency":
AdminConfig.modify(propId , maxConcurrency)
print "Custom property changed : %s" % AdminConfig.showall(propId)
if AdminConfig.showAttribute(propId , "name")=="maxBatchSize":
AdminConfig.modify(propId , maxBatchSize)
print "Custom property changed : %s" % AdminConfig.showall(propId)
print "J2CActivationSpec modifications complete"
print
print "Script completed..."
print "Saving config..."
AdminConfig.save()