[论文解读] The Impact of Auto-Refactoring Code Smells on the Resource Utilization of Cloud Software
本研究评估了在OpenStack上部署的六个开源SaaS应用中,自动重构七种经典代码异味(God Class、Feature Envy、Type Checking、Cyclic Dependency、Shotgun Surgery、God Method和Spaghetti Code)对CPU和内存使用率的影响。通过使用JDeodrant和JSparrow等工具,作者发现重构God Class、Feature Envy和God Method会显著增加CPU使用率(+14.8%)和内存使用率(OneDataShare中高达88.1%),而其他异味的重构则降低了资源消耗,表明某些自动化重构可能无意中损害云资源效率。
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.
研究动机与目标
- 研究自动化重构代码异味对云环境SaaS应用CPU和内存使用率的影响。
- 识别在重构时导致云环境中资源消耗增加或减少的具体代码异味。
- 评估现有重构工具(JDeodrant和JSparrow)在提升云资源效率方面的有效性。
- 强调在多租户云平台中,由于资源按使用量计费,自动化重构可能导致意外的性能下降风险。
- 指导SaaS提供商有选择性地重构代码异味,以避免产生不必要的云成本。
提出的方法
- 从GitHub中选取六个真实世界的SaaS应用(Zimbra、OneDataShare、GraphHopper、Hadoop、JENA、JAMES)进行分析。
- 使用JDeodrant检测代码异味(God Class、Feature Envy、Type Checking),使用JSparrow检测其他异味(Cyclic Dependency、Shotgun Surgery、God Method、Spaghetti Code)。
- 在选定的SaaS应用中,使用JDeodrant和JSparrow对检测到的异味执行自动化重构。
- 将重构后的应用部署在OpenStack云基础设施上,测量重构前后CPU和内存使用率。
- 开展受控实验,比较不同重构代码异味之间的资源消耗指标。
- 分析结果,关联特定重构技术与CPU和内存使用率的变化。
实验结果
研究问题
- RQ1自动重构代码异味如何影响云环境SaaS应用的CPU使用率?
- RQ2在OpenStack上运行的SaaS应用中,重构特定代码异味对内存消耗有何影响?
- RQ3哪些重构技术尽管提升了代码质量,却导致了更高的资源使用率?
- RQ4为何某些重构后的异味(如God Class、God Method)在云环境中导致更高的CPU和内存消耗?
- RQ5现有重构工具(如JDeodrant和JSparrow)在多大程度上提升了或降低了云资源效率?
主要发现
- 重构God Class异味导致OneDataShare中CPU使用率增加14.8%,内存使用率最高增加88.1%,表明存在显著的资源开销。
- Feature Envy异味导致所有六个SaaS应用中CPU使用率增加11.00%,并引起显著的内存增长。
- God Method异味导致CPU使用率增加3.5%,并伴随明显的内存消耗上升,主要由于方法提取和函数调用频率增加。
- 相比之下,重构Cyclic Dependency、Shotgun Surgery、Spaghetti Code和Type Checking降低了CPU使用率,表明这些更改提升了效率。
- 重构God Class后,内存消耗急剧增加(如GraphHopper中增加54.8%,OneDataShare中增加88.1%),可能源于类的分解和方法调用频率的提升。
- 本研究发现,当前的自动化重构工具可能无意中增加云资源成本,尤其在God Class、Feature Envy和God Method异味的重构中,尽管代码结构得到改善。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。