Spring Boot RabbitMq The channel

2020-11-26  本文已影响0人  大继

问题

在做rabbit性能测试的时候,出现
The channelMax limit is reached. Try later.

解决

需要修改 /etc/rabbitmq/rabbitmq.conf 自行创建

#0 意味着无限制
channel_max=0

service rabbitmq-server restart

但是 , spring boot 最大限制channel也是 2074

另辟蹊径

加入cache. connection.size: 100链接数 1024 *0.9
cache. connection: connection

rabbitmq:
    host: 192.168.0.111
    port: 5672
    username: admin
    password: 123456
    #虚拟host 可以不设置,使用server默认host
    virtual-host: /
    publisher-returns: true
    publisher-confirm-type: correlated
    template:
      mandatory: true #路由不可达的消息会被监听到,不会被自动删除
    # 打开消息确认机制
    listener:
      simple:
        acknowledge-mode: manual
        retry:
          enabled: true
    cache:
      connection:
        size: 500 #缓存的连接数,只有是CONNECTION模式时生效 默认最大链接数 1024 *0.9
        mode: connection

测试结果

10W条数据 10个线程 33秒

总结,

channel模式 秒并单链接发可以到达 约 1000多/s 再高就要The channelMax limit is reached.
connection模式 200 链接 10线程 大概也是 在 3000多/s 左右,
因为开了callback 如果关闭估计会更高 。
也就是说单机情况 3000 基本是极限了(不是推荐链接模式)
超过1000就要开始考虑别的形式了。集群或kafka了

我看别人比较好的机器可以测试到8.5K/s ,24核64G内存那种。 我这个使用了内网不是本机
在加上有一定的事务估计去掉也很接近了。

上一篇下一篇

猜你喜欢

热点阅读