YACA-Monitor 4.0 - In Situ Diagnostics of Java 8 Programs with 3D Visualization of Call Stack Dependencies
BY MARKUS SPRUNCK
What is new in this version?
The new version of YACA-Monitor brings simplified handling, better performance and many further improvements. Main changes are:
- Yaca-Agent is now a webserver for the Yaca-Monitor complete application
- Direct interaction with Yaca-Agent, like reset mode, black/white lists,
- Improved performance,
- Support for OS X,
- Black and white lists and
- Java 8 support
Be the change that you wish to see in the world - Mahatma Gandhi
Working with Java is characterized by spending endless hours with finding out how your own code and 3rd-party libraries interact. Some parts of the desperately needed information can be obtained by reading the code, some views of your development environment and/or documentation. The genuine problem, is to find out how all the classes are actually interacting during runtime.
Static dependencies and dynamic call dependencies between classes and/or methods, are two sides of the same coin. In the first one modern development environment help developers to analyze the static call dependencies and also inheritance relations. The second one is rarely supported by tools.
However, the modern Java code uses often late binding based on the inversion of control pattern. This is especially true for all spring framework bases applications and modern Java EE based enterprise applications. Here many dependencies are dynamically created at startup and/or determined during runtime. To make all this worse, these approaches excessively use proxies, which make the call hierarchies even longer and more intransparent. No wonder that we as developers spend so much time with the dynamic analysis of source code, frameworks and medium level design.
The only way to get a deeper understanding of the dynamic call dependencies is the old fashioned debugging. Set some break-points, run your application and read the call stack to find your way across all the classes, proxies and components of the program. Debugging is an extremely time consuming task. Ergo I asked myself if there would be an easier way to find required information more quickly.
This is exactly what I have automated with Yet Another Call-graph Analysis (YACA) Monitor - it connects to the Java virtual machine, collects continuously call stack data and provides a human friendly visualization.
Those who cannot change their minds cannot change anything - George Bernard Shaw
About four years ago I have started to work on this topic. With every version some new lessons learnt from users and my personal experience helped to improve the approach.
Find the haystacks! - The first version of YACA-Monitor combined static code analysis data and dynamic code analysis to provide a holistic view to the software. In principle, this was a good approach for small programs, but a call graph with thousands of nodes and links is just a nice picture, especially with a pure 2-dimensional visualization.
Find the right haystack! - The second version introduced a 3-dimensional rendering based on WebGL and tried to give better visualization of the graph based on Barnes-Hut N-Body-Simulation algorithm. Additionally, working with the first version showed, that with static analysis comes a lot of non needed information. So, I decided to remove the static analysis in this version. But trying to show everything what happens in a program was still not efficient enough.
Jump into the haystack and find the needle! - The third version of YACA-Monitor focused on Java EE Applications and a better filtering of the relevant information. All has been implemented in a single web archive. Just deploy the war file into your application server and start the analysis. In this version I also experimented with a complete new visualization based on Oculus Rift (DK2). For this I had to develop the complete user interface which is renderable for VR settings. The result was a nice Chrome Experiment (see www.chromeexperiments.com/experiment/oculus-rift-gui) and some experiences about „how to design software for virtual reality“. This includes opportunities as well as limitations of VR software.
Stop with the haystacks and start to harvest grapes! - YACA-Monitor 4.0 combines now the best of version 2 and 3 in a solution for standalone Java 8 SE applications. A further simplified user interface and improved the performance. Now you may click through the call stack and filter what you like to see.
I hear and I forget. I see and I remember. I do and I understand - Confucius
You may fork the complete project with source code and a test client on GitHub or just download the zipped project (see https://github.com/MarkusSprunck/yaca-monitor.git).
In the project, you will find in the folder <Project_Home>/dist the start scripts (start.sh or start.cmd). Just set in the start scripts the path to your Java 1.8 SDK, ensure that you have a standard Chrome installation add execute. In the case you prefer another browser change the scrip or open the URL http://localhost:8082/monitor to see something like the following:
The test client YacaAgentTestClient is a simple spring based application that executes different search algorithms. The Yaca-Monitor shows what happens inside the application.