Monday, July 6, 2009

A neat way to monitor windows services

The JDK supplies a very impressive toolchest which enables you to monitor the JVM(
jconsole, jps, jmap,jvisualvm etc...). There are also other tools such as BTrace which can attach to the JVM and solve performance problems.
On UNIX you only need to use su or sudo and act as the user running the JVM. Doing that you can attach to it and apply all commands.
In Microsoft Windows the situation is more complicated. The service processes run under a different user and in another session and you are not able to connect to them.

But do not panic:-) I am suggesting here a simple workaround.

Step 1:
Download and install the Resource Kit Tools from Microsoft. (The 2003 version will also run on Windows XP). Didn't try Vista/2008 but then again who uses Vista.

Step 2:
Run the following command:
%RESKIT_HOME%\Tools\Instsrv.exe" SrvCMD "%RESKIT_HOME%\Tools\Srvany.exe"
It will create a service named SrvCMD (in case you have such a service use a different name)

Step 3:
Open services.msc and update the service properties to run manually. Check "allow service interact with desktop" box.

Step4:
Execute regedit.
Open the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SrvCMD
Add a sub-key named Parameters
To this sub-key add a string value named Application. Its value will be the name of the executable you want to run. In our case c:\WINDOWS\system32\cmd.exe.

Step5:
Note: If you are connecting with remote desktop make sure you are connecting with /console parameter (otherwise you will not see the command window)
Start the service.
A window with command prompt running in the session of the service will be opened.
jps will now discover your JVM.


Enjoy!

Friday, July 3, 2009

BTrace session slides

BTrace session is over.
I worked very hard preparing it though I think I needed more time for working on the running examples and integrating them seamlessly with the presentation.
It was a fascinating experience for me.It is the first time for me that I am arranging a public session and I am sure that more will come.
37 Attendees(out of max 50 available seats) two and a half hours of covering BTrace.
The responses were very positive. People were very enthusiastic about the tool.
I have published the slides of two presentations from the event in my web site:
The participants of the event are entitled to participate in a lottery upon submitting a final exercise!

Saturday, June 20, 2009

10 Days left

It is 10 days away. My BTrace session. I am so excited about it.
This the first event I am organizing and I hope that ppl will be tolerant toward any organization problems that may occur....
I have just discovered to that my BTrace post was cited in the BTrace project homepage :-)
And today while working on my presentation I discovered that BTrace do not on my Mac (till now used it only on Windows machines)
Browsing the web a bit I found a post by Ken Sipe who already solved the problem.
Downloaded his patched version and bang it worked !!!!!
Lucky me :-)

Wednesday, June 3, 2009

ScalableJ First Knowledge Share Event

I have been thinking about building up an event by myself for a long time and this idea has finally came to life. I am going to give a lecture on BTrace on the 1st of July in Petah Tikva,Israel
Registration is free of charge.
More information can be found at http://www.performize-it.com/training/kse/kse1
You are welcome to participate......

Sunday, May 31, 2009

JDK 1.6.0_14

Well it appears that this revision is not a one to ignore if you care about performance (and you have the guts of an early adapter:-) The "small" revision update is not small at all and contains 3 important performance improvements:
1. The long anticipated G1 garbage collector
2. Escape analysis
3. Compressed OOPs

I will elaborate on these features in my next posts.... for now you may look at http://java.sun.com/javase/6/webnotes/6u14.html

What does this say about JDK1.7 ? Down porting features before 1.7 is released...... makes you wonder is 1.7 going to be Sun's Vista?

Wednesday, May 27, 2009

BTrace the ultimate JVM probe

Hi,
I have been working with BTrace in the last few months and the more I use it the more I appreciate it. BTrace enables you to write a small java class that will instrument you java application on the fly and will give you ultimate flexibiliy to pin-point the requested information.
It can help in debugging/ profiling/ deadlock analysis and solving other stability problems
I am going to give a session 2.5 hours session on the 1/7 in Israel(Petah Tikva). Details will follow..... If you want to attend send me an email to haim.yadid@scalablej.com
Here is a tricky example which will help you identify where in the code a you write a certaion message to stdout..... enjoy!

package com.scalablej.btrace;

import com.sun.btrace.annotations.*;
import static com.sun.btrace.BTraceUtils.*;

@BTrace public class PrintlnLocator {
@OnMethod(
clazz = "java.io.PrintStream",
method = "println",
location = @Location(value = Kind.ENTRY))
public static void onPrint(Object a, String l) {
boolean b = compare(
get(field(classForName("java.lang.System"), "out")), a);
if (b) {
println(l);
jstack();
}
}

}

Tuesday, April 21, 2009

Utilizing the Cloud for Performance Validation

Yesterday I gave a lecture to the Israeli Association of Grid Technologies (IGT) as part of the cloud computing work group. I was discussing the benefits of executing performance lab for the purpose of load testing inside the cloud (opposed to purchasing required hardware).
You can find the presentation in my website http://www.scalablej.com/cloud-computing