Monday, January 28, 2008

Enterprise Logging for Distributed JEE Applications

Hello,


i have shared my experiences on working on a large scale JEE project wherein we are looking at efficient and reliable way to troubleshoot issues in a distributed JEE application by analyzing the app logs.

Here is the summary,

As more and more enterprise applications are architected using the paradigm of Service Oriented Architecture (SOA), new challenges surface at every stage of an application's evolution. One such challenge is the consistent requirement of application logging. While the very distributed nature of SOA systems complicate trouble-shooting, log files can come to your rescue when trying to understand a system's behavior. This article discusses our experience implementing logging in a Loan Origination System (LOS), built using SOA on the J2EE platform. Along the way, we hope to answer the following questions:

  1. How do you trace requests through Web-tier and business-tier logs in a distributed J2EE deployment model?
  2. In case of an application error, how does the end user report the problem to help desk and subsequently how does the development team correlate the reported error and troubleshoot the issue with the help of application logs.
For complete article click here

Tuesday, January 15, 2008

unix process and ports on solaris

Hello there , i was troubleshooting an issue with the Tibco Message listeners and to be honest i am a newbie at this. all these years i have working on weblogic JMS and Sonic JMS to some extent. things are so cool in JEE world with MDB and JMS servers having a rich console to monitor what is happening. but unfortunately not the case with legacy messaging code that we had, wherein the listeners were started using a shell script invoking tibco java API using "nohup" command (will get back to this shortly). There is a tibco daemon process which is analogous to JMS server and the "subject" is topic/queue in a JMS world. anyways my focus of today's blog is not to write on Tibco but rather on unix commands that aided me in my debugging. but as i get to know more about Tibco Rendezvous (messaging product) i will definitely pen it down.

coming back to "nohup", this command allows you to launch a process without associating the process with shell or a terminal. typically its used with & in this fashion

$ nohup ./startServer.sh &

hence even if you exit from your telnet session, the process will continue to run. in some sense it behaves as a daemon process.

Then i needed to find the process listerners, so ps -ef | grep "name" should work. but somehow it couldn't give the full path of the shell script that launched the process. luckily it was a solaris host and this command did the trick

$/usr/ucb/ps -auxww | grep "name"

in case you wanna find out which "ps" command is being invoked use this

$which ps

will give you the path of the executable.

one more thing which drew me crazy was, in our solaris v5.8, all Java threads were being displayed by the ps command. by looking at the ps output last column, "native_threads" word will indicate that its a thread and not a process.

next came the task of killing certain process that is listening to a port no

$lsof -i

the above command will give list of all processes that is using the port no.

one more useful command that you might want to look at his $netstat

in case you are interested to find out how you are processes are using CPU and memory use $top

and of course the easiest of them all is to kill a process $kill -9 :)

well, these are some of the new commands that i learnt today, list is endless though.

have fun,
Venkat

Monday, January 14, 2008

My debut blog - struts 2 performance

Hi Esteemed folks, the intent of creating this blog is to share my day 2 day experiences/observations on implementation/design of java projects. I work as a senior java developer for an investment bank in NY and i enjoy coding a lot.

Recently i was given the task of evaluating struts 2 framework for our new project and i was very excited to adopt this in our team. i had used version 2.0.1 in my earlier job and it did help to achieve a cleaner design/less code at the presentation layer, but i was worried about the performance aspect of it, especially the custom tags and ognl expressions. but i read on the forum that they had worked on the performance issues in 2.0.11 and so i thought of taking a stab at this using the new release 2.0.11

I downloaded the Apache JMeter to benchmark the results. JMeter is a very lightweight performance evaluation tool from Apache and the learning curve was a couple of hours, believe me or not. Now lets get our hands a bit dirty. The first step was to write a simple jsp page with a few struts 2 form tags, input elements and a iterator tag which loops 100 times over a ognl expression, expression traverses an object to a dept level of 2.

JMeter has a feature of running the agent remotely which simulates the users hitting the web url. i installed the agent on 2 unix boxes. deployed the web application on weblogic 9.2 with JVM heap size of 1 GB on an intel dual core 2.4 GHz box. the test scenario consisted of 200 users hitting the same action url which then forward the request to the test jsp. no database calls were invoked. in my first run, the results were shocking, average response time being 5000 ms.

That kinda prompted me to look at tuning aspect of the framework, changed the dev flag to false, enabled template caching, set the JSP reload check to -1 etc, more details at http://struts.apache.org/2.0.11/docs/performance-tuning.html and i ran the test scenario again and this time the results were dramatic, the average response time was less than 10 ms.

To conclude, you dont have to trade-off the performance of your web application by adopting struts 2. It definitely fits in with your performance requirements of a MVC framework, not to forget wealth of features it brings along. if you are curious about knowing more of struts 2, have a peek at my article http://www.javaworld.com/javaworld/jw-10-2007/jw-10-struts2inaction.html which has a sample code that you can use to kick the tyres.

Feel free to drop a line in case i wasnt clear about anything and i would be glad to clarify/elaborate the same,

its 7.30 PM now, got to rush home,

cheers,
Venkat