V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
推荐学习书目
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
xiaoshi657
V2EX  ›  Python

Tornado+Nginx 部署,会造成多个进程操作一个文件的冲突吗,怎么解决呢

  •  
  •   xiaoshi657 · May 4, 2018 · 3609 views
    This topic created in 2919 days ago, the information mentioned may be changed or developed.

    新手学习中.... 有这样的疑问,tornado 部署通常是和 nginx 配合对吗,然后开启多个 tornado 实例,实现多进程。 这样会造成多个进程操作一个文件的冲突吗? 如果会的话,怎么决绝呢,应该注意些什么吗?

    5 replies    2018-05-04 19:29:35 +08:00
    Livid
        1
    Livid  
    MOD
    PRO
       May 4, 2018 via iPhone   ❤️ 1
    耗时的操作开始之前先上一个锁,比如可以用 Redis 实现一个锁。
    lolizeppelin
        2
    lolizeppelin  
       May 4, 2018 via Android   ❤️ 2
    linux 有文件锁
    MeteorCat
        3
    MeteorCat  
       May 4, 2018   ❤️ 2
    python 的文件操作 IO 有文件锁选项,其他语言都有文件锁设置
    大不了就自己弄个自旋锁
    xiaoshi657
        4
    xiaoshi657  
    OP
       May 4, 2018
    已经了解,多谢大家的热心回答
    wcsjtu
        5
    wcsjtu  
       May 4, 2018 via Android
    分布式的话,只能用数据库加锁了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1019 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 18:05 · PVG 02:05 · LAX 11:05 · JFK 14:05
    ♥ Do have faith in what you're doing.