Apache/MySQL 上的 Django 内存泄漏
技术堆栈上运行 500k 产品
- 我有一个 Satchmo 部署,在Apache 2.2-mpm-prefork
- mysql 5.1
- mod_wsgi 3.3
- mysqldb 1.2.3
(随着时间的推移,将迁移到 nginx / Gunicorn / 等...) 存在严重的内存泄漏
该网站在服务器本身运行时 16GB内存,随着时间的推移,它全部被apache进程消耗
,调试被关闭
,缓存正在通过MySQL运行。
我已经用谷歌搜索并试验了几天,除了内存消耗减慢之外没有任何变化。
对于追踪这个问题有什么建议吗?
我的下一步是对项目进行概要分析(考虑到 Satchmo 中的依赖项数量,不喜欢这个想法),尽管我不认为问题出在项目本身,因为
- 我之前使用过 Satchmo,没有出现内存问题
- 这并没有显示在我的开发机器上
I have a Satchmo deployment w/ 500k products running on
- Apache 2.2-mpm-prefork
- mysql 5.1
- mod_wsgi 3.3
- mysqldb 1.2.3
Technology stacks asside (going to migrate to nginx / gunicorn / etc... over time)
this site has one hell of a memory leak
the server itself is running with
16GB of memory and over time it is all being consumed by the apache process
debug is turned off
and the cache is being run through MySQL
I've googled and experimented for days without any changes other than the memory consumption has slowed down.
Any suggestions for tracking this one down?
My next step is to profile the project (not fond of the idea given the volume of dependencies in Satchmo) though I don't believe the issue is with the project itself since
- I've used Satchmo before without memory issues
- This doesn't show up on my dev machine
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你如何运行mod_wsgi?嵌入式模式还是守护进程模式?除非您正确设置了 Apache,否则嵌入模式和 prefork 不是一个好主意。阅读:
http://blog.dscpl .com.au/2009/03/load-spikes-and-excessive-memory-usage.html
和
http://blog.dscpl.com.au /2009/11/save-on-memory-with-modwsgi-30.html
另外请确保您没有仍在加载 mod_python。
并不是说内存使用的原因就会跳出来,但您可以尝试像 New Relic 这样的生产监控工具,它可以查看应用程序内部发生的情况。 Python 代理和服务器监控工具都可能很有用,尤其是历史图表,因为它可以更好地指示随着时间的推移正在发生的情况。
免责声明:这些天我在 New Relic 工作,负责 Python 代理。 :-)
How are you running mod_wsgi? Embedded mode or daemon mode? Embedded mode and prefork is a bad idea unless you have set up Apache appropriately. Read:
http://blog.dscpl.com.au/2009/03/load-spikes-and-excessive-memory-usage.html
and
http://blog.dscpl.com.au/2009/11/save-on-memory-with-modwsgi-30.html
Also make sure you aren't still loading mod_python.
Not that the cause of the memory usage will jump out, but you might try a production monitoring tool like New Relic which can look at what is going on inside of your application. Both Python agent and server monitoring tools could be useful, especially historical charting as will give a better indication of what is going on over time.
Disclaimer: I work for New Relic these days on the Python agent. :-)