Saturday, May 20, 2006

Obligatory JavaOne 2006 Post

I attended the JavaOne 2006 conference and expo on Thursday last week. It was a full 5 days long, which was a break from the usual 3.5-4 days from earlier years. One of the advantages of being a local attendee is that you can go over to the conference whenever you have some free time, and the disadvantage is that you end up not having too much free time. Which was just as well, come to think about it, since the two sessions I attended had enough information content to make me feel as if I was drinking from a fire hose. I can only conclude that the people who go to as many sessions as they can for the full 5 days either have lots of time to research all the new Java offerings from Sun and their partners, or that they drop a lot of packets - I know I would do the latter in a similar situation.

The two sessions I ended up going to were J2EE Performance Profiling and Monitoring (TS-1549) and Troubleshooting in a Production Environment (TS-1669). I had actually signed on for a session on the AJAX DOJO Toolkit (TS-3577), but I changed my mind at the last moment and decided to go to the Profiling and Monitoring session. One thing I noted (from my own experience at JavaOne and descriptions of the recent Ajaxian conference from descriptions by colleagues who attended) was the huge interest in AJAX and all the different frameworks that have come up around it - there were easily 1000+ people lining up to attend any session even remotely AJAX related.

The proliferation of AJAX frameworks reminds me of a similar situation that happened with MVC frameworks a few years ago. My personal favorite (and incidentally the only one I have worked with, not counting Javascript code consisting of raw XmlHttpRequest calls) is DWR (Direct Web Remoting), although lots of people I know swear by the Prototype library. It would be interesting to see which AJAX frameworks finally emerge as the winners after the inevitable shakeout that will follow in the coming months - for now, I will attempt to only apply what I know about AJAX, rather than chase down the AJAX framework du jour.

The Profiling and Monitoring session turned out to be about JFluid, the new profiler plugin available in NetBeans and about Project Glassfish, an open source application server project sponsored by Sun. The profiler plugin is pretty slick, and it allows you to quickly identify hot spots in your J2EE application. To the best of my knowledge, however, its only available in NetBeans, although it is possible that the Eclipse folks may decide that they like it enough to write a plugin for it, similar to the Matisse Swing designer plugin.

Project Glassfish turned out to be something of a disappointment for me, however. All I was looking for was a standard (and extendable) JMX console application that could hook into any J2EE compliant application server. What I got was yet another application server, which seems to be based on the same microkernel architecture pioneered by JBoss and which is more recently used in Apache Geronimo. From my user-level perspective, the world needs another buggy (at first) application server like it needs a hole in its head, but I guess writing full blown application servers is more fun than writing useful little generic apps.

On the troubleshooting session, the speaker Alexandre Rafalovitch, the author of the View from the trenches blog was his usual raconturing self. I had attended his session two years earlier when he was with BEA Weblogic, and as usual there were lots of useful information to be had from his session. In the previous session he spoke of reading thread dumps, and pointed out the useful thread dump analyzer tool Samurai, which I still use. Just in passing, a colleague came up with a text based way to track dumps which I post here.

1
$ sort thread_dump.txt | uniq -c | sort -n

and then open the thread dump in an editor looking for the top patterns returned by the above command.

In this session, he covered logging tools that can listen on events raised by multiple application servers, such as Splunk and Apache Chainsaw, the unix utility lsof to check on files and sockets held on to by specified processes, and the network sniffer tool Ethereal.

I went back home and looked at Apache Chainsaw, it is a GUI which listens on a specific port (4445 by default) on your machine, and you can configure your log4j.properties in your application(s) to write to a SocketAppender at that port. I used this information in Bertrand's Weblog to set up Apache Chainsaw, and the information is valid for Apache Chainsaw v2 as well. Its quite slick, the different levels of log messages (DEBUG, INFO, WARN, ERROR) are color coded and easy to read. It would be especially useful if you were looking at logs in a clustered or multi-machine environment.

I also looked at Ethereal, and I had to also install the ethereal-gnome RPM on my Fedora Core 2 laptop in order to get the GUI, the ethereal RPM contains only tethereal, the text based version of the tool. It is a network sniffer and can sniff and report on an impressive number of protocols spanning the entire network stack.

I have been using the lsof utility before I heard of it in Java One, and the man page was enough to get me started, so I wont talk about it much here. Basically, it lists all open files (and sockets, since everything is a file in Unix) held open by a process, so I have found it useful in the past to see which process is holding on to a port, and kill it if needed.

On the expo front, I got to see many vendors whose products I actually use, which is heartening to see, because I have been using (at least partial) open source products which get sold under commercial licenses (thereby getting some degree of support but keeping licensing costs down). The vendors I actually got to talking with were Terracotta and MainSoft. I also kind of looked over someone's shoulder for a NetBeans demo at the Sun booth.

Terracotta offers an interesting clustering solution. Their product sits between the JVMs in a clustered application and the rest of the application. In an IoC environment such as Spring, wwitching between using the single user mode (for development) and the clustered mode (for production) is a matter of a single change, repointing the wiring from the local bean to the clustered bean. Unlike other clustering solutions, which rely on a distributed cache, Terracotta relies on bytecode instrumentation, enhancing application classes to add event generators which talk to listeners in the Terracotta layer. I haven't actually used the product yet, but I would definitely like to evaluate it.

MainSoft offers a product that will convert the DLLs created by your C#/.NET application into JAR files that can be served in a Java environment. This would be useful for people who want to serve their .NET apps from webservers other than Microsoft IIS, at the same time not having to retrain their .NET developers. My use case was slightly different, and the product will not address my needs, but it was interesting talking to them. Incidentally, it also seems to reflect the greater interest and emphasis on Java/.NET interoperability.

The NetBeans demo that I listened in on impressed me enough so I came back home and downloaded the NetBeans 5.5beta version. I am an Eclipse/MyEclipse user at home and an IntelliJ IDEA user at work. My initial reaction is that NetBeans 5.5 is quite feature rich, and on-par (and in some cases slightly better) compared to Eclipse in terms of features supported. The GUI looks much cleaner and more sophisticated, but is just a tad slower than Eclipse when it comes to doing autocompletes and such. There are certain operations in NetBeans which you just cannot seem to do without a mouse, which was a bummer for me. But overall, it looks quite clean and feature rich. For someone looking to start out with a free Java IDE, both NetBeans and Eclipse look equally promising. Of course, if you are already using Eclipse with MyEclipse, you may consider the tradeoff between the slight loss in functionality against the recurring annual subscription fee.

Yet another trend this year was the appearance of a shelf-ful of books dealing with Data Structures and Algorithms in the JavaOne bookstore this year. I think this is because Java is beginning to tackle harder and harder problems, and knowing about Data Structures and existing algorithms helps to not reinvent wheels to solve problems which have already been solved. Two books I liked were Data Structures and Algorithm Analysis in Java by Mark A Weiss and Data Structures and Algorithms in Java by Michael T Goodrich.

7 comments:

  1. Sujit,

    Glad to see you liked my session even if my name gave you spelling troubles :-)

    Good tip about sort/uniq/sort, though I usually use final sort with -rn to have most frequent lines at the top of the file rather than bottom. In general I use 'xxx|uniq -c|sort -rn' pattern quite often.

    ReplyDelete
  2. Gary,

    From my limited understanding of what the Terracotta product does, I think its a novel approach to solving clustering issues. I will definitely evaluate it and give you feedback. Thanks to you and your team for coming out with such a useful product.

    -sujit

    ReplyDelete
  3. Alexandre,

    My apologies for misspelling your name. When I wrote your name in my blog originally, I did it from memory (thus the Americanized spelling), and only later when I did a google search to find the link to your blog did Google suggest the right spelling, but I forgot to update the text.

    And yes, I found your sessions very interesting and informative, both the one this year and the one two years ago. Thanks for the information and look forward to more in coming years.

    -sujit

    ReplyDelete
  4. Sujit,

    Have you tried JConsole? See the following blog for setup details...
    http://blogs.sun.com/roller/page/bloggerkedar?entry=app_server_and_jconsole

    Also, check out JMX APIs at:
    https://glassfish.dev.java.net/javaee5/amx/index.html

    You may like the new programming model and ease of development support in Java EE 5 SDK. Check it out.
    http://java.sun.com/javaee/downloads/index.jsp

    For a brief overview of Java EE 5, take a look at the following screen cast:
    http://blogs.sun.com/roller/resources/pelegri/GFIAB_JavaEE5_1May2006.html

    If you find bugs, please let us know.
    https://glassfish.dev.java.net/servlets/ProjectIssues

    ReplyDelete
  5. Sujit,

    Did you try JConsole? See
    http://blogs.sun.com/roller/page/bloggerkedar?entry=app_server_and_jconsole

    Project GlassFish also has a JMX API. See
    https://glassfish.dev.java.net/javaee5/amx/index.html

    If you have not tried Java EE 5 SDK, take a look.
    http://java.sun.com/javaee/downloads/index.jsp

    This screen cast gives an overview of Java EE 5.
    http://java.sun.com/javaee/downloads/index.jsp

    ReplyDelete
  6. Hi Nazrul,

    Thanks for the links. I had heard of JConsole, but did not know much about it, looks like it could be useful for what I am looking for. Also the AMX API from Project Glassfish looks quite useful for bundling a JMX console webapp along with a application server instance.

    -sujit

    ReplyDelete
  7. You are welcome Sujit.

    Re: Project GlassFish quality...

    A large group is working in the quality team of Project GlassFish. For the recent FCS release, over 50 thousand tests have been executed. A total of 1793 bugs have been fixed. See more details in this blog:
    http://blogs.sun.com/roller/page/rajprem?entry=glassfish_quality_trivia

    Project GlassFish Quality Portal:
    http://wiki.java.net/bin/view/Projects/GlassFishQuality

    Also, take a look at the latest price/performance numbers from Project GlassFish.
    http://blogs.sun.com/roller/page/theaquarium?entry=glassfish_specjappserver2004_results_posted

    "This is the only SPECjAppServer result published so far on an open-source application server.."

    ReplyDelete

Comments are moderated to prevent spam.