Chronon talk at the Oracle JVM Language Summit 2011
Read the full post at BasementCoders.com
Lets get this straight. Currently the only real way to debug long running, server side applications, is by looking at log files. Yet, logging in its current form is fundamentally broken.
What's wrong with logging currently?
The paradox of logging:
- You put a logging statement at a piece of code where you 'think' might be a bug.
- Because you already thought about the bug at that place, you already hardened the code there.
- In real life, errors happen where you least expected them to
- Thus, what really happens is, you never end up putting a log statement where the error actually ends up occurring.
Apart from the above paradox which occurs due to the fact that you are basically trying to predict errors in advance, logging has other evils:
- It clutters up your code and hides actual logic.
- Its a huge distraction from actual coding.
- Log levels - Not only do you need to think of the log statements, but also the 'level' of logging. Talk about predicting errors, this practically needs you to be Nostradamus.....
- Also it is just real fun to figure out a bug from a long running server which has a ginormous log file.
Whats good then?
That said, there is something good about logging after all.
If in the miraculous case, you do get your log statements positioned exactly right, looking at a log file can give you a quick overview of the execution of your program.
Chronon 2.0 and Post Execution Logging
With Chronon 2.0, we are reinventing logging, just like we reinvented the debugger only a few months ago.
The Post Execution Logging functionality in Chronon 2.0 allows you to add logging to a program after it has executed.
Yes, you read that right. You can actually add logging after your code's execution!
Not only that:
- You can access all your variables (just like in regular logging statements)
- You will the results of the log execution instantly without having to wait for the program to rexecute fully!
- In true Chronon fashion, clicking on a line of log output will take you directly to the point in time when that statement was output, so you can see the entire state of your program and use the step back functionality to find the root cause of your issue.
That also means you can finally get rid of all those logging statements in your program that are cluttering up your code and focus only on developing your software.
If all this still sounds crazy to you, see the video below to see Post Execution Logging in action.
Btw, if your Chronon 1.0 evaluation has expired and you still want to try out Chronon 2.0, just go ahead and download it and you will get another 30 days of free trial!
A nice infographic on how to scale the Chronon Recorder.
More details on our Performance Guide
We have now added full support for Dynamic Proxy object in todays release (Chronon 1.8.8).
Chronon will now instrument any Dynamic Proxy class that implements any interface that is 'included' in your Recorder Configuration.
Time Travelling Debugger Support
The Time Travelling Debugger knows about Proxy classes and will allow stepping inside any call made on a proxy object.
- Stepping In will take you directly to the 'Invocation Handler' call corresponding to the Dynamic Proxy class.
- Stepping Out works likewise and Stepping Out from an 'Invocation Handler' of a Proxy class will direcly take you to the call site of the original method called on that Proxy.
Chronon Recording Server Support
The Recording Server will now correctly identify the relevant Dynamic Proxy classes to instrument during a dynamic Start/Stop.
In order to get the Dynamic Proxy support in your Recording Server installation, you only need to update the 'recorder.jar' file for all applications, which can be found in the Standalone Recorder Pack on the downloads page.
Today we had a bit of a mishap with the 1.8.0 release.
Soon after we released 1.8.0, we discovered a fix for a longstanding bug in the Recorder which would throw exceptions while instrumentation.
Since we like to get features and bugfixes out as soon as possible to our users, we immediately updated the Recorder and Eclipse plugin to 1.8.5. We even starting sending out mails to some evaluators to update their Eclipse plugins or Recording Server installations to 1.8.5.
However, as we were doing so, somebody found a bug in the new 1.8.5 release! Apparently the fix we had put in introduced another bug which caused local variable assignments to be not recorded!
But all is good now :)
So here we are now, everything is finally fixed and we have updated the version to 1.8.7. This should solve both the exception issue and the issue with local variables not being recorded.
- Please update your eclipse plugins.
- If you are using the Chronon Recording Server version 1.7 or higher, you just need to download the Standalone Recorder pack and update your recorder.jar file to get the fix.
If you have a version of the Recording Server < 1.7, contact us to get the latest binaries.
Sorry for all the confusion and next time we wont be so hasty in putting out a bugfix which we haven't thoroughly tested :)
Another week, another release!
This time we have a bunch of productivity boosing features our users have been asking for:
Yes, they are finally here! There is now a keyboard shortcut for almost every operation in Chronon. Its amazing how fast debugging is with these!
Look at the documentation for the key mapping for all the keyboard shortcuts.
For all the Solaris fans, Chronon is now officially supported on Solaris x86 and 864 (32 bit and 64 bit) platforms!
Native agent binaries are available with the Chronon Eclipse plugin and the Standalone Recorder download pack.
Double click to jump
In views like Exceptions View, Threads View, Current Line view, you can just double click on the appropriate exception, thread, method to jump directly to it. No need to click the 'step to' button. More productivity boost!
Faster Stack View
The Stack view now uses caching and is much, much faster. Along with the keyboard shortcuts for stepping, you will find using Chronon blazingly fast!
We fixed some bugs with the Recorder. If you are using the Chronon Recording Server 1.7 or higher, you can download the Standalone Recorder pack and use the recorder jar from there to get the bugfixes in your Recording Server installation.
If your Chronon evaluation has expired, but you still want to try out these awesome features, contact and we will provide you with an extended evaluation!
So go ahead and Download now!
While you are at it, don't forget to check out the Chronon Recording Server!
I recently came across Mind maps.
I find them to be excellent for designing/architecting. Much better than a design document with bullet points and long descriptions.
If you think about it, take any problem, you usually end up first breaking down the high level concepts, then working your way down to the details of each in a hierarchical manner. Mind maps allow that naturally, and I have found them better than anything else to put thoughts on paper.
Below is a mind map showing the design of the 'Open External Recording' dialog in Chronon.
Notice how easy it is to see each case and go all the way down to the minute implementation details of each. It is much more consice that a long design document and conveys the information much more clearly.
How would it feel if every time you opened a program or a website it asked you how much memory it could use?
Or even worse it by itself decided some maximum memory value for you which is far lower than the amount of ram on your system. How would you then feel if that said program or website threw an error in your face complaining about memory, all this while you had more than enough ram on your system for it to use?
What Java does
Apparently that is exactly how Java programs behave or rather the JVM implementations compel java programs to behave.
- Either you specify an -Xmx value and try to guess memory usage before hand, or
- Depending on the vendor, version or implementation the JVM will choose its own maximum heap size (which is almost always lower than the total ram on your machine).
What it should Do
Now I am sure there are good technical reasons why this is the case. However I will cite the age old programming quote:
First make it correct, then make it fast.
In this case going Out Of Memory on a system which does have enough memory is plain incorrect. Any program on a system can due to unforeseen circumstances might temporarily require more memory than its user thought it would. It could be that disk IO became slow or there were suddenly a traffic spike for a few minutes, etc. Operating Systems found a way around this a long time ago using virtual memory and disk swapping. Sure swapping causes your program to go slow but it doesn't outright crash it.
I have 24gb of ram on my machine (since ram is super cheap nowdays). I should never see an OutOfMemoryException. Yet time and again I see it pop up in Java programs, even when they were using a mere fraction of my 24 gigs of ram.
Real World Experience
We have so many cases of people using Chronon on 64 bit machines and getting Out Of Memory Exceptions. We keep getting queries like "but my machine has 4 gigs of ram" and we always have to say "but did you allow the jvm to use it? whats your -Xmx value?".
Since the performance of Chronon is greatly impacted by memory, with our Time Traveling Debugger Eclipse plugin, during installation we bump up the -Xmx value of Eclipse. Although all this does is allow Eclipse to use the extra memory if needed, due to the common misconception out there, people think just by setting a higher -Xmx value Eclipse is magically using more memory than before.
All said and done, I think the need to specify a max heap or randomly choosing a heap size less than the system memory highly impacts the usability of Java programs in a 64 bit world, and leads to confusion with people who get Out Of Memory errors even though they have plenty of memory. The performance gains are not worth the errors and confusion.
Today we are updating the Chronon Recording Server to 1.7.
Apart from the obvious download related bug fix, this release contains 2 new features:
1. Active Heap Info
Now you can see the heap size of the application you are recording.
Note that for performance reasons, the heap size is updated only every 5 seconds.
2. Better Recorder Start/Stop Progress Info
Now when you start/stop the recorder on your application:
- The progress bar is more accurate
- You can see exactly which class is being instrumented
Since this release required changes to the communication protocol, if you are upgrading your existing Recording Server installation, you will need to update all 3 components : recorder, controller and recordingserver.war