One of the programming models that has been developing
the most in recent years is Function as a Service (FaaS). The growing concern
over data centre energy footprints has driven sustainable software
development. In serverless applications, energy consumption depends on
the energy consumption of the application’s functions. However, measuring
energy proves challenging, and the results’ variability complicates
optimisation efforts at runtime. This article addresses this issue by measuring
serverless function energy consumption and exploring integration
into an optimisation system that selects implementations based on their
current energy footprint. For this, we have integrated an energy measurement
software into a FaaS system. We have analysed how to properly
process the data and how to use them to perform self-adaptation.
We present a series of methods and policies that make our system not
only capable of detecting variations in the energy consumption of the
functions, but it does so taking into account the variability in the measurements
that each function may present. Our experiments showcase
proper integration in a self-adaptive system, showing a reduction up to
5% in energy consumption due to functions in a test application.