简体   繁体   English

Django应用程序的典型内存使用情况

[英]Typical memory usage for Django applications

I am deploying a Django application (DEBUG=False) on an Ubuntu server and I am seeing high memory consumption by gunicorn and celery processes. 我在Ubuntu服务器上部署Django应用程序(DEBUG = False),我看到了gunicorn和芹菜进程的高内存消耗。

Processes   User       Count    CPU Memory
-------------------------------------------
gunicorn    www-data    3   0.5%    193 MB
celery      celery      2   0.3%    121 MB
celery      root        1   0.0%    44.9 MB
rsyslogd    syslog      1   0.0%    31.3 MB
postgres    postgres    6   0.0%    26.5 MB

It is a pretty small application (~400 db rows) and there is no traffic to the website yet. 这是一个非常小的应用程序(约400分贝行),但网站还没有流量。 The snapshot was taken just after power-cyclying the server. 快照是在电源循环服务器之后拍摄的。

I am trying to understand, is this memory consumption normal ? 我想了解,这个内存消耗是否正常 What are the typical memory usages I should expect for an idle system? 对于空闲系统,我应该期待什么样的内存使用?

There are some blogs about memory leaks in python, but for an idle system, that might not be such a big issue. 有一些博客关于python中的内存泄漏,但对于一个空闲的系统,这可能不是一个大问题。

Normally for a typical Django Application it would take 60 - 80 MB for a Django app with database connections, for a Django app which only requires a little bit of database connections, only takes up about 18 MB memory. 通常对于典型的Django应用程序,对于具有数据库连接的Django应用程序,需要60-80 MB,对于仅需要一点数据库连接的Django应用程序,仅占用大约18 MB内存。 For a more sophisticated Django app which requires queueing up tasks, send emails, database connections, user logins, etc, it would require about 130 MB. 对于需要排队任务,发送电子邮件,数据库连接,用户登录等的更复杂的Django应用程序,它需要大约130 MB。 and yes Celery consumes a lot of memory, you could try using eventlet to reduce the memory consumption: Here's a link 是的Celery消耗大量内存,您可以尝试使用eventlet来减少内存消耗:这是一个链接

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM