Managed Runtime Optimization via Proxy Bytecode Replacement
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Managed runtime applications in serverless environments face performance issues due to lengthy startup times and resource consumption, as they require scanning and loading numerous classes and bytecode, leading to inefficient execution and increased costs.
Innovation Solution
A method that generates an optimized version of the managed runtime application by selectively replacing non-invoked bytecode with proxy code and removing unused classes based on method invocation statistics, reducing the overall size of the application and minimizing resource usage.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the managed runtime application loads all classes and bytecode, then complete functionality is available, but startup time and memory consumption increase significantly
Solution Approach 1:
The patent extracts only the necessary classes and bytecode required for specific method invocations from the complete managed runtime application. By analyzing method invocation patterns and selectively loading only the relevant bytecode segments needed for those invocations, the system avoids loading unnecessary code, thereby reducing startup time while maintaining the required functionality.
Solution Approach 2:
The patent segments the managed runtime application into individual method invocation units. Each method invocation is treated as an independent segment that can be loaded and executed separately. This segmentation allows the system to load only the specific method segments that are needed for the current execution context rather than loading the entire application, thus reducing startup time and memory consumption.
2Reliability
If the managed runtime application loads all classes and bytecode, then complete functionality is available, but memory consumption and processing resources increase
Solution Approach 1:
The patent extracts only the necessary classes and bytecode required for specific method invocations from the complete managed runtime application. By analyzing method invocation patterns and selectively loading only the relevant bytecode segments needed for those invocations, the system avoids loading unnecessary code, thereby reducing startup time while maintaining the required functionality.
3Productivity
If bytecode is selectively replaced with proxy code, then startup time and resource consumption are reduced, but execution efficiency may be affected
Solution Approach 1:
The patent introduces proxy code as an intermediary layer between the application logic and the actual bytecode execution. The proxy code contains pre-computed method invocation information that enables fast path execution for commonly invoked methods. This intermediary structure allows the system to achieve fast startup times while maintaining execution efficiency through optimized dispatch mechanisms in the proxy code.
Solution Approach 2:
The patent performs preliminary analysis of method invocation patterns and pre-computes the necessary dispatch information during proxy code generation. By preparing the invocation data in advance, the system eliminates the need for runtime analysis and decision-making, thus maintaining high execution efficiency while benefiting from the reduced startup time provided by selective bytecode loading.
Data Source
AI summary
A method, computer system, and computer program product for generating an optimized managed runtime application is provided. Method invocation statistics for a managed runtime application are received. The managed runtime application comprises code defining a plurality of classes, each class including bytecode for one or more methods associated with the class. The method invocation statistics identify the methods invoked during at least one previous execution of the managed runtime application. An optimized version of the managed runtime application is generated based on the method invocation statistics. The managed runtime application is retrieved, and bytecode for at least one method of a class of the managed runtime application is selectively replaced with proxy code based on the method invocation statistics. The proxy code is configured for retrieving the replaced code.


