V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
tumb8r
V2EX  ›  Python

flask-sqlalchemy 查询数据量大的时候,会退出程序!何解?

  •  
  •   tumb8r · 2016-07-17 21:06:12 +08:00 · 4218 次点击
    这是一个创建于 2832 天前的主题,其中的信息可能已经有所发展或是发生改变。


    如上图,数据量大概就 2w 多,其实这不算多吧?但是如果是用 flask-sqlalchemy 查询的时候会退出 python ,显示 killed !放到网站上就会出现“ 502 bad gateway ”的错误!
    想知道能不能解决这种问题。。
    9 条回复    2016-07-22 08:47:44 +08:00
    tumb8r
        1
    tumb8r  
    OP
       2016-07-17 21:35:03 +08:00
    any body?
    linnchord
        2
    linnchord  
       2016-07-17 21:52:18 +08:00
    看上去是系统杀了这个进程,你可以同时运行下 top 看看内存占用。

    2W 条算不算多得看每条记录里存的啥,存个 text 或者 blob 在后面,那也小不了。
    just4test
        3
    just4test  
       2016-07-17 21:58:06 +08:00
    内存爆了吧。
    billlee
        4
    billlee  
       2016-07-17 22:00:38 +08:00
    看看系统日志里面有没有 oom killer 什么的
    casparchen
        5
    casparchen  
       2016-07-17 23:17:49 +08:00 via iPhone
    @tumb8r 吓尿了
    MrGba2z
        6
    MrGba2z  
       2016-07-17 23:42:35 +08:00
    关闭 debug 模式试试
    ChiChou
        7
    ChiChou  
       2016-07-17 23:58:43 +08:00
    为何不分页
    SlipStupig
        8
    SlipStupig  
       2016-07-18 00:45:42 +08:00
    看一下 ulimit -a 查看一下 stack 大小,如果超过了可能会被 kill 掉,内存不够也会被 kill 掉, 建议用 yield 去存数据
    yudahai109
        9
    yudahai109  
       2016-07-22 08:47:44 +08:00
    看一下 model ,你怎么引用的,是不是有很多外键,外键引用方式是咋样的? lazying 参数怎么配置的?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5321 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 06:51 · PVG 14:51 · LAX 23:51 · JFK 02:51
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.