Monday 25 February 2013

OptimisticUpdateFailureException

Recently in one of the projects we were getting OptimisticUpdateFailureException during OrderProcess. After debugging this for 2-3 days what we found was, we had extended the OrderProcess command, and in the CustomOrderProcess command we have been calling OrderPrepare and immediately performExcute of OrderProcess cmd because of which we were getting this, we then invoked OrderProcess from the 'confirm order', once we get the response we then invoked the customorderprocess, looks like the issue was invoking these from local transaction context.

Tuesday 10 April 2012



Getting Started
WAS performance toolkit from IBM gives the ability to monitor multiple websphere application servers from an eclipse workspace. 
Advantages of this tool:
1.       No agents needed on the server.
2.       Monitors multiple application servers.
3.       Free tool
This tool can be downloaded from the following link:
Installation
Extract PerformanceTuningToolkit2.0.zip to your local drive.
Click on PerfTuningToolkit.exe to open the tool.
Steps to use
1) Add a new host.
·          Right click on the hosts tab and enter the host details, enter the SOAP port of the cell.

2) Connect to your cell.
·          Double click the host in the navigation view (left) or use the context menu to connect to the host 
·          After connected to the cell, all the topology of the cell will be shown in the topology view 

3) Monitor the performance, include:
·          WebApplication
·          Transactions
·          Ejb
·          Database connections
·          ThreadPool
·          JVM runtime
·          HTTP Session
·          Alerts
·          Actions

4)Predefined alerts and actions.
·          If the heapsize reaches the maximum heap size, it will generate a runtime alert.
·          If the thread pool reaches the threshold, it will generate a threadpool alert.
·          If the CPU usage reaches 90%, it will generate a runtime alert.
·          If some servlet error occur, it will generate a servlet alert.
·          If some connection timeout occurs, it will generate a connection alert
·          If there are some thread waiting for connection, it will generate a connection alert
·          If there are more then 1000 prepared statement discarded, it will generate a connection alert
·          If application try to use some invalidated session, it will generate a session alert
·          If there is no room for new session, it will generate a session alert
·          If some hung thread decleared, it will generate a threadpool alert
·          If some transactions rolled back, it will generate a transaction alert
·          If some transactions timeout, it will generate a transaction alert
·          You can define your own rules. 
Other operations:
Apart from monitoring capabilities the following operations can also be performed:
1.       Generate thread dump
2.       Generate heap dump
3.       Enable trace
4.       Show connection pool contents
5.       Generate performance report
6.       Run tuning scripts within workbench.
 
Getting started
Visual VM is a lightweight profiling tool shipped with oracle / sun jdk distributions starting from JDK 6 update 7. Visual VM can be used to profile, take thread dumps, browse heap dumps, monitor and control java applications across network. We can also create reports with all the necessary information.
Installation
This can also be downloaded from the following link http://visualvm.java.net/.
Unzip the downloaded archive and to open run the file name visualvm.exe under the installationfolder\bin.
Configuration
1.       From file menu click on add remote host.
2.       Enter server details
3.       Go to /usr/WebSphere/AppServer70/java/jre/lib/management and add the following:
com.sun.management.jmxremote.port=3333
com.sun.management.jmxremote.authenticate=false
com.sun.management.jmxremote.ssl=false
4.       Login to admin console go to Application servers > server1 > Process definition > Java Virtual Machine. Add the following in Generic JVM arguments:
-Djavax.management.builder.initial= -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=3333
5.       Go to visual vm right click on the remote host and Add JMX Connection

Monday 2 April 2012

perf tools

Heap Analyser - To analyse HeapDumps

Thread Analyser - To analyse thread dumps

GC Analyser - To analyse GC patterns - (native_stderr.log)

Recently we had an issue wherein one of the server threw OutOfMemory exceptions, steps we did to find out the cause:

1. Get the Heapdumps, native_stderr, thread dumps from the server.

2. Open the heapdumps with heapdump analyser, the tool shows you the leaks, browse through the childs until you hit the leaf node, if you just look through the classes you should get a fair amount of idea as to which area of classes are failing.

3.Open types in heap analyser, see the size of objects, that should give you some pointers.

4. Once you are done with heaps, open GC analyser and check for AF (allocation failures) if there are too many and you see it spiking try to find out the time that has happened.

5. With the time on hand, go to your systemout logs and find out what exactly happened in the server. These steps should take you closer to the cause.

Thursday 22 March 2012

some performance tuning tips..

IBM JVM setting running on vcpus,

Consider there are 4 vcpus:
heap size: each vcpu should be allocated 1024mb
gc threads: (no of cpu -1) - 1 cpu should be left for OS

Apart from this standard config, tune the threads in webserver, webcontainer and db according to your application needs:

You can use top down approach-

web-500 web container-100 db -50

bow tie approach

web -500 web container-50 db-100

Wednesday 21 March 2012

stage configuration

following tables hold details as to which tables can be propagated.

STGSITETAB  STGMRSTTAB STGMERTAB

Wednesday 9 November 2011

Commerce business models

A business model provides a commerce solution which includes an organization structure, default user roles and access control policies, one or more starter stores, administration tools, and business processes that demonstrate best practices. A business model can be customized to support business requirements and scenarios.

Following business models are supported by commerce:

1. Consumer Direct
2. B2B
3. Value chain
4. Supply chain
5. Demand chain

Tuesday 11 October 2011

command pattern

Command pattern is a behavioural design pattern. The way I understand command design pattern is the requestor of an action is decoupled from the executor of the requested action through a broker who acts as an intermediate in invoking the requestors action in the executor. The object that is sent to the executor has the relevant properties/attributes and details of the actions that need to be carried out.



http://upload.wikimedia.org/wikipedia/commons/8/8e/Command_Design_Pattern_Class_Diagram.png