A Simple Approach to Detect Anomalies in Microservices-Based Systems Using PyOD

Lauriana Tavares Landim, Instituto Politécnico de Castelo Branco
Luís Barata, Instituto Politécnico de Castelo Branco
Eurico Lopes, Instituto Politécnico de Castelo Branco


Ease of scale is one of the defining characteristics of microservices. However, with scalability comes the problem of diversity of services, making it very important to detect anomalies the soonest possible. Because it is recent, there are still few studies on the best approaches to detecting anomalies in microservices. This paper proposes the Python toolkit, PyOD, as an approach for microservice anomaly detection. This toolkit is composed of a set of anomaly detection algorithms, including classical LOF (SIGMOD2000) to the latest ECOD (TKDE2022). To evaluate the approach, we used two of its algorithms, k Nearest Neighbors (kNN) and Histogram-based Outlier Score (HBOS) to detect anomalies such as application bugs, CPU exhausted, and network jam on the TraceRCA dataset. This dataset contains logs from a real microservices system. The preliminary results show that HBOS algorithm performs better than kNN, with Recall and F1-Score of 93% and 89%, respectively, while for kNN these metrics were 92% and 85%, respectively.