[英]python requests taking 100% of cpu
One of our API servers has an issue with CPU usage. 我们的其中一台API服务器的CPU使用率存在问题。 API is written in python and configured in ubuntu AWS EC2 instance.
API用python编写,并在ubuntu AWS EC2实例中配置。 This application uses Python 2.7 and Django 1. This can be accessed through port 80 by proxy passing.
该应用程序使用Python 2.7和Django1。可以通过代理传递通过端口80进行访问。 Sometimes we are getting 499 requests in our logs that time $htop value shows 100% CPU usage in the server.
有时我们在日志中收到499个请求,而时间$ htop值显示服务器中100%的CPU使用率。 The only python requires are running in this server.
唯一的python要求正在此服务器上运行。 But in AWS cloudwatch monitoring, it is not.
但是在AWS cloudwatch监控中却不是。 only 40% to 50%.
只有40%到50%。
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
23086 root 20 0 815776 96056 12792 S 100 4.7 2:43.12 python
24041 root 20 0 292756 92820 12696 S 8.0 4.5 0:33.73 python
24072 root 20 0 815656 95696 12792 S 5.3 4.7 0:28.27 python
Please help TIA 请帮助TIA
You most likely using a dual core server, and your python process is single threaded and using as much CPU as it can (one core). 您最有可能使用双核服务器,而python进程是单线程的,并且使用了尽可能多的CPU(一个核)。
Hence the discrepancy between htop and cloudwatch: 因此,htop和cloudwatch之间的差异:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.