微服务正逐步成为互联网应用所采用的设计架构,如何有效检测故障并定位问题原因,是保障微服务性能与可靠性的关键技术之一.当前的方法通常监测系统度量,根据领域知识人工设定报警规则,难以自动检测故障并细粒度定位问题原因.针对该问题,提出一种基于执行轨迹监测的微服务故障诊断方法.首先,利用动态插桩监测服务组件的请求处理流,进而利用调用树对请求处理的执行轨迹进行刻画;然后,针对影响执行轨迹的系统故障,利用树编辑距离来评估请求处理的异常程度,通过分析执行轨迹差异来定位引发故障的方法调用;最后,针对性能异常,采用主成分分析抽取引起系统性能异常波动的关键方法调用.实验结果表明:该方法可以准确刻画请求处理的执行轨迹,以方法为粒度,准确定位系统故障以及性能异常的问题原因.
Microservice architecture is gradually adopted by more and more applications. How to effectively detect and locate faults is a key technology to guarantee the performance and reliability of microservices. Current approaches typically monitor physical metrics, and manually set alarm rules according to the domain knowledge. However, these approaches cannot automatically detect faults and locate root causes in fine granularity. To address the above issues, this work proposes a fault diagnosis approach for mieroservices based on theexecution trace monitoring. First, dynamic instrumentation is used to monitor the execution traces crossing service components, and then call trees are used to describe the execution traces of user requests. Second, for the faults affecting the structure of execution traces, the tree edit distance is used to assess the abnormality degree of processing requests, and the method calls leading to failures are located by analyzing the difference between execution traces. Third, for the performance anomalies leading to the response delay, principal component analysis is used to extract the key method invocations causing unusual fluctuations in performance metrics. Experimental results show that this new approach can accurately characterize the execution trace of processing requests, and locate the methods that cause system failures and performance anomalies.