Django 应用程序因几个并发请求而冻结
我有一个没有视图的 django 应用程序,我只用它来提供使用 django-piston 包的 REST API。
由于我已使用 mod-wsgi 将其部署到 amazon-ec2,因此在一些请求后它会冻结,并且 CPU 使用率达到 100%(除以 python 和 httpd 进程)。
我正在使用 Postgres 8.4、Python 2.5 和 Django 'ENGINE': 'django.contrib.gis.db.backends.postgis'。
日志没有显示任何问题。我该如何调试问题?
I have a django app without views, I only use it to provide a REST API using django-piston package.
Since I have deployed it to amazon-ec2 with mod-wsgi, after some requests it freezes, and the CPU goes to 100% of usage divided by python and httpd processes.
I'm using Postgres 8.4, Python 2.5 and Django 'ENGINE': 'django.contrib.gis.db.backends.postgis'.
Logs don't show me any problem. How can I debug the problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来你好像处于一个微观实例中。微型实例能够在很短的时间内爆发大量的CPU,之后它们必须在较长的时间内降至非常低的背景水平,否则亚马逊就会对其进行严厉的限制。如果您收到并发请求,很可能即使是一个 CPU 密集型应用程序也会导致限制启动。
微型实例仅适用于非常非常小的流量,例如非常基本的博客之类的东西。
他们的用户指南详细介绍了这一点:微型实例指南。
Sounds like you're in a micro instance. Micro instances are able to burst large amounts of cpu for a VERY short amount of time, after that they must drop to very low background levels for an extended duration or else amazon with harshly throttle it. If you're getting concurrent requests most likely even a lightly cpu intensive app would cause the throttling to kick in.
Micro instances are only usable for very very light traffic on something like a very basic blog and that's like it.
Their user guide goes into this in detail: Micro Instance guide.