Table of Contents
Fetching ...

How Does Microservice Granularity Impact Energy Consumption and Performance? A Controlled Experiment

Yiming Zhao, Tiziano De Matteis, Justus Bogner

TL;DR

This study empirically examines how microservice granularity influences energy consumption and performance using two open-source benchmarks (Train Ticket and Pet Clinic) across coarse, medium, and fine decompositions and five workload levels. Employing a full factorial design, load testing with Locust, and energy measurement via PowerStat, the authors find that finer granularity tends to raise energy use, especially in the larger system, while effect sizes for response time are small but statistically detectable. Regression analyses reveal that workload and granularity interact nontrivially, with high load amplifying energy and latency and with oversubscribed services potentially causing higher energy costs than finer decompositions. The results underscore that granularity decisions should balance energy and performance considerations, particularly for large-scale deployments, and highlight the value of energy monitoring to detect suboptimal decompositions. The authors provide a reproducible artifact package and discuss future work on broader systems, more realistic traffic, and horizontal scaling to generalize the findings.

Abstract

Context: Microservice architectures are a widely used software deployment approach, with benefits regarding flexibility and scalability. However, their impact on energy consumption is poorly understood, and often overlooked in favor of performance and other quality attributes (QAs). One understudied concept in this area is microservice granularity, i.e., over how many services the system functionality is distributed. Objective: We therefore aim to analyze the relationship between microservice granularity and two critical QAs in microservice-based systems: energy consumption and performance. Method: We conducted a controlled experiment using two open-source microservice-based systems of different scales: the small Pet Clinic system and the large Train Ticket system. For each system, we created three levels of granularity by merging or splitting services (coarse, medium, and fine) and then exposed them to five levels of request frequency. Results: Our findings revealed that: i) granularity significantly affected both energy consumption and response time, e.g., in the large system, fine granularity consumed on average 461 J more energy (13%) and added 5.2 ms to response time (14%) compared to coarse granularity; ii) higher request loads significantly increased both energy consumption and response times, with moving from 40 to 400 requests / s resulting in 651 J higher energy consumption (23%) and 41.2 ms longer response times (98%); iii) there is a complex relationship between granularity, system scale, energy consumption, and performance that warrants careful consideration in microservice design. We derive generalizable takeaways from our results. Conclusion: Microservices practitioners should take our findings into account when making granularity-related decisions, especially for large-scale systems.

How Does Microservice Granularity Impact Energy Consumption and Performance? A Controlled Experiment

TL;DR

This study empirically examines how microservice granularity influences energy consumption and performance using two open-source benchmarks (Train Ticket and Pet Clinic) across coarse, medium, and fine decompositions and five workload levels. Employing a full factorial design, load testing with Locust, and energy measurement via PowerStat, the authors find that finer granularity tends to raise energy use, especially in the larger system, while effect sizes for response time are small but statistically detectable. Regression analyses reveal that workload and granularity interact nontrivially, with high load amplifying energy and latency and with oversubscribed services potentially causing higher energy costs than finer decompositions. The results underscore that granularity decisions should balance energy and performance considerations, particularly for large-scale deployments, and highlight the value of energy monitoring to detect suboptimal decompositions. The authors provide a reproducible artifact package and discuss future work on broader systems, more realistic traffic, and horizontal scaling to generalize the findings.

Abstract

Context: Microservice architectures are a widely used software deployment approach, with benefits regarding flexibility and scalability. However, their impact on energy consumption is poorly understood, and often overlooked in favor of performance and other quality attributes (QAs). One understudied concept in this area is microservice granularity, i.e., over how many services the system functionality is distributed. Objective: We therefore aim to analyze the relationship between microservice granularity and two critical QAs in microservice-based systems: energy consumption and performance. Method: We conducted a controlled experiment using two open-source microservice-based systems of different scales: the small Pet Clinic system and the large Train Ticket system. For each system, we created three levels of granularity by merging or splitting services (coarse, medium, and fine) and then exposed them to five levels of request frequency. Results: Our findings revealed that: i) granularity significantly affected both energy consumption and response time, e.g., in the large system, fine granularity consumed on average 461 J more energy (13%) and added 5.2 ms to response time (14%) compared to coarse granularity; ii) higher request loads significantly increased both energy consumption and response times, with moving from 40 to 400 requests / s resulting in 651 J higher energy consumption (23%) and 41.2 ms longer response times (98%); iii) there is a complex relationship between granularity, system scale, energy consumption, and performance that warrants careful consideration in microservice design. We derive generalizable takeaways from our results. Conclusion: Microservices practitioners should take our findings into account when making granularity-related decisions, especially for large-scale systems.

Paper Structure

This paper contains 15 sections, 4 equations, 6 figures, 9 tables.

Figures (6)

  • Figure 1: Timeline of one experiment trial
  • Figure 2: An overview of the experiment infrastructure
  • Figure 3: Boxplots for energy consumption (J) of granularities
  • Figure 4: Boxplots for response time (ms) of granularities
  • Figure 5: Request frequency impact on energy consumption (J)
  • ...and 1 more figures