Get the JVM heap utilisation for a running WebSphere server

Filed under: WebSphere — lars @ 05:39:32

I recently had to find out the amount of heap memory (the place a JVM stores it's object instances) being used by a running WebSphere v7.0 instance we suspected of being close to out of memory.

To do this, I could use the below jython script called 'showHeapSize.py':

serverJVM=AdminControl.completeObjectName('type=JVM,process=' + sys.argv[0] + ',*')
serverJVMObj=AdminControl.makeObjectName(serverJVM)
perf=AdminControl.completeObjectName('type=Perf,process=' + sys.argv[0] + ',*')
perfObj=AdminControl.makeObjectName(perf)
jvmObj=AdminControl.invoke_jmx(perfObj,'getStatsObject',[serverJVMObj,java.lang.Boolean('false')],['javax.management.ObjectName','java.lang.Boolean'])

currentHeapsize=jvmObj.getStatistic('HeapSize').getCurrent()
usedMemory=jvmObj.getStatistic('UsedMemory').getCount()
usage=float(usedMemory)/float(currentHeapsize)*100

print sys.argv[0] + ".> "+str(currentHeapsize)+"K .> "+str(usedMemory)+"K .> "+"Usage:%.2f" % usage+"%"

Which can then be executed as follows:

/opt/WebSphere/7.0/AppServer/profiles/AppSrv01/bin/wsadmin.sh -lang jython -f showHeapSize.py server1

where "AppSrv01" is your profile name and "server1" is the server name - producing the following output:

server1 .> 893760K .> 483776K .> Usage:54.13%

Remember that WebSphere allows you to set an Initial as well as a Maximum heap size - if they're not the same then the heap size could be anywhere between these two values.  The output above will show you the percentage use of the *current* heapsize, which may not be the maximum.  Some recommend setting these to the same value to remove the performance overhead of the JVM needed to allocate more memory as it grows the heap.




Installing Rational Application Developer 7.5 on Ubuntu 10.04

Filed under: WebSphere — lars @ 04:00:05

I just went through the process of installing RAD 7.5 on Ubuntu 10.04, and there didn't seem to be an easy-to-follow guide for this, so I thought I'd post one.

  1. Boot Ubuntu and log in.
  2. Open a command prompt and type the following to change your default shell from dash to bash:
    $ sudo dpkg-reconfigure dash
  3. Download and install the following debian package: http://packages.ubuntu.com/jaunty/libs/libstdc++5 - as RAD requires this and Ubuntu 10.04 ships only with a newer version.
  4. Insert RAD Setup Disk and run the following commands (launchpad.sh complains if you're not root):
    $ cd /media/rad_bundle_disk1
    $ sudo ./launchpad.sh
  5. Select "Install IBM Rational Application Developer for WebSphere Software".  Follow the prompts to install IBM Installation Manager and wait for it to restart.
  6. Select "Install IBM Rational Application Developer for WebSphere Software" (again!).
  7. Close the launchpad/Firefox window.  Either close your Terminal window (from Step 4) or cd out of /media/rad_bundle_disk1.  This allows the currently mounted CD to be unmounted by Ubuntu later when you need to change discs.
  8. Go back to IBM Installation Manager and select Install.  Update IBM Installation Manager if prompted.
  9. Select RAD7.5 and WebSphere 7.0 test environment, agree to the license, Click through and accept the default installation components.  (Personally, I disable administrative security on the profile).
  10. The installer will trundle away for an hour or so.  Click Finish when done.
  11. You're getting there...  Create the following script (/opt/IBM/SDP/launchEclipse.sh) for launching RAD as a lot of people have had troubles with this GDK_NATIVE_WINDOWS setting:
    #!/bin/sh
    export GDK_NATIVE_WINDOWS=true
    /opt/IBM/SDP/eclipse
    Set this script to executable:
    $ sudo chmod 755 /opt/IBM/SDP/launchEclipse.sh
  12. RAD/eclipse has been installed as root, and (for me anyway) it didn't put the IBM InstallationManager or RAD in the Ubuntu Applications menu.  So I created my own Application Launchers:

    Name: RAD7.5
    Command: /opt/IBM/SDP/launchEclipse.sh
    Icon: /opt/IBM/SDP/rad/RAD_v7_16.xpm

    Name: IBM Installation Manager
    Command: gksudo /opt/IBM/InstallationManager/eclipse/launcher
    Icon: /opt/IBM/InstallationManager/eclipse/documentation/IIM_32.xpm
  13. Before launching I also needed to add the following line to /opt/IBM/SDP/eclipse.ini, to fix an issue where eclipse will crash on the Welcome screen for a new workspace:
    -Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner
  14. If you want to run RAD *not* as root, you'll need to add write permissions to the following directory so RAD can interact with your WAS test environment profile (which is only writable by root as this is the user we used to install RAD):
    $ sudo chmod -R 777 /opt/IBM/SDP/runtimes/base_v7/profiles
That's it!  You should now be able to run RAD from your Application Launcher.



Installing WebSphere v7.0 under Ubuntu 8.04

Filed under: WebSphere — lars @ 20:20:19

Below are the steps I have used to install WebSphere Application Server (WAS) for Developers v7.0 on Ubunu 8.04 LTS Server.  This standalone version of WebSphere is a free download for development purposes.  I chose Ubuntu 8.04 LTS because it's the long-term-support version so it's repositories should be maintained for longer than Ubuntu 9.04's.  I chose the server version of Ubuntu as I didn't want to waste resources running a GUI/Desktop.

Here are the steps, assuming you've already downloaded the WebSphere installer archive from the link above, and it is sitting on your install of Ubuntu 8.04 Server.

  1. Override Ubuntu's default shell of 'dash' back to 'bash' - which the WAS v7.0 installation scripts need:
    $ sudo dpkg-reconfigure dash
    To check that this was done successfully, make sure /bin/sh is a symbolic link to 'bash' and not 'dash':

    $ ls -al /bin/sh
    lrwxrwxrwx 1 root root 4 2009-03-06 18:48 /bin/sh -> bash
  2. Create a responsefile.  This is configuration file that tells the WebSphere installer what options you want for the install.  Having this means you can run your install without using a graphical wizard (in fact, you don't even need to have X-Windows installed).  Here's the one I used:
    -OPT silentInstallLicenseAcceptance="true"
    -OPT allowNonRootSilentInstall="true"
    -OPT disableOSPrereqChecking="true"
    -OPT disableNonBlockingPrereqChecking="true"
    -OPT checkFilePermissions="true"
    -OPT installType="installNew"
    -OPT profileType="standAlone"
    -OPT feature="noFeature"
    -OPT PROF_enableAdminSecurity="false"
    -OPT installLocation="/app/websphere/was7"
    -OPT traceFormat=ALL
    -OPT traceLevel=INFO
    -OPT PROF_profilePath="/app/websphere/was7/profiles/AppSrv01"
    -OPT PROF_profileName="AppSrv01"
    -OPT PROF_isDefault="true"
    -OPT PROF_hostName="websphere"
    -OPT PROF_nodeName="node1"
    -OPT PROF_cellName="cell1"
    -OPT PROF_serverName="server1"
    -OPT PROF_isDeveloperServer="true"
    -OPT PROF_omitAction="samplesInstallAndConfig"
    -OPT PROF_defaultPorts="true"
    -OPT PROF_enableService="false"
  3. Create the directory /app/websphere.  Set the ownership of this directory to the linux user that websphere will be running as:
    $ mkdir /app
    $ mkdir /app/websphere
    $ chown wasuser /app/websphere
  4. Update/Install some required Ubuntu packages:
    $ sudo aptitude update
    $ sudo aptitude install apache2 bc xauth alien
  5. Finally, unpack and run the WebSphere install.  The below assumes you've put your responsefile from Step 3 in the folder /home/wasuser:
    $ tar -xvvzf was.cd.7000.wasdev.nocharge.linux.ia32.tar.gz
    $ WAS/install -options /home/wasuser/responsefile -silent
  6. If you wish, you can watch the logs to make sure everything runs smoothly:
    $ cd waslogs
    $ tail -F log.txt
    Note - log output may also appear in /app/websphere/was7/logs if there are problems early in the installation.

  7. That's it!  The whole process should only take a few minutes.



powered by  b2evolution | blog tool | framework | hosting