Improving Runtime Performance in Java: A Systematic Detection and Refactoring Approach for Lock Contention Code Smells (Work In progress paper)
Concurrent programming offers significant performance benefits but introduces complexities in development and testing, particularly in multi-threaded environments. As software scales and complexity increases, fault localization—the process of identifying fault locations—becomes increasingly tedious, costly, and equally critical. To address this, we conducted a comprehensive study, defining a set of performance-related code smells that capture various lock contention scenarios within Java intrinsic locks, along with recommendations and refactored code. To verify these code smells, we developed a code smell detection tool that analyzes source code, identifies critical sections, and applies predefined patterns to detect contention. This tool was validated on several open-source projects, successfully detecting over 350 lock contention instances across Apache HBase, Glide, and EventBus. Performance validation using the Java Lock Monitor (JLM) demonstrated that implementing our recommendations led to significant improvements. On average, the lock hold time decreased over 10%, the spin count was reduced over 2%, and the GET operations increased by 18%, highlighting the efficacy of the proposed framework in mitigating lock contention and enhancing runtime performance. As a work in progress, this research highlights the importance of systematically addressing performance bottlenecks in Java applications and lays the foundation for scalable and maintainable multi-threaded systems.
Authors
- Vijay Sundaresan (ORCID: https://orcid.org/0009-0006-9342-4356)
- Ramiro Liscano (ORCID: https://orcid.org/0000-0002-1137-4978)
- Md Asif Khan (ORCID: https://orcid.org/0009-0005-8739-6654)
- Aditi Mukherjee
- Akramul Azim (ORCID: https://orcid.org/0000-0002-6292-6939)
- J. W. Robertson
- Ashadullah Shawon (ORCID: https://orcid.org/0000-0003-4473-4009)
- Yee-Kang Chang (ORCID: https://orcid.org/0009-0000-2382-0085)
Institutions
- Ontario Tech University (CA)
- IBM (Canada) (CA)
Publication Details
- Published
- 2025-05-03
- DOI
- https://doi.org/10.1145/3680256.3722201
- Primary Topic
- Software Engineering Research
- Type
- article
- Field-Weighted Citation Impact
- 0.00