In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about how to analyze the observability of function calculation in Serverless. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
The following is mainly divided into three parts: the overview introduces the basic concepts of observability, including Logging, Metrics and Tracing, and then introduces Logging, Metrics and Tracing; in function calculation in detail. Finally, several common scenarios are taken as examples to introduce how to quickly locate and solve problems in function calculation.
Overview
What is observability? According to Wikipedia, observability is a measure of the internal state of the system by external performance.
In application development, observability helps us to judge the health status within the system. When there is a problem in the system, help us to locate the problem, troubleshoot the problem, analyze the problem; when the system runs smoothly, help us to evaluate the risk and predict the possible problems. The risk assessment is similar to the weather forecast, predicting that if it rains tomorrow, you have to take an umbrella with you when you go out. In the application development of function computing, if it is observed that the concurrency of the function continues to increase, it is likely that the hard work of the business promotion team leads to the rapid expansion of the business scale, in order to avoid reaching the concurrency limit to trigger flow control, developers need to improve concurrency in advance.
Observability includes three aspects: Logging, Metrics, and Tracing.
Logging is a log, which records the key information in the operation of the function, which is discrete and specific. The problem can be quickly located by combining the error log and the function code.
Metrics is an indicator, an aggregate of data, usually in the form of a chart. The core indicators such as tps and error rate in the chart can reflect the operation and health status of the function.
Tracing is link tracing and request-level tracking. In distributed systems, we can see the delay of requests in each module and analyze performance bottlenecks.
Logging/Metrics/Tracing1 in function calculation. Journal
How to view the function log in function calculation? In traditional server development, you can record the log to a file on disk and collect the contents of the file through the log collection tool; in function calculation, the developer does not need to maintain the server, so how to collect the logs printed in the code?
1) configure the log
Function computing is seamlessly integrated with the log service, and the function log can be recorded in the log repository (Logstore) provided by the developer. Log is an item in the service configuration. Configure LogProject and Logstore for the service. Logs printed by all functions through stdout under the same service will be collected in the corresponding Logstore.
2) keep a log
How to type the journal? Can logs printed directly through console.log/print in the code be collected? The answer is yes. The libraries provided by various development languages print logs to stdout, such as node.js 's console.log (), python's print (), golang's fmt.Println (), and so on. The function calculates to collect all logs printed to stdout and upload them to Logstore.
The call calculated by the function is in the request dimension, and each call corresponds to a request, which corresponds to a requestID. When the number of requests is very large, there will be a large number of logs. How to distinguish which logs belong to which requests? This requires recording the requestID in the log together. Function calculation provides built-in log statements, and each log printed will be preceded by a request ID to facilitate log filtering.
3) View the log
When the function log is collected into the Logstore of the log service, you can log in to the log service console to view the log.
At the same time, the function calculation console also integrates the log service, and you can view the log on the function calculation console. There are two query methods in the function calculation console:
Simple query: the log corresponding to each requestID is listed in the simple query, which can be filtered through requestID.
Advanced query: advanced query is embedded with log service, which can be queried through SQL statement.
two。 Index
How to view metrics:
View monitoring metrics for function details: FC provides a wealth of system metrics, which can be viewed in the function calculation console without any configuration.
Configure log market: log market can not only see the monitoring metrics provided by function calculation, but also can be associated with developer logs to generate custom monitoring metrics.
3. Link tracing
(request the delay waterfall map on each link)
Link tracing is an important part of troubleshooting problems in distributed systems. Link tracking can analyze the delay of requests on each link in a distributed system. There are the following situations:
As a part of the whole link, we can see the delay of the request in the function calculation, which includes the system startup time and the real execution time of the request, which helps the user to analyze the performance bottleneck.
When FC SDK is called in the function calculation, you can see the call delay of SDK API by default.
Developers can manually analyze this delay by accessing the database and other products in the function code.
Problem troubleshooting
Function computation provides a lot of observability-related functions, so how to locate the problem? Take several scenarios as an example.
Scenario 1: after the new version is released, the function error rate increases
First of all, observe the metrics of the function after releasing the version, roll back immediately to avoid failure once the error rate increases, check the function log to locate the cause of the error, and fix the problem online again.
Scenario 2: the performance of the function is poor, and the execution time is always very long, even timeout.
Enable the tracing function, bury it in places that may be time-consuming inside the function, view the waterfall diagram of the request, locate the reason for the long execution time, and fix the problem.
Scenario 3: the volume of business is expanding rapidly and the degree of concurrency is about to reach the limit of concurrency.
Check the current degree of concurrency through metrics and observe that when the degree of concurrency continues to rise, contact the developer of the function in time to improve the degree of concurrency.
The above is the editor for you to share how to analyze the observability of function calculations in Serverless, if you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.