Long stacktraces in Apache Camel no more

In the upcoming Apache Camel 2.12 we have improved the internal routing engine to dramatically reduce the stacktraces, our end users will see when an exception occurred and was logged.

During the development of the improvement we had a small sample route for benchmarking.
It was basically a simple route with:

  .process(new Processor ...);

And in the processor we forced an exception being logged. In Apache Camel 2.11.x the stacktrace would be around 40 lines. The Camel team managed to reduce this down to 15 lines. And the bottom 6 lines is 3 from the JVM and 3 from the seda consumer. So in between the routing engine is executing; and that's where we have optimized the code. So we went from (40-6 = 34) to (15-6 = 9). Eg before we had 34 lines during the routing, and that is down to 9 now.

Camel is still executing the same functionality. As an end user there is no functionality turned off or missing now. Its all still there and being executed; just in a different way. What we did was refactor most of the internal cross cutting functionality into a single entity CamelInternalProcessor (name subject for change), and fold that into a single stack-frame being executed.

This improvement is internal changes only, and all end users Camel application is upgrade compatible.

For our end users who have been debugging the Camel source code, this is now also simpler, as we added code comments in the CamelInternalProcessor with pointers how to do this easier, and which part you can safely skip over, to make your debugging experience easier and faster.
And speaking of debugger. Then we also added a new BacklogDebugger, which is a Camel routing debugger JMX MBean which is ready to use for tooling and end users. For example you can use it easily set breakpoints, single step a message in the routes, and edit/view its message content. Now for the graphical UI, then James Strachan is hacking on hawtio to add this in the upcoming hawtio 1.2 release. And since its JMX based you can always use it from a JMX console such as JConsole or JVisualVM. And for the brave a plugin to Eclipse / IDEA could be developed to integrate it with their native debugger; but thats a big task to take on.
For further details and background on the stacktrace improvement then you can take a look at the ticket CAMEL-6077 and our discussion on the Camel developer mailing list. As well we have a sample of the before and after stacktraces in the CAMEL-6077 ticket.

No comments:

Post a Comment