Showing posts with label UltraESB. Show all posts
Showing posts with label UltraESB. Show all posts

Sunday, November 29, 2015

UltraESB - Cloning Script

In some cases you may need to build a UltraESB cluster running in a single machine. In that case you should make sure ports that each UltraESB instance acquire does not conflict with others. This script makes sure that a UltraESB installed in a default location (/opt/ultraesb) is cloned into a given number of instances in /opt/uesb1,2,3.. path. To run this, you have to give number of clones you need to have as a parameter.


#!/bin/bash



for step in {1..$1}

do

    mkdir /opt/uesb$step

   

    #Create a clone of UlatraESB

    cp -r /opt/ultraesb/* /opt/uesb$step/

   

    #Change ULTRA_HOME

    sed -i "s/\/opt\/ultraesb/\/opt\/uesb$step/g" /opt/uesb$step/bin/ultraesb-daemon.sh

   

    #Change ram disk path

    sed -i "s/\/tmp\/ram/\/tmp\/ram$step/g" /opt/uesb$step/conf/ultra-root.xml

   

    #Change ram disk overflow path

    sed -i "s/\/tmp\/overflow/\/tmp\/overflow$step/g" /opt/uesb$step/conf/ultra-root.xml

   

    #Change HTTP port

    sed -i "s/property name=\"port\" value=\"8280\"/property name=\"port\" value=\"$((step+8280))\"/g" /opt/uesb$step/conf/ultra-root.xml

   

    #Change HTTPS port

    sed -i "s/property name=\"port\" value=\"8443\"/property name=\"port\" value=\"$((step+8443))\"/g" /opt/uesb$step/conf/ultra-root.xml

   

    #Change host name

    sed -i "s/name=\"nodeName\" value=\"192.168.56.5\"/name=\"nodeName\" value=\"node$step\"/g" /opt/uesb$step/conf/ultra-root.xml

   

    #Change JMX Ports

    sed -i "s/9994/${step}9994/g" /opt/uesb$step/conf/ultra-root.xml

    sed -i "s/1099/1${step}99/g" /opt/uesb$step/conf/ultra-root.xml

   

    #Changing wrapper name

    sed -i "s/wrapper.ntservice.name=UltraESB/wrapper.ntservice.name=uesb$step/g" /opt/uesb$step/conf/wrapper.conf

   

    #Add init scripts

    cd /etc/init.d

    sudo ln -s /opt/uesb$step/bin/ultraesb-daemon.sh uesb$step

   

    sudo chown -R ultraesb:ultraesb /opt/uesb$step/

   

    #sudo service uesb$step start



done

Monday, September 7, 2015

Profiling UltraESB with YourKit Java Profiler

YourKit Java Profiler is a rich Java profiling tool that can be used to easily identify CPU usage, memory usage, thread utilisation, garbage collections and possible dead locks of your  Java applications. In this post I'll briefly go through how to profile an UltraESB instance hosted on a EC2 instance using YourKit Java Profiler.

Before move into further details, you have to download YourKit Java profiler from their site. If you don't have a distribution of UltraESB, you can download a binary distribution of UltraESB from here.

EC2 Setup


Because this is a remote profiling between a EC2 hosted UltraESB instance and your local YourKit application, at the setup of ESC2 instance, ports 10001 - 10010 should be opened for external access.

Figure 1
Both UltraESB distribution and YourKit has to be on EC2 instance. To configure UltraESB with YourKit, JVM_OPTS line of ultraesb.sh in <UltraESB Home>/bin directory should be changed as figure 2.

Figure 2


Path of the libyjpagnet.so file should be changed according to the platform. Once those configurations are done, now you can start UltraESB from

<UltraESB Home>/bin/ultaesb.sh

If configuration is correct, you can see a line like following at the top of ultraesb log.

[YourKit Java Profiler 2015 build 15070] Log file: /home/ubuntu/.yjp/log/java-
1445.log


You can put a load on UltraESB using jb-run tool that is shipped with UltraESB distribution.

cd <UltraESB Home>/bin
./uterm.sh
jbrun -c 100 -d 1 -k -m POST -n 1000 -p /home/ubuntu/payload.txt -s 100 -t 150000 http://localhost:8280/service/echo-back 


YourKit (local machine) setup


Start YourKit by running <YourKit Home>/bin/yjp.sh
Click "Connect to remote application". Fill EC2 machine username and domain. (Figure 3)

Figure 3
Add security credentials that you used to log into EC2 instance over ssh (Figure 4)

Figure 4


Then you can see the dashboard of YourKit that describes memory usage statistics, thread utilisation and etc,




To do a CPU profiling, click start CPU profiling button