Trade setup

The following is the Trade tuning script we used for our DB2® UDB system.

Tuning script for DB2 UDB

tune_trade.sh
db2 -v "connect to tradedb"
#db2 -v "update db cfg for tradedb using DBHEAP 6992"
db2 -v "update db cfg for tradedb using DBHEAP 25000"
db2 -v "update db cfg for tradedb using CATALOGCACHE_SZ 282"
#db2 -v "update db cfg for tradedb using LOGBUFSZ 4096"
db2 -v "update db cfg for tradedb using LOGBUFSZ 8192"
db2 -v "update db cfg for tradedb using BUFFPAGE 366190"
db2 -v "update db cfg for tradedb using LOCKLIST 1000"
db2 -v "update db cfg for tradedb using SORTHEAP 642"
db2 -v "update db cfg for tradedb using STMTHEAP 2048"
db2 -v "update db cfg for tradedb using PCKCACHESZ 7500"
db2 -v "update db cfg for tradedb using MAXLOCKS 75"
db2 -v "update db cfg for tradedb using MAXAPPLS 500"
db2 -v "update db cfg for tradedb using LOGFILSIZ 5000"
db2 -v "update db cfg for tradedb using LOGPRIMARY 6"
db2 -v "update db cfg for tradedb using LOGSECOND 6"
#db2 -v "update db cfg for tradedb using newlogpath e:"
db2 -v "update db cfg for tradedb using SOFTMAX 70"
db2 -v "update dbm cfg using MAXAGENTS 500"
db2 -v "update dbm cfg using NUM_POOLAGENTS 250"
db2 -v "update dbm cfg using MAX_QUERYDEGREE 1"
db2 -v "update dbm cfg using FCM_NUM_BUFFERS 2048"
db2 -v "update dbm cfg using FCM_NUM_RQB 6500"
db2 -v "update dbm cfg using DFT_MON_LOCK OFF"
db2 -v "update dbm cfg using DFT_MON_BUFPOOL ON"
db2 -v "update dbm cfg using DFT_MON_STMT OFF"
db2 -v "update dbm cfg using DFT_MON_TABLE OFF"
db2 -v "update dbm cfg using DFT_MON_UOW OFF"
db2 -v "alter bufferpool ibmdefaultbp size 1000"
db2 -v "reorgchk update statistics on table all"
db2 -v "connect reset"
db2 -v "terminate"

Tuning script for WebSphere®

The following is the Trade tuning script we used for our WebSphere system.

trade_tune.jacl
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.
Figure 1. Trade tuning script for WebSphere
#--------------------------------------------------------------------
# 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

Enabling the Trade application to use WebSphere dynamic caching

Caching capabilities in Trade are disabled by default. However, you can change the default caching type by modifying the param-value in the runtime configuration to use either the DistributedMap interface or command bean caching. To change the default, edit the web.xml file in the /opt/IBM/WebSphere/AppServer/profiles/default/installedApps/wasserver1Node01Cell/trade.ear/tradeWeb.war/WEB-INF/ directory. For example (bold added for emphasis only):
 </init-param>
         <init-param id="InitParam_10">
            <description>Sets the data caching type. Legal values No Caching, 
                  Command Caching and DistributedMap </description>
            <param-name>cachingType</param-name>
            <param-value>No Caching</param-value>
         </init-param>