Function Compute provides instance-level metrics that allow you to view core metrics such as CPU utilization, memory usage, the network conditions of instances, and the number of requests that an instance concurrently processes. This topic describes the background information, definition, and details of instance-level metrics. This topic also describes how to enable collection of instance-level metrics.
- How to view the specific CPU usage in CPU-intensive scenarios.
- How to set up an appropriate single-instance parallelism when using single-instance multiple concurrency.
- If a function fails during execution, confirm the cause of the function execution failure, such as code exceptions or function instance performance exceptions that cause the execution failure.
The instance-level metrics provided by Function Compute can help you resolve the preceding issues and understand the health status of each instance in Function Compute.
What are instance-level metrics?
Instance-level metrics are performance metrics of instances used to execute functions. The instances are monitored and their performance metrics are collected in real time. The metrics are displayed in a visualized manner to provide you with end-to-end monitoring and troubleshooting paths for the instances.
- Function or function qualifier: the function-specific metrics of instances. For example, if Function A is executed by two instances at the same time, the function-specific CPU metric is the maximum CPU utilization of these two instances.
- Instance: the metrics of a specific instance.
- The qualifier indicates the version information that is passed in when a function is invoked. It can be a version number or an alias.
- Instances are dynamically created and reclaimed by Function Compute. Each instance exists only for a short period of time. You cannot manage instances.
- Monitoring Center: The Monitoring Center module in Function Compute provides a built-in
dashboard that displays instance-level metrics in a visualized manner. You can log
on to the Function Compute console and view the following metrics in the dashboard on the Monitoring Center page:
- Metrics of instances that execute the same function
- Metrics of all instances
- Metrics of a specified instance
- Log Service: Function Compute imports instance-level metrics into Log Service. You
can create a custom visual dashboard by using the analysis capabilities of Log Service
and the log collection capabilities of Application Real-Time Monitoring Service (ARMS).
For more information, see Query logs and Get started with log monitoring.
The instance-level metrics of each instance are recorded in logs at intervals in the following format.
|cpuPercent||The CPU utilization. It indicates the number of used CPU cores. The value may exceed 100%.||120%|
|cpuQuotaPercent||The estimated maximum CPU utilization. The memory and CPUs used to execute functions
have the following relationship:
|memoryUsageMB||The amount of memory used by the instance. Unit: MB.||16.87|
|memoryLimitMB||The maximum amount of memory that can be used by the instance. Unit: MB.||1024|
|rxBytes||The traffic received by the instance in the time interval at which logs are generated. Unit: bytes.||158|
|txBytes||The traffic sent by the instance in the time interval at which logs are generated. Unit: bytes.||1598|
|rxTotalBytes||The traffic received by the instance since the instance was started. Unit: bytes.||158875|
|txTotalBytes||The traffic sent by the instance since the instance was started. Unit: bytes.||36123|
|concurrentRequests||The number of requests that the instance concurrently processes.||10|
|hostname||The name of the host on which the instance runs.||36123|
- The cpuQuotaPercent metric is theoretical. The value of the cpuPercent metric may exceed that of the cpuQuotaPercent metric. In this case, the instance preempts the resources of other instances on the same host.
- The communication between instances and system modules causes a small amount of traffic. Therefore, a small amount of sending and receiving traffic is generated when no network access exists within a function.
- The traffic of an instance represents only the inbound and outbound traffic of the instance. The Internet traffic and the private network traffic are counted together, and you cannot calculate the traffic fee based on this monitoring chart.
Enable collection of instance-level metrics
- Log on to the Function Compute console.
- In the left-side navigation pane, click Services and Functions.
- In the top navigation bar, select the region where your Kubernetes cluster is deployed.
- On the Services page, find the target service. In the Actions column, click Configure.
- In the Instance-Level Metrics section of the Edit page, select Enable and click Save. Note If you do not enable the log feature when you create a service, you must enable the log feature and instance-level metrics in the Log Configuration section.