如果 Azure App Service 的 CPU 短时达到最大使用率会发生什么?

huangapple go评论59阅读模式
英文:

What to expect if Azure App Service CPU maxes out momentarily?

问题

我目前有一个Azure App Service API,通常平均和最大CPU利用率都非常低(<10%利用率)。不时,CPU会因客户请求的暂时性激增而飙升。这些波动似乎只持续了一瞬间,但我想知道这是否令人担忧。Azure App Service CPU暂时耗尽的结果是什么(无论是一瞬间还是几秒钟)?这会导致应用程序崩溃,还是只会缓冲请求直到密集任务完成?值得注意的是,尽管CPU飙升,内存利用率仍然很低。提前感谢您的意见。

看起来CPU负载完全是由大量密集请求同时到来引起的。

英文:

I currently have an Azure App Service API that usually runs extremely low average and max CPU (<10% utilization). Every now and again, the CPU will spike due to a temporary spike in client requests. These spikes seemingly only last for a split second, but I’m wondering if this is cause for concern. What is the result of an Azure App Service CPU maxing out temporarily (either for a split second or for several seconds). Will this cause the app to crash, or will it just buffer requests until intensive tasks complete? It is worth noting that despite the spike in CPU, memory utilization remains low. Thanks in advance for input.

It looks like the CPU load is caused entirely from a large number of intensive requests all coming in at the same time.

答案1

得分: 1

以下是要翻译的内容:

当 Azure App Service API 的 CPU 利用率暂时上升时,可能会导致应用程序变慢或变得无响应,具体取决于上升的级别和持续时间。

系统将尝试在此期间缓冲请求,但如果上升过高,某些请求可能会被丢弃或超时。这可能会导致用户体验不佳或错误,尤其是如果上升持续了较长时间。

为了减轻这个问题,您可以采取一些措施。

  1. 您可以优化 API 的代码,以降低每个请求的 CPU 利用率。这可能涉及减少每个请求执行的操作数量,使用缓存或其他性能增强技术,或优化用于处理请求的算法。

  2. 您还可以考虑增加 App Service 的资源,例如增加 CPU 内核数量或增加内存,以处理上升期间的负载增加。另一个选项是使用水平扩展,通过添加更多 API 实例来将负载分布到多个服务器上,从而有助于减轻上升的影响。

您还可以实时监控 App Service,以检测和响应 CPU 利用率上升。

例如,您可以使用 Azure Monitor 设置警报,当 CPU 利用率超过某个阈值时触发,并自动扩展您的 App Service 以响应。

通过检查 Azure 监视器日志和 Web 应用程序诊断,可以找到 CPU 利用率背后的原因。

  1. 诊断和解决问题:

  2. CPU 使用情况:

  3. CPU 详细信息:

参考自:

为 Azure App Service 进行应用程序监视

CPU 诊断,识别和诊断高 CPU 问题

英文:

When the CPU utilization of your Azure App Service API spikes temporarily, it could cause the app to slow down or become unresponsive, depending on the level and duration of the spike.

The system will try to buffer requests during this time, but if the spike is too high, some requests may be dropped or time out. This can result in a poor user experience or errors, especially if the spike is sustained for an extended period of time.

To mitigate this issue, you can take a few steps.

  1. You can optimize the code of your API to reduce the CPU utilization of each request. This could involve reducing the number of operations performed for each request, using caching or other performance-enhancing techniques, or optimizing the algorithm used for processing requests.

  2. You can also consider scaling up the resources of your App Service, such as increasing the number of CPU cores or adding more memory, to handle the increased load during spikes. Another option is to use horizontal scaling by adding more instances of your API to distribute the load across multiple servers, which can help reduce the impact of spikes.

And you can monitor your App Service to detect and respond to spikes in CPU utilization in real-time.
For example, you can use Azure Monitor to set up alerts that trigger when CPU utilization exceeds a certain threshold, and automatically scale your App Service in response.
By checking the Azure monitor logs and Web App Diagnostics, can find the reasons behind CPU Utilization.

  1. Diagnose and solve problems:

如果 Azure App Service 的 CPU 短时达到最大使用率会发生什么?

  1. CPU Usage:

如果 Azure App Service 的 CPU 短时达到最大使用率会发生什么?

  1. CPU Drill Down:

如果 Azure App Service 的 CPU 短时达到最大使用率会发生什么?

References taken from

Application monitoring for Azure App Service

CPU Diagnostics, Identify and Diagnose High CPU issues

huangapple
  • 本文由 发表于 2023年2月10日 09:52:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75406226.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定