JSP Engine In-Memory Tree Execution to Cut Compilation Overhead
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The existing JavaServer Pages (JSP) engine faces inefficiencies due to the repeated compilation of Java code, especially when custom pages need to be recompiled frequently, leading to performance overhead and resource management challenges.
Innovation Solution
An optimized JSP engine model that parses the JSP source code, creates a tree representation in memory, and executes it dynamically, eliminating the need for repeated Java code compilation by maintaining an in-memory cache of tag instances and traversing the tree during page execution.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the JSP container uses the traditional translation and compilation process for each request, then the JSP page can be dynamically processed and rendered, but the repeated compilation of Java code causes performance overhead and inefficiency
Solution Approach 1:
The patent applies preliminary action by performing the translation of JSP to servlet code only once when the JSP page is first accessed or when it changes. The compiled servlet class is then cached and reused for subsequent requests, eliminating repeated compilation overhead while maintaining dynamic processing capabilities.
Solution Approach 2:
The patent uses copying by creating a servlet class copy from the translated JSP code and storing it in memory cache. This copied servlet class can be executed multiple times without requiring re-translation or re-compilation, significantly improving processing speed while minimizing compilation time loss.
2Reliability
If the JSP container recompiles custom pages frequently to reflect changes, then the system remains up-to-date with latest modifications, but resource management becomes challenging and performance deteriorates
Solution Approach 1:
The patent implements feedback by monitoring file system changes to detect when JSP source files are modified. The system only triggers re-translation and re-compilation when changes are detected, rather than recompiling on every request. This feedback mechanism ensures code updates are reflected accurately while minimizing unnecessary CPU usage for resource management.
3Reliability
If the JSP container translates and compiles the servlet class on every request, then the most recent version of the JSP page is always executed, but the processing time increases significantly
Solution Approach 1:
The patent applies preliminary action by translating and compiling the servlet class in advance when the JSP page is first accessed or when source code changes are detected. The pre-compiled servlet is then cached and executed for subsequent requests, ensuring the latest version is used while maintaining fast request processing speed.
Solution Approach 2:
The patent uses dynamics by making the servlet class lifecycle adaptive - it is re-compiled only when necessary (when source code changes) rather than on every request. This dynamic approach balances page version accuracy with request processing speed by adjusting compilation frequency based on actual change events.
Data Source
AI summary
Systems and methods are provided that service a JavaServer Page (“JSP”), including receiving a request for a JSP page, parsing source code for the JSP page, creating a tree of the parsed source code. executing the tree in memory, and returning the requested JSP page. Accordingly, JSP pages do not require repeated recompilation, and JSP pages with customized content may be quickly regenerated with a low performance overhead.


