Java Agent Dynamic Bytecode Instrumentation Update

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing Java Agent technologies do not allow for seamless updates without restarting the Java Virtual Machine (JVM) or the application, limiting the ability to deploy updates or roll back to previous versions while the application is running.

Innovation Solution

The solution involves dynamic bytecode instrumentation, where the Agent's code can be updated while it is locked and running within the JVM, allowing the updated Agent to be deployed without stopping the application or JVM, and enabling rollback to previous versions without restarting.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If the Agent's code is locked in the JAR file to ensure integrity and proper loading by the Bootstrap Classloader, then the Agent can be reliably loaded and executed, but the code cannot be modified or updated without restarting the JVM

Engineering Contradiction:
ImproveAgent loading reliabilityVSAvoidAgent update capability
Core Design Contradiction:
ReliabilityVSAdaptability or versatility

Solution Approach 1:

The patent segments the Agent code into two parts: the locked JAR file that is loaded by the Bootstrap Classloader for reliability, and a separate update mechanism that can modify the Agent code in memory. The JAR file contains the original locked code, while updates are applied through bytecode instrumentation that creates modified versions of the Agent classes without changing the original locked file.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces an intermediary mechanism - a code transformer or instrumentation module - that sits between the locked JAR file and the running Agent code. This intermediary allows the original locked code to remain intact while enabling dynamic updates through bytecode manipulation, thus resolving the contradiction between locking for reliability and allowing updates for adaptability.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If the JVM and Application are restarted to update the Agent, then the Agent can be updated to a new version, but the Application experiences downtime and service disruption

Engineering Contradiction:
ImproveAgent version updateVSAvoidApplication downtime
Core Design Contradiction:
Adaptability or versatilityVSLoss of time

Solution Approach 1:

The patent makes the Agent code dynamic by enabling it to be updated in memory while the JVM and Application continue to run. The system dynamically loads new Agent code versions, applies bytecode transformations, and activates updated classes without requiring a restart, thus achieving dynamic updates with zero downtime.

Inventive Principle:
Principle #15Dynamics

Solution Approach 2:

The patent ensures continuous operation of the Application and JVM during Agent updates. The update mechanism is designed to work alongside the running system, allowing the useful action of the Application to continue uninterrupted while the Agent code is being updated in the background and activated.

Inventive Principle:
Principle #20Continuity of useful action

3Adaptability or versatility

If the Agent code is made modifiable to allow updates, then the Agent can be updated dynamically, but the integrity and security of the Agent code may be compromised

Engineering Contradiction:
ImproveDynamic code updateVSAvoidCode integrity
Core Design Contradiction:
Adaptability or versatilityVSReliability

Solution Approach 1:

The patent creates copies of the original Agent classes from the locked JAR file and applies modifications to these copies in memory. The original locked code remains unchanged and serves as the source of truth, while the copied and modified versions are used for dynamic updates. This copying mechanism preserves the integrity of the original code while enabling modifiable updates.

Inventive Principle:
Principle #26Copying

Solution Approach 2:

The patent uses an intermediary bytecode instrumentation layer that mediates between the locked original code and the modified update code. This intermediary ensures that modifications are applied systematically and safely, maintaining code integrity by preserving the original locked file as the authoritative source while enabling controlled modifications through the instrumentation layer.

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentEP2701061B1Method of updating or rollbacking dynamically a Java Agent by instrumenting its bytecode
Publication Date: 2021.12.22 CA TECH INC
  • EP2701061B1 patent drawingFigure 1
  • EP2701061B1 patent drawingFigure 2~3
  • EP2701061B1 patent drawingFigure 4

AI summary

A method is disclosed herein for updating an Agent that is instrumenting the byte code of an application. The code of the Agent can be updated (112) by self-instrumenting its byte code without being disruptive to the application it is instrumenting. Each code version of the Agent is written in a particular Class acting like a Shim. Custom class loaders insure that there is no conflict between the reloaded classes.