我的环境中有两个r5a.xlarge
ec2实例。每个实例都有4个vCPU和32个GiB内存,应用程序处理一些文件将json中的数据返回给客户端。它处理的两个文件也相当大(大约1.5GB)。我没有数据库连接。该应用程序在flask
中使用Python3.6并在apache
服务器上运行。
在几个传入请求之后,实例将进入“降级”状态。原因如下:
25.0 %的请求在HTTP5xx中失败。实例健康状态为"OutOfService“达1小时23分钟:实例至少连续失败了健康检查的UnhealthyThreshold数。99 %的CPU在使用中。I/O等待率为96 %。100 %的内存在使用中。
尽管停止了传入的请求,但它仍然处于这种状态。
另一个实例由于某种原因部署了不正确的版本。
不正确的应用程序版本"app-xxxxxxx“(部署24)。预期版本"app-yyyyyy“(部署23)。
我把负载均衡器的容量设为0。这移除了这两个实例。我重新部署了应用程序,然后将容量设置回到原来的设置,即Min = 1,Max = 2,理想=2
我这样做是为了使它拥有具有正确的代码基版本的新实例。
现在它与一个实例一起运行,在7-8+请求之后,它再次进入降级状态。原因再次是
100 %的内存在使用中。
我尝试过创建交换空间,就像提到的here一样
我甚至检查了httpd_error
日志,找不到与此相关的任何错误。这是httpd_error
文件中的全部错误
[suexec:notice] [pid 2880] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[http2:warn] [pid 2880] AH10034: The mpm module (prefork.c) is not supported by mod_http2. The mpm determines how things are processed in your server. HTTP/2 has more demands in this regard and the currently selected mpm will just not do. This is an advisory warning. Your server will continue to work, but the HTTP/2 protocol will be inactive.
[http2:warn] [pid 2880] AH02951: mod_ssl does not seem to be enabled
[lbmethod_heartbeat:notice] [pid 2880] AH02282: No slotmem from mod_heartmonitor
[:warn] [pid 2880] mod_wsgi: Compiled for Python/3.6.2.
[:warn] [pid 2880] mod_wsgi: Runtime using Python/3.6.12.
[mpm_prefork:notice] [pid 2880] AH00163: Apache/2.4.46 (Amazon) mod_wsgi/3.5 Python/3.6.12 configured -- resuming normal operations
我怎么才能开始解决这个问题?
发布于 2020-10-29 18:50:07
问题在申请中。我不得不对应用程序读取和处理数据的方式做一些重大更改。应用程序在每个请求中读取大量数据--这很大程度上导致了服务器超载和挂起。
https://stackoverflow.com/questions/64490468
复制相似问题