Backend Development 12 min read

Design and Implementation of Bistoury: An Enhanced Java Application Diagnostic Platform

This article introduces Bistoury, a one‑stop Java application diagnostic solution that improves upon Arthas by adding a web UI, multi‑machine support, integrated agent‑proxy architecture, custom classloaders, online debugging, per‑thread CPU monitoring, and heap object statistics.

Qunar Tech Salon
Qunar Tech Salon
Qunar Tech Salon
Design and Implementation of Bistoury: An Enhanced Java Application Diagnostic Platform

Background: Online application diagnosis is challenging; after Alibaba open‑sourced Arthas in 2018, the team identified several shortcomings (tool‑like usage, lack of web UI, single‑machine focus, and isolation) and decided to build a more powerful one‑stop Java diagnostic solution called Bistoury.

Design and Implementation: Bistoury consists of a user system, agent, proxy, UI, registration center, load balancer and application center. The agent runs on the same host as the target application, receives commands from the proxy via Netty/WebSocket, and interacts with the user system.

ClassLoader design: Bistoury introduces a dedicated BistouryClassLoader to load its attach JARs safely, avoiding version conflicts, and a MagicClassLoader to prioritize classes from Bistoury-magic-classes.jar , enabling lightweight source modifications.

Online Debug: By dynamically instrumenting bytecode at breakpoints, Bistoury captures snapshots of local variables, call stacks, and other context without pausing the application, offering an IDE‑like debugging experience. Example method to debug: protected ModelAndView detailView(String viewName, String code) { Application app = applicationManager.getAppByCode(code, From.master); applicationManager.checkOwner(app); return createView(viewName).addObject("app", app); }

CPU Monitoring: Bistoury collects per‑thread CPU usage from /proc at one‑minute intervals, correlates JVM thread IDs via jstack , and visualizes detailed CPU metrics for each thread.

Heap Object Statistics: An optional feature periodically runs a jmap -histo ‑like command to record object type counts, allowing trend analysis of memory growth.

Conclusion: The article summarizes Bistoury’s motivations, architecture, and key features, providing insights for developers seeking advanced Java application diagnostics.

JavaInstrumentationbackend developmentperformance-monitoringClassLoaderDiagnostics
Qunar Tech Salon
Written by

Qunar Tech Salon

Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.