Three years with Java Simon (4)

Today I’d like to cover the rest of my Java Simon story. In the previous posts we talked hardly about the start, but the rest was actually quite quick. With Callbacks, JMX support, JDBC proxy driver and much better design we were ready to release our 2.0 version.

June 23, 2009, Java Simon 2.0, monitoring API, released

There was one major problem with this version – we needed 2 different JDKs to build it. JDBC 3 would not compile against JDK 1.6 because Java 6 required higher version of it – which we didn’t want, so we could use it on application servers without support of newer JDBC. JMX 1.2 shipped with Java 5 – on the other hand – didn’t support features we needed, mostly around MX Beans, returning more types of objects and so on. So JMX was compiled with Java 6. You can imagine the problems we had when we started using Maven as a build (though Maven still is not exclusive build tool for us).

Well… Maven. While I like the idea of it – especially dependency management is truly great – as a build tool it is incredibly in the way unless you read tons of the stuff. Originally I hosted Java Simon on repository, but then Oracle somehow made it more complicated (and malfunction altogether for a while if I recall correctly) and I decided to switch to Maven Central. That was right decision of course, but the pain behind it was just crazy. Unless you have the process mastered it takes a lot of pain to deploy your first software there. However – our clients wanted Maven repo – and I did my best to provide. I learned a lot in the process, but no one will convince me that Maven can’t be MUCH simpler. And deployment on Maven Central is just horribly bureaucratic compared to FTP upload. Guys at Sonatype do their best in support though, they probably have to answer tons of stupid questions (at least for them). After all I complained more about it previously, so let’s just skip the rest with saying that 2.5.0 version was the first on Maven Central – and someone else had to deploy it for me. 3.0.0 was delayed a lot – Maven being 95% of the reason. Now I can release (at least from that computer where release plugin doesn’t throw infamous out of bounds exception without providing reason…) and it is a tremendous relief.

Talking about 3.0.0 – release announcement was here:

Java Simon alive and kicking with 3.0.0 available

As you can read in it the biggest theme was aligning of the Java dependency – now we can build it with JDK 6 only. Aside from that it was rather just a wrap-up of all the changes in 2.x line with some bug fixes reported for 2.5. Talking about bugs and issues – this was maybe the reason why I kept working on Java Simon and eventually made all the changes that slowly but surely shape the library. And this would not be possible without users – and especially active users. Reports were coming more in bursts, often from one reporter for some time. One thing I can say with my head straight up – I was always very prompt to answer and fix where appropriate (mostly they were indeed bugs).

To talk to our users we created Java Simon Google Group shortly after version 1, but this was mostly an announcement tool. Here and there someone new asked the question though – and again, I answered as soon as possible. Luckily, Java Simon is low-profile library, so the traffic was rather negligible. To sum it up – users who had problems were my motor in the end. The main problem probably was that later we had no project to use with Java Simon. There seems to be some chance now at my current job, so I expect more enhancements.

Here and there I still change some method names (some changed in 3.1, next changes will appear in 3.2) – not that I like doing that but I rather name it properly later than never (oh, how I hate broken promises of original Java’s @deprecated!), but otherwise the core seems to be pretty stable for now. But there is still some room for improvements – especially new features:

  1. delivering more useful tools like JDBC proxy driver – that one I particularly like for its simplicity, just add “simon:” in the JDBC URL and have it on the classpath – right now monitoring part comes to my mind, charts, logging, dumps to some history DB, etc.;
  2. providing some neat Callbacks (many things from the point 1 are actually implemented thanks to these);
  3. web console where you can easily read your Simons.

Actually – there should be web console available in our next release (3.2.0) – we acquired new committer from among our users. That’s the true open source community story. 🙂 You can’t even imagine how happy I was about it.

Of course – my life is not only about Java Simon. I have a family, regular job where they’d hardly pay me for Java Simon alone, I like doing music (soon more about it too) and then I just don’t care about Simon for a few weeks, sometimes even months. Though right now I’m just taking a short break before we wrap up that 3.2.0 version – and you’ll hear about it.


Three years with Java Simon (1)

If you wonder what that Java Simon is just check the project site (previously on Google Code). It all started when we got back from TheServerSide Java Symposium in Prague in 2008. One of the many talks given there was about JAMon (don’t mix it with jamon – the text template engine) – simple monitoring API that allowed you to code your monitors into your application and obtain the results later.

JAMon guys used Jarep to store and graph results and what I liked the most was the story how these results available over a long time helped them when they needed it. Story went something like: “We found out that the performance of our web-shop started to be unacceptable sooner then originally calculated. Graph showed us that there was sudden jump half a year ago and since then the application performed worse. Luckily we had also work plan from IT stuff that revealed that the same day new JDBC driver was installed – and that was the reason.” Bottom line – without data you just don’t know. I liked that and it went pretty much along the lines Kirk Pepperdine says all the time – you need proof, you need data, you just need to know – don’t guess. Actually most wise people say that, but I remember Kirk and also that JAMon/JARep story when it comes to performance and monitoring.

A colleague of mine tried to use JAMon for our work project but he was not happy about the API. He was missing some management hierarchy – and that’s how idea of a tree hierarchy (not much different from java.util.logging for instance) for Simons started. Another issue was timer based on ms (JAMon is compatible with J2SE 1.4), I didn’t like that at all. So many things may happen in a single ms – not to mention most Windows changed the timer ever 10 or 16 ms. We decided to write our stopwatch facility and over one August weekend I wrote some basics (our first commits) and we started building on it. We can’t measure anything – like JAMon tries – we focused solely on Stopwatch and Counter. Three years later I’m happy about it – Stopwatch being probably 90% (or more) of all used Simons. Originally I wanted to give our users some way to add another kinds of Simons, but soon I realized how messy it would all become.

JAMon was in version 2.7 when we started the Simon project and the page looked exactly how it looks right now. We finished the first version in December, we were happy about most of it, we cared for the code and for the Javadoc too – and I think it was really obvious from the look at the project. These are ideas we still care for and quality Javadoc is undisputed part of the project.

TSS press release: Java Simon 1.0, monitoring API, released

Simon gained some initial attention and one particular developer even blogged a few times about us – check Evaluating Simon – Java monitoring or other Erik’s posts related to monitoring. Funny – later I’ve heard the name Erik van Oosten mentioned by my colleagues working with Wicket, but I’m 2 years ahead of the story. That’s just how it is with active people. His posts were most appreciated and he also provided AOP based Spring integration. Now – years later – even I use it in our current project (though it went through a few fixes, but the code is essentially still Erik’s).

Soon we discovered that the first version had a few serious issues and redesign was necessary. But more about that in the next installment some other time.

Java Simon 1.0, monitoring API, released

It is some time ago when we wanted to use JaMON API to add some monitoring capabilities to our applications. After a few we found it to lack some featrues – especially it was difficult to organize monitors. Hence we decided to create our own alternative that brings two features JaMON can’t provide – monitors organized in a tree hierarchy (similar to JDK14 logging API) and nanosecond precision (which bind us to JDK 1.5 or higher – which we see as no problem for most newly developed applications).

That’s how Java Simon API was born – the project is hosted on Google Code:

Short description from our page:

Java Simon is a simple monitoring API that allows you to follow and better understand your application. Monitors (familiarly called Simons) are placed directly into your code and you can choose whether you want to count something or measure time/duration. Access to Simons is provided via static SimonManager.

We hope all necessary documentation is there and it will be extended in the future for sure. Aside from core functionality featuring standard stopwatch/counter monitor types we provide Simon JDBC proxy driver featuring these monitors – so you can check how various JDBC calls perform, pin down slowest selects, etc. Driver is JDBC 3 compliant with data source implementations available and it was tested with Glassfish/XA datasource with Oracle as the underlying database.

What can typical Stopwatch do?

  •  it can measure time splits, parallel measurement is supported;
  • it provides total time, number of time splits, tracks max/min time, time stamp when extremes were measured, deviation, …;
  • and like every Simon it tracks first/last usage time stamp and features like enable/disable/reset are also available.

Why we brought in a new API when there is JaMON available? Well, we tried it with JaMON but than we wanted to crucial things that JaMON doesn’t provide:

  • as said – we wanted to measure time in nanoseconds (hence JDK 1.5 or higher is required);
  • we wanted all monitors to be organized somehow – so we implemented tree hierarchy similar to java.util.logging API – this provides powerful features like enable/disable/reset of the whole subtrees of this monitor hierarchy.

Version 1.0 contains core functionality and we realize it lacks many important features in the bigger picture of application monitoring. Our plans in the future covers:

  • Declarative Simon configuration.
  • JMX access to Simons, their values and enable/disable features.
  • Sampling, collecting, agregating with persistence backend (file/DB).
  • …and probably more, but not all in the next major release. 😉