Spatial-Temporal Heterogenous Graph Contrastive Learning for Microservice Workload Prediction

Mohan Gao, Kexin Xu, Xiaofeng Gao, Tengwei Cai, Haoyuan Ge

Introduction

In modern cloud computing, microservice architectures have become the standard for building scalable applications. However, managing these services efficiently remains a significant challenge due to "resource mismatch." Over-allocation leads to substantial financial waste, while under-allocation risks system instability and crashes. Accurate workload prediction is essential for proactive resource management.

Challenges in Workload Prediction

Predicting microservice workloads is complicated by two primary factors:

  1. Temporal Complexity: Workload data is inherently non-stationary, meaning its statistical properties shift over time. It also exhibits multi-periodicity, where multiple overlapping cycles (e.g., daily and weekly) occur simultaneously. Furthermore, external system states, such as response times and the number of active replicas, exert a dynamic influence on CPU usage.
  2. Spatial Complexity: Unlike physical infrastructures with fixed topologies, microservices possess "logical" dependencies based on behavioral patterns. Traditional models often rely on arbitrary similarity thresholds to map these relationships, which can introduce noise and degrade prediction accuracy.
Overview of spatial dependencies and workload characteristics in microservice environments.

The STEAM Framework

To address these challenges, the authors propose STEAM (Spatio-Temporal Heterogenous Graph Contrastive Learning). The framework utilizes a "spatio-temporal sandwich" architecture designed to capture both long-term trends and short-term fluctuations.

Long-Term Temporal Encoding

STEAM employs a De-stationary Module that normalizes input series to improve predictability, later re-introducing statistical trends to ensure accuracy. This is paired with Auto-Correlation and Series Decomposition to disentangle complex periodic patterns.

System States Encoding

Rather than treating CPU usage in isolation, STEAM incorporates auxiliary data such as Response Time (RT), request volume, and replica counts. These are processed through a decoupled embedding layer to prevent "feature entanglement," ensuring that secondary signals do not obscure the primary workload patterns.

Correlation between workload and auxiliary system states like request volume, replicas, and response time.

Spatial Feature Encoding

The core innovation of STEAM lies in its use of Heterogeneous Graph Contrastive Learning. To avoid the pitfalls of fixed-threshold similarity graphs, the model generates multiple "views" of the system based on different metrics. It then learns consistent, robust features across these views, effectively filtering out statistical noise and identifying true service dependencies.

Short-Term Temporal Encoding

Finally, a Temporal Convolutional Network (TCN) is used to capture sudden, localized fluctuations, providing the model with the agility needed for real-time cloud environments.

Experimental Evaluation

STEAM was evaluated on two large-scale real-world datasets:

  • MS Dataset: Workload data for 46 microservices over 10 days from Ant Group.
  • Ali Dataset: Workload records for 148 machines over 8 days from the Alibaba Cluster Trace.

Key Results

STEAM consistently outperformed state-of-the-art baselines, including PatchTST, MTGNN, and FEDformer.

  • MS Dataset: STEAM achieved a Mean Absolute Error (MAE) of 0.0738 at a prediction horizon of $L=48$, significantly better than PatchTST (0.0788) and traditional ARIMA (0.0965).
  • Ali Dataset: STEAM maintained its lead with an MAE of 0.1348, compared to 0.1612 for PatchTST.

Ablation studies confirmed that the De-stationary module and System State Augmentation are critical to the model's performance.

Conclusion

The STEAM framework demonstrates that combining contrastive learning with decoupled system state encoding provides a robust solution for microservice workload prediction. By filtering spatial noise and accounting for non-stationary temporal patterns, it offers a path toward more efficient and reliable cloud resource management. Future research may explore integrating additional metrics like memory pressure or network bandwidth to further enhance predictive power.

Summary updated

Abstract

With the widely adoption of microservice architecture in the cloud computing industry, accurate prediction of workloads, especially CPU cores, can support reasonable resource allocation, thereby optimizing the resource utilization of the system. However, workload prediction is challenging in two dimensions. In the temporal dimension, workload series 1) has non-stationary characteristics, leading to poor predictability; 2) has a multi-periodic nature with entangled temporal patterns; 3) may be influenced by dynamic system states like response time and number of requests. In the spatial dimension, when regarding microservices as nodes in a distributed system, there is no topology caused by physical connections, but exists complex similarity dependencies. Extracting robust spatial features from these dependencies presents difficulties. To address these, we propose STEAM, a Spatio Temporal Heterogenous Graph Contrastive Learning for Microservice Workload Prediction. STEAM leverages non-stationary decomposition self-attention to extract temporal features from non-stationary and multi-periodic workload series, while the decoupled embedding is used to capture system state information of microservices. By treating microservices as nodes and constructing a similarity graph, STEAM effectively models the similarity relationships between microservices. To reduce the prior interference caused by the similarity threshold and improve the robustness, STEAM constructs two heterogeneous augmentation views and uses contrastive learning to extract the shared consistent spatial features. The multi-scale learning is adopted to model the long- and short-term temporal features, forming a spatio-temporal stacking structure. Experiments on two datasets, including MS dataset obtained from Ant Group, which is one of the world’s largest cloud service providers, demonstrate the superiority of STEAM.
BibTeX
@inproceedings{gao2025spatial,
  author = {Mohan Gao and Kexin Xu and Xiaofeng Gao and Tengwei Cai and Haoyuan Ge},
  title = {{Spatial-Temporal Heterogenous Graph Contrastive Learning for Microservice Workload Prediction}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i11.33271},
}
Figure