我可以有多少消费者? (Spring-boot + RabbitMq)
How many consumers can i have? (Spring-boot + RabbitMq)
我正在使用 Spring Boot with RabbitMq,然后出现一个问题,我可以创建的使用者数量是否有限?
我在哪里可以找到这个值?
Spring-Amqp
消费人数不限
但通常会受到其他东西的限制。比如你使用SimpleMessageListner
,一个消费者对应一个线程。当你的消费者数量很大时,你的应用可能无法创建那么多线程,导致OOM: unable to create new native thread
.
// OOM in my computer
@RabbitListener(queues = "testq", concurrency = "10000-10000")
public void listen() {
}
如果您使用 CachingConnectionFactory
(connections), set CacheMode
to CONNECTION
, maybe your rabbitmq server cannot carry a very large number of consumers (probably hit the maximum number of file descriptors.),您的应用可能无法连接到 rabbitmq。
我正在使用 Spring Boot with RabbitMq,然后出现一个问题,我可以创建的使用者数量是否有限? 我在哪里可以找到这个值?
Spring-Amqp
消费人数不限
但通常会受到其他东西的限制。比如你使用SimpleMessageListner
,一个消费者对应一个线程。当你的消费者数量很大时,你的应用可能无法创建那么多线程,导致OOM: unable to create new native thread
.
// OOM in my computer
@RabbitListener(queues = "testq", concurrency = "10000-10000")
public void listen() {
}
如果您使用 CachingConnectionFactory
(connections), set CacheMode
to CONNECTION
, maybe your rabbitmq server cannot carry a very large number of consumers (probably hit the maximum number of file descriptors.),您的应用可能无法连接到 rabbitmq。