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
shade
V2EX  ›  Python

使用web.py框架时,针对单个post请求,能够使用多进程来处理并返回结果吗?,最近总是被这个问题困扰,请教大牛们,这是由于web.py处理请求是单程线的吗,有没有好的框架来解决这个问题?

  •  
  •   shade · 2013-11-02 23:51:28 +08:00 · 3696 次点击
    这是一个创建于 3829 天前的主题,其中的信息可能已经有所发展或是发生改变。
    4 条回复    1970-01-01 08:00:00 +08:00
    laiwei
        1
    laiwei  
       2013-11-03 00:30:37 +08:00 via Android
    你得配合 nginx,uwsgi,webpy一起来工作

    nginx起多个worker,静态文件直接用nginx处理

    动态请求转发给uwsgi

    uwsgi也起多个worker
    shade
        2
    shade  
    OP
       2013-11-03 00:37:34 +08:00
    谢谢@laiwei,上面的方案应该是针对多个请求来并发处理,提高处理的速度,我想问得是针对单个post请求,framework接到请求后,能够再post处理函数下能建立多进程吗,我觉得用twisted来建立web服务器应该能够实现。不知到可行不可行
    thedevil5032
        3
    thedevil5032  
       2013-11-03 07:31:06 +08:00 via iPad
    Celery
    9hills
        4
    9hills  
       2013-11-03 08:39:34 +08:00
    @shade 两种方法都可以
    1. 用线程池
    2. 用Celery或者Python-RQ 来调度

    我建议用2,比较简单
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3305 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 11:31 · PVG 19:31 · LAX 04:31 · JFK 07:31
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.