Abstract
Modernizing legacy monolithic applications into microservices architectures is a critical step for cloud-native adoption. However, manual decomposition is labor-intensive, and existing automated tools often fail to account for complex database dependencies and execution contexts. This paper introduces CARGO (Context-sensitive lAbel pRopaGatiOn), a tool that utilizes advanced static analysis and a novel label-propagation algorithm to partition monolithic Java applications. By explicitly modeling database interactions and employing context-sensitive analysis, CARGO produces service boundaries that significantly reduce distributed transactions and improve system performance.
1. Introduction
As enterprises transition to cloud environments, the decomposition of monolithic applications into independent microservices has become a primary architectural goal. While microservices offer scalability and agility, the process of "breaking the monolith" is fraught with difficulty. Existing AI-guided tools often produce "distributed monoliths"—architectures where services are still tightly coupled due to imprecise code analysis or a failure to account for shared data layers. CARGO addresses these challenges by treating database dependencies as first-class citizens and utilizing high-precision static analysis to define cohesive service boundaries.
2. The Challenges of Monolithic Decomposition
Automated decomposition tools typically suffer from two primary limitations:
- Database Blindness: Many tools focus exclusively on method calls (code-to-code dependencies) while ignoring how different components interact with shared database tables. This oversight leads to frequent "distributed transactions," where a single business operation must coordinate updates across multiple services, creating significant performance bottlenecks.
- Imprecise Analysis: Most tools utilize context-insensitive analysis, which fails to distinguish between different call sites of the same method. This lack of precision results in an over-approximated dependency graph, leading to tangled service boundaries that do not reflect actual runtime behavior.
3. Methodology
CARGO introduces a multi-stage approach designed to sharpen the view of the application's internal dependencies.
3.1 System Dependency Graph (SDG)
CARGO constructs a highly precise map of the application using 2-object-sensitive analysis (2objH). Unlike standard analysis, 2objH tracks the specific context of calls and, crucially, integrates database tables as nodes within the graph. This ensures that data-level dependencies are visible to the partitioning algorithm.
3.2 Contextual Snapshots
To manage the complexity of the SDG, CARGO extracts "contextual snapshots" that represent specific program states. This technique mimics dynamic execution behavior within a static analysis framework, providing the comprehensive coverage of static review with the precision of dynamic tracing.
3.3 The CARGO Algorithm
The core of the tool is a three-step variant of the Label Propagation Algorithm (LPA):
- Seeding: The process begins with initial labels, which can be assigned randomly or derived from existing decomposition tools.
- Transactional Refinement: The algorithm groups classes that interact with the same database tables. This "data gravity" principle ensures that atomic database operations remain within a single service boundary.
- Iterative Propagation: Labels flow across the contextual snapshots, allowing functional boundaries to emerge based on the strength of the contextual dependencies.
4. Experimental Evaluation
The researchers evaluated CARGO on five Java Enterprise Edition (EE) applications, including benchmark apps like Daytrader, AcmeAir, and JPetStore, as well as a large-scale Proprietary Industrial Application. These datasets were chosen to test the tool's ability to handle complex database interactions and real-world codebases.
5. Key Results
CARGO demonstrated significant improvements over baseline AI-guided decomposition tools across several dimensions:
- Transactional Purity: In multiple benchmarks (Daytrader, FoSCI++, MEM++), CARGO achieved a transactional purity score of 1.0, effectively eliminating distributed transactions by ensuring all database-dependent classes were grouped together.
- Performance Gains: Real-world deployment of CARGO-suggested partitions resulted in an average 120% increase in throughput and an 11% reduction in latency compared to standard baseline recommendations.
- Architectural Integrity: CARGO outperformed existing tools in key metrics, including Coupling, Cohesion, and Inter-call Percentage, suggesting a more robust and maintainable microservices architecture.
6. Discussion and Limitations
While CARGO excels at structural and data-level analysis, it currently lacks an understanding of high-level business logic. In tests measuring "Business Context Purity," CARGO performed slightly lower than human-centric approaches because it cannot perceive the domain-specific nuances known to software architects. Additionally, the current implementation is specific to Java EE; extending the framework to other languages (e.g., Python, Go) and NoSQL databases remains a subject for future research.
7. Conclusion
CARGO represents a significant advancement in automated microservices migration. By combining context-sensitive static analysis with a database-aware refinement process, it bridges the gap between code structure and data persistence. The result is a decomposition strategy that not only respects architectural best practices but also delivers measurable performance improvements in production-like environments.
Summary updated