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

一大波 RQ 的问题, work 数,工作模式,非独立运行 ……

  •  
  •   Feiox ·
    iceice · Apr 21, 2015 · 4479 views
    This topic created in 4185 days ago, the information mentioned may be changed or developed.

    文档瞅过一边,但还是有很多不明白:

    1. 如何控制 Work 的数量,能在运行过程中动态改变吗?
    2. work 貌似是单进程?能不能改为 多线程 或者 Gevent 工作模式?
    3. 对于低 CPU 消耗,HTTP I/O 密集 型任务,是否会因为 IO 中而阻塞?
    4. 如果使用 Flask 只启动一个 app.py ,rq 能不能作为一个子进程而存在(不需要单独在终端中启动)

    附一个笑话(真实),今天上课是我们老师在吹说接过一个社交类项目,甲方要求性能可以达到每秒 1000万 的并发数量,报价 50w。这老师嗨吹嘘说自己不太敢接,找华为的几个人来做这个项目。笑 shi,老师您当我傻啊。

    4 replies  •  2016-06-17 10:04:27 +08:00
    washinriver
        1
    washinriver  
       Apr 21, 2015
    work是客户端的逻辑, 无所谓是进程,线程还是协程的实现吧.
    可以在app.py里, 用multiprocess启动rq进程.

    1000w/s....
    oclock
        2
    oclock  
       Apr 21, 2015
    3 是典型的协程场景
    4 用RQ又不想单起worker进程我认为是妖蛾子做法,如果缺flask上下文可以with app_context()给worker,或者不用RQ改用python-message、blinker
    fy
        3
    fy  
       Apr 21, 2015
    只玩过zmq,多进程还是挺不错的,性能也不差。动态改Worker没试过。
    也可以玩玩celery,这个比zmq还要简单
    yarving
        4
    yarving  
       Jun 17, 2016
    In fact, you can refer to this: http://python-rq.org/docs/
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2264 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 11:01 · PVG 19:01 · LAX 04:01 · JFK 07:01
    ♥ Do have faith in what you're doing.