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

pika 连接 mq,需要自己写连接池么?

  •  
  •   orioleq · 86 天前 via iPhone · 1094 次点击
    这是一个创建于 86 天前的主题,其中的信息可能已经有所发展或是发生改变。

    假设我有 100 个连接,是保持 100 个长连接,还是自己写个连接池复用连接呢? 复用 channel 会不会导致线程不安全的问题? (连的 rabbitmq ,amqp 协议)

    7 条回复    2024-02-08 12:14:43 +08:00
    vone
        2
    vone  
       86 天前   ❤️ 1
    不需要连接池,rabbitmq 是通过 channel 进行连接复用。所以性能问题应该通过多开 channel 解决。
    zzl22100048
        3
    zzl22100048  
       85 天前   ❤️ 1
    pika 不能复用 channel
    并且也没有内置的重连机制
    bytebuff
        4
    bytebuff  
       85 天前
    julyclyde
        5
    julyclyde  
       85 天前
    我还以为 qihoo360 那个仿造 redis 的 pika 呢
    这名字咋这么多重名的?
    qiyilai
        6
    qiyilai  
       85 天前
    kombu +1
    orioleq
        7
    orioleq  
    OP
       79 天前 via iPhone
    试了下,pika 不支持多线程之间复用 connection
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2902 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 14:39 · PVG 22:39 · LAX 07:39 · JFK 10:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.