[Paper Review] The Impact of Auto-Refactoring Code Smells on the Resource Utilization of Cloud Software
This study evaluates the impact of auto-refactoring seven classic code smells—god class, feature envy, type checking, cyclic dependency, shotgun surgery, god method, and spaghetti code—on CPU and memory utilization in six open-source SaaS applications deployed on OpenStack. Using tools like JDeodrant and JSparrow, the authors find that refactoring god class, feature envy, and god method significantly increases CPU (+14.8%) and memory usage (up to 88.1% in OneDataShare), while other smells reduce resource consumption, indicating that some automated refactoring can inadvertently harm cloud resource efficiency.
Cloud-based software-as-a-service (SaaS) have gained popularity due to their low cost and elasticity. However, like other software, SaaS applications suffer from code smells, which can drastically affect functionality and resource usage. Code smell is any design in the source code that indicates a deeper problem. The software community deploys automated refactoring to eliminate smells which can improve performance and also decrease the usage of critical resources. However, studies that analyze the impact of automatic refactoring smells in SaaS on resources such as CPU and memory have been conducted to a limited extent. Here, we aim to fill that gap and study the impact on resource usage of SaaS applications due to automatic refactoring of seven classic code smells: god class, feature envy, type checking, cyclic dependency, shotgun surgery, god method, and spaghetti code. We specified six real-life SaaS applications from Github called Zimbra, OneDataShare, GraphHopper, Hadoop, JENA, and JAMES which ran on Openstack cloud. Results show that refactoring smells by tools like JDeodrant and JSparrow have widely varying impacts on the CPU and memory consumption of the tested applications based on the type of smell refactored. We present the resource utilization impact of each smell and also discuss the potential reasons leading to that effect.
Motivation & Objective
- To investigate the impact of automated refactoring of code smells on CPU and memory utilization in cloud-based SaaS applications.
- To identify which code smells, when refactored, lead to increased or decreased resource consumption in cloud environments.
- To evaluate the effectiveness of existing refactoring tools—JDeodrant and JSparrow—in improving cloud resource efficiency.
- To highlight the risk of unintended performance degradation due to automated refactoring, especially in multi-tenant cloud platforms where resources are billed.
- To guide SaaS providers in selectively refactoring code smells to avoid incurring unnecessary cloud costs.
Proposed method
- Selected six real-world SaaS applications (Zimbra, OneDataShare, GraphHopper, Hadoop, JENA, JAMES) from GitHub for analysis.
- Detected seven classic code smells using JDeodrant (god class, feature envy, type checking) and JSparrow (cyclic dependency, shotgun surgery, god method, spaghetti code).
- Applied automated refactoring using JDeodrant and JSparrow on the detected smells in the selected SaaS applications.
- Deployed the refactored applications on OpenStack cloud infrastructure to measure CPU and memory utilization before and after refactoring.
- Conducted controlled experiments to compare resource consumption metrics across different refactored code smells.
- Analyzed the results to correlate specific refactoring techniques with changes in CPU and memory usage.
Experimental results
Research questions
- RQ1How does auto-refactoring of code smells affect CPU utilization in cloud-based SaaS applications?
- RQ2What is the impact of refactoring specific code smells on memory consumption in SaaS applications running on OpenStack?
- RQ3Which refactoring techniques lead to increased resource usage despite improving code quality?
- RQ4Why do certain refactored smells (e.g., god class, god method) cause higher CPU and memory consumption in cloud environments?
- RQ5To what extent do existing refactoring tools like JDeodrant and JSparrow improve or degrade cloud resource efficiency?
Key findings
- Refactoring the god class smell led to a 14.8% increase in CPU utilization and up to 88.1% increase in memory usage in OneDataShare, indicating significant resource overhead.
- The feature envy smell caused an 11.00% increase in CPU utilization and substantial memory growth across all six SaaS applications.
- The god method smell resulted in a 3.5% CPU increase and notable memory consumption rise, primarily due to method extraction and increased function call volume.
- In contrast, refactoring cyclic dependency, shotgun surgery, spaghetti code, and type checking reduced CPU usage, suggesting these changes improve efficiency.
- Memory consumption increased drastically after refactoring god class (e.g., 54.8% in GraphHopper and 88.1% in OneDataShare), likely due to class decomposition and increased method call frequency.
- The study reveals that current automated refactoring tools may inadvertently increase cloud resource costs, especially for god class, feature envy, and god method smells, despite improving code structure.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.