WebSphere sample tuning script
The following is the WebSphere® tuning script (trade_tune.jacl) supplied with Trade that we used for our z/VM® test runs.
Note: The ↓ symbol indicates that the text continues on the next line. These
lines should be entered on one line, not broken into multiple lines.
#--------------------------------------------------------------------
# Generic WebSphere Tuning Script
#--------------------------------------------------------------------
#
# Author: Christopher Blythe
#
# This script is designed to modify some of the most common
# WebSphere configuration parameters and tuning knobs.
# In order to tune the config parameters, simply 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.jacl <scope> <id>
# scope - 'cluster' or 'server'
# id - name of target object within scope (ie. servername)
#
# Examples:
# wsadmin -f tuneWAS.jacl server server1
#
# wsadmin -f tuneWAS.jacl cluster TradeCluster
#
#
#--------------------------------------------------------------------
$AdminConfig setValidationLevel NONE
set buildDate "09212004"
puts "Starting script..."
puts "Version: $buildDate"
puts "Reading config parameters..."
#--------------------------------------------------------------------
# COMMON CONFIG PARAMETERS
# - Adjust these parameters based on the intended target system
#--------------------------------------------------------------------
# ORB properties (10,50,false)
set minORBPool 10
set maxORBPool 50
set noLocalCopies true
# WebContainer Thread Pool (10,50)
set minWebPool 50
set maxWebPool 50
# HTTP KeepAlive settings (true, 100)
set keepAliveEnabled true
set maxPersistentRequests -1
# Inactivity Timeouts for thread pools (3500)
set inactivity 3500
# EJB Cache properties (2053)
set ejbCacheSize 2053
# JVM properties
set minHeap 1024
set maxHeap 1024
set verboseGC "false"
set genericArgs ""
# OS Specific JVM options
set IBMJDKoptions ""
set SUNJDKoptions "-XX:MaxPermSize=64m -XX:MaxNewSize=680m -XX:NewSize=680m ↓
-XX:SurvivorRatio=16"
set HPJDKoptions "-Xmn680m"
# SPECjAppServer2002 related generic JVM arguments
# -Dcom.ibm.ws.pm.batch=true
# -Dcom.ibm.ws.pm.deferredcreate=true
# -Dcom.ibm.CORBA.FragmentSize=0
# Trade3 related generic JVM arguments
# -Dcom.ibm.websphere.ejbcontainer.noPrimaryKeyMutation=true
# Transaction Service properties (120,60)
set txTimeout 120
set clientTimeout 60
# SystemOut and SystemErr log rollover type (SIZE)
set rollover "NONE"
# TraceService settings {"*=all=disabled",20,1}
set traceSpec "*=all=disabled"
set traceRolloverSize 100
set maxFiles 10
# Java2 Security (false for 5.1 and true for 6.0)
set j2Security false
# PMI service
set PMIstatus false
# Uninstall default applications
# Possibly uninstall applications - DefaultApplication, ivtApp
set uninstallApps true
set uninstallList [list ivtApp DefaultApplication Query]
# Parallel server startup
set parallelStart false
#---------------------------------------------
# Check/Print Usage
#---------------------------------------------
proc printUsageAndExit {} {
puts " "
puts "Usage: wsadmin -f tuneWAS.jacl <cluster | server> <name>"
exit
}
#---------------------------------------------
# Misc Procedures
#---------------------------------------------
proc getName {objectid} {
set endIndex [expr [string first "(" $objectid] - 1]
return [string range $objectid 0 $endIndex]
}
#---------------------------------------------
# Parse command line arguments
#---------------------------------------------
puts "Parsing command line arguments..."
if {[llength $argv] < 2} {
printUsageAndExit
} else {
set scope [lindex $argv 0]
puts "Scope: ${scope}"
if {$scope == "cluster"} {
set clustername [lindex $argv 1]
puts "Cluster: ${clustername}"
} elseif {$scope == "server"} {
set servername [lindex $argv 1]
puts "Server: ${servername}"
} else {
puts "Error: Invalid Argument ($scope)"
printUsageAndExit
}
}
#---------------------------------------------------------------------
# Base OS Specific JVM settings
#---------------------------------------------------------------------
if {[string first "Windows" $env(os.name)] >= 0 } {
set genericArgs [concat $genericArgs $IBMJDKoptions]
} elseif {$env(os.name) == "AIX"} {
set genericArgs [concat $genericArgs $IBMJDKoptions]
} elseif {$env(os.name) == "Linux"} {
set genericArgs [concat $genericArgs $IBMJDKoptions]
} elseif {$env(os.name) == "SunOS"} {
set genericArgs [concat $genericArgs $SUNJDKoptions]
} elseif {$env(os.name) == "HP-UX"} {
set genericArgs [concat $genericArgs $HPJDKoptions]
}
#---------------------------------------------
# Obtain server list
#---------------------------------------------
puts ""
puts "Obtaining server list..."
if {$scope == "cluster"} {
set cluster [$AdminConfig getid "/ServerCluster:${clustername}/"]
set temp [$AdminConfig showAttribute $cluster members]
set memberList [split [string trim $temp "{ }"] " "]
foreach member $memberList {
set memberName [getName $member]
lappend serverList [$AdminConfig getid "/Server:${memberName}/"]
}
} else {
set server [$AdminConfig getid "/Server:${servername}/"]
lappend serverList $server
}
#---------------------------------------------
# Print config properties
#---------------------------------------------
puts ""
puts "WebSphere configuration"
puts "-----------------------"
puts ""
puts " Enforce Java2 Security: ${j2Security} "
puts ""
puts "Servers:"
foreach server $serverList {
puts " [getName $server]"
}
puts ""
puts " EJB/ORB ----------------------------------------"
puts " Min ORB Pool Size: ${minORBPool} "
puts " Max ORB Pool Size: ${maxORBPool} "
puts " EJB Cache Size: ${ejbCacheSize} "
puts " NoLocalCopies: ${noLocalCopies} "
puts " Web --------------------------------------------"
puts " Min WebContainer Pool Size: ${minWebPool} "
puts " Max WebContainer Pool Size: ${maxWebPool} "
puts " JVM --------------------------------------------"
puts " Min JVM Heap Size: ${minHeap} "
puts " Max JVM Heap Size: ${maxHeap} "
puts " Verbose GC: ${verboseGC}"
puts " Generic JVM Arguments: "
puts " ${genericArgs}"
puts " Transaction ------------------------------------"
puts " Total Transaction Timeout: ${txTimeout} "
puts " Client Inactivity Timeout: ${clientTimeout} "
puts " Logging ----------------------------------------"
puts " System Log Rollover Type: ${rollover} "
puts " Trace Specification: ${traceSpec} "
puts " Rollover Size: ${traceRolloverSize} "
puts " Max Backup Files: ${maxFiles} "
puts " Misc -------------------------------------------"
puts " Enable PMI Service: ${PMIstatus} "
puts " Pool Activity Timeouts: ${inactivity} "
puts " Parallel Startup: ${parallelStart} "
puts ""
puts " Uninstall default apps: ${uninstallApps} "
puts ""
#---------------------------------------------
# Modify cell parameters
#---------------------------------------------
# Accessing cell based security config
puts "Accessing security configuration..."
set sec [$AdminConfig list Security]
set attrs [subst {{enforceJava2Security $j2Security}}]
puts "Updating security..."
$AdminConfig modify $sec $attrs
#---------------------------------------------
# Modify server parameters
#---------------------------------------------
foreach server $serverList {
set servername [getName $server]
puts ""
puts "Server: $servername"
puts ""
# Accessing server startup config
puts "Accessing server startup configuration..."
puts "Parallel Startup (old/new): [$AdminConfig showAttribute $server ↓
parallelStartEnabled]/$parallelStart"
set attrs [subst {{parallelStartEnabled $parallelStart}}]
puts "Updating server startup..."
puts ""
$AdminConfig modify $server $attrs
# Accessing orb config
puts "Accessing ORB configuration..."
set orb [$AdminConfig list ObjectRequestBroker $server]
set attrs [subst {{noLocalCopies $noLocalCopies}}]
puts "ORB noLocalCopies (old/new): [$AdminConfig showAttribute $orb ↓
noLocalCopies]/$noLocalCopies"
$AdminConfig modify $orb $attrs
set orbPool [$AdminConfig showAttribute $orb threadPool]
puts "ThreadPool MaxSize (old/new): [$AdminConfig showAttribute $orbPool ↓
maximumSize]/$maxORBPool"
puts "ThreadPool MinSize (old/new): [$AdminConfig showAttribute $orbPool ↓
minimumSize]/$minORBPool"
puts "ThreadPool Inactivity Timeout (old/new): [$AdminConfig showAttribute ↓
$orbPool inactivityTimeout]/$inactivity"
set attrs [subst {{maximumSize $maxORBPool} {minimumSize $minORBPool}↓
{inactivityTimeout $inactivity}}]
puts "Updating ORB..."
puts " "
$AdminConfig modify $orbPool $attrs
# Accessing web container thread pool config
puts "Accessing web container thread pool configuration..."
set tpList [$AdminConfig list ThreadPool $server]
set oI [lsearch -glob $tpList "*WebContainer*"]
set webPool [lindex $tpList $oI]
puts "ThreadPool MaxSize (old/new): [$AdminConfig showAttribute $webPool ↓
maximumSize]/$maxWebPool"
puts "ThreadPool MinSize (old/new): [$AdminConfig showAttribute $webPool ↓
minimumSize]/$minWebPool"
puts "ThreadPool Inactivity Timeout (old/new): [$AdminConfig showAttribute ↓
$webPool inactivityTimeout]/$inactivity"
set attrs [subst {{maximumSize $maxWebPool} {minimumSize $minWebPool} ↓
{inactivityTimeout $inactivity}}]
puts "Updating web container thread pool..."
puts " "
$AdminConfig modify $webPool $attrs
# Accessing HTTP keepalive config
puts "Accessing HTTP KeepAlive configuration..."
set HTTPInbound [$AdminConfig list HTTPInboundChannel $server]
set oI [lsearch -glob $HTTPInbound "*HTTP_2*"]
set http2 [lindex $HTTPInbound $oI]
puts "KeepAlive Enabled (old/new): [$AdminConfig showAttribute $http2 ↓
keepAlive]/$keepAliveEnabled"
puts "Max Persistent Requests (old/new): [$AdminConfig showAttribute $http2 ↓
maximumPersistentRequests]/$maxPersistentRequests"
set attrs [subst {{keepAlive $keepAliveEnabled} {maximumPersistentRequests ↓
$maxPersistentRequests}}]
puts "Updating HTTP KeepAlives..."
puts " "
$AdminConfig modify $http2 $attrs
# Accessing EJB cache
puts "Accessing EJB cache..."
set ejbCache [$AdminConfig list EJBCache $server]
puts "Cache Size (old/new): [$AdminConfig showAttribute ↓
$ejbCache cacheSize]/$ejbCacheSize"
set attrs [subst {{cacheSize $ejbCacheSize}}]
puts "Updating EJB cache..."
puts " "
$AdminConfig modify $ejbCache $attrs
# Accessing Transaction Service
puts "Accessing Transaction Service..."
set txService [$AdminConfig list TransactionService $server]
puts "Client Inactivity Timeout (old/new): [$AdminConfig showAttribute ↓
$txService clientInactivityTimeout]/$clientTimeout"
puts "Total Transaction Lifetime Timeout (old/new):[$AdminConfig showAttribute ↓
$txService totalTranLifetimeTimeout]/$txTimeout"
set attrs [subst {{clientInactivityTimeout $clientTimeout} ↓
{totalTranLifetimeTimeout $txTimeout}}]
puts "Updating Transaction Service..."
puts " "
$AdminConfig modify $txService $attrs
# Accessing JVM config
puts "Accessing JVM configuration..."
set jvm [$AdminConfig list JavaVirtualMachine $server]
puts "Initial Heap Size (old/new): [$AdminConfig showAttribute $jvm ↓
initialHeapSize]/$minHeap"
puts "Maximum Heap Size (old/new): [$AdminConfig showAttribute ↓
$jvm maximumHeapSize]/$maxHeap"
puts "VerboseGC Enabled (old/new): [$AdminConfig showAttribute $jvm ↓
verboseModeGarbageCollection]/$verboseGC"
puts "Generic Arguments (old/new): [$AdminConfig showAttribute ↓
$jvm genericJvmArguments]/$genericArgs"
set attrs [subst {{initialHeapSize $minHeap} {maximumHeapSize $maxHeap} ↓
{verboseModeGarbageCollection $verboseGC} {genericJvmArguments ↓
"$genericArgs"}}]
puts "Updating JVM..."
puts " "
$AdminConfig modify $jvm $attrs
# Accessing System log file config
puts "Accessing System log file configuration..."
set logList [$AdminConfig list StreamRedirect $server]
foreach log $logList {
puts "[$AdminConfig showAttribute $log fileName] Rollover Type (old/new): ↓
[$AdminConfig showAttribute $log rolloverType]/${rollover}"
set attrs [subst {{rolloverType $rollover}}]
puts "Updating logs..."
puts " "
$AdminConfig modify $log $attrs
}
# Accessing Trace Service config
puts "Accessing Trace Service configuration..."
set traceService [$AdminConfig list TraceService $server]
set traceLog [$AdminConfig showAttribute $traceService traceLog]
puts "Trace Spec (old/new): [$AdminConfig showAttribute $traceService ↓
startupTraceSpecification]/$traceSpec"
puts "Rollover File Size (old/new): [$AdminConfig showAttribute $traceLog ↓
rolloverSize]/$traceRolloverSize"
puts "Max Backup Files (old/new): [$AdminConfig showAttribute $traceLog ↓
maxNumberOfBackupFiles]/$maxFiles"
set attrs [subst {{startupTraceSpecification $traceSpec}}]
set attrs2 [subst { {rolloverSize $traceRolloverSize} {maxNumberOfBackupFiles ↓
$maxFiles}}]
puts "Updating Trace Service..."
puts " "
$AdminConfig modify $traceService $attrs
$AdminConfig modify $traceLog $attrs2
# Accessing PMI service config
puts "Accessing PMI service configuration..."
set pmi [$AdminConfig list PMIService $server]
puts "Enable (old/new): [$AdminConfig showAttribute $pmi enable]/$PMIstatus"
set attrs [subst {{enable $PMIstatus}}]
puts "Updating PMI..."
puts " "
$AdminConfig modify $pmi $attrs
# Uninstalling default applications
# Possibly uninstall applications - DefaultApplication, ivtApp, UDDIRegistry, ↓
ManagementEJB
if {$uninstallApps} {
puts "Uninstalling default applications..."
set appList [$AdminApp list]
foreach app $appList {
set oI [lsearch -glob $uninstallList $app]
if {$oI > -1} {
puts "Removing application $app..."
$AdminApp uninstall $app
}
}
}
}
puts ""
puts "Script completed..."
puts "Saving config..."
$AdminConfig save