推荐学习书目
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
bbhj3434
V2EX  ›  Python

web 开发,周期任务是怎样实现的?大字段放数据库还是另存 txt 好?

  •  
  •   bbhj3434 · Mar 18, 2014 · 3870 views
    This topic created in 4465 days ago, the information mentioned may be changed or developed.
    没完成多少个项目,所以很多东西都没有思路……
    web的周期任务比如每周定时清空数据,每月排行榜这些应该怎样实现?是把定时任务扔到系统计划or数据库计划?

    另:大字段(5000中文字,100w行左右)放数据库还是另存txt好?
    4 replies    1970-01-01 08:00:00 +08:00
    henices
        1
    henices  
       Mar 18, 2014
    Linux 想到crontab是比较自然的,Windows也有计划任务。
    MarsWang
        2
    MarsWang  
       Mar 18, 2014
    1、定期的任务事件一般都是写好脚本然后crontab定期执行,任务比较多的话会用一台单独的服务器去跑。

    2、关于数据存储,这个看场景吧。具体不太清楚。
    verfino
        3
    verfino  
       Mar 18, 2014
    定时任务一般都是仍crontab的吧

    数据存储,几百兆按行整理的数据可以放txt里,计算完压缩保存(有条件的话放SSD上计算)

    每月排行榜的话就按天计算,存储好需要的数据到数据表(按天,或者按小时),然后按月统计计算
    yakczh
        4
    yakczh  
       Mar 18, 2014
    txt

    行按日期, 列按指标存放, 空值可以用-来占位

    看数据粒度,如是是按天的话,全部存一个文件也有300多行

    如果是小时,分钟,可以根据月份,季度名字统一文件命名规则
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3133 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 13:35 · PVG 21:35 · LAX 06:35 · JFK 09:35
    ♥ Do have faith in what you're doing.