推荐学习书目
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 · Feb 1, 2024 via iPhone · 3348 views
    This topic created in 858 days ago, the information mentioned may be changed or developed.

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

    7 replies    2024-02-08 12:14:43 +08:00
    vone
        2
    vone  
       Feb 1, 2024   ❤️ 1
    不需要连接池,rabbitmq 是通过 channel 进行连接复用。所以性能问题应该通过多开 channel 解决。
    zzl22100048
        3
    zzl22100048  
       Feb 2, 2024   ❤️ 1
    pika 不能复用 channel
    并且也没有内置的重连机制
    vok2aDe12AsWDirE
        4
    vok2aDe12AsWDirE  
       Feb 2, 2024
    julyclyde
        5
    julyclyde  
       Feb 2, 2024
    我还以为 qihoo360 那个仿造 redis 的 pika 呢
    这名字咋这么多重名的?
    qiyilai
        6
    qiyilai  
       Feb 2, 2024
    kombu +1
    orioleq
        7
    orioleq  
    OP
       Feb 8, 2024 via iPhone
    试了下,pika 不支持多线程之间复用 connection
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2916 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 15:01 · PVG 23:01 · LAX 08:01 · JFK 11:01
    ♥ Do have faith in what you're doing.