IEEE Access (Jan 2025)

Cohesion Metrics for Microservices

  • C. Rojas-Perez Juan,
  • G. Fragoso-Diaz Olivia,
  • A. Sanchez-Gonzalez Guadalupe

DOI
https://doi.org/10.1109/access.2025.3589789
Journal volume & issue
Vol. 13
pp. 128532 – 128540

Abstract

Read online

Software development requires new technologies, such as service-oriented architectures, that resolve quality problems such as maintenance and costs, which promote improvements in software development. Recently, software architectures have evolved from monolithic architectures to service-oriented architectures, and microservice architectures. In this process, the mechanisms used to evaluate the quality of architectures require changes to be applied to microservices. Cohesion is a quality attribute worthy of consideration. This work describes three metrics for microservices evaluation: Nop to determine the number of used operations, Nap to calculate the number of used endpoints, and the average of the sum of Nap and Nop is used to calculate Cohesion. The metrics are the result of the analysis and tests of microservices from several microservices projects. The cohesion thresholds range from 1 to 0, where one represents a fully cohesive microservice and 0 indicates that the microservice lacks cohesion. The metrics were tested in 41 microservices contained in 9 open-access repositories such as GitHub, Amazon, and Netflix. Results show that the proposed metrics provide cohesion values indicating whether the microservices code require restructuring due to unused operations and endpoints. 12 microservices had a Cohesion value of 1. In the remaining microservices, no pattern of behavior was found. It was observed that programming languages did not influence cohesion results; this is due to poor design or changes in the architecture of the finished and operational system. The metrics should be used as a complement to those already proposed in other works that address other objectives and scopes.

Keywords