Springboot RabbitMQ low performance problem

65 views Asked by At

I use rabbitmq as consumer.The procedur send to almost 200 messages per second.Size of message ~4.65KB and also the envorinment of consumers enough capacity. No matter what I do, the performance cannot exceed 40~60 messages per second altough queue has a lot of messages. My rabbit configuration like this

 @Bean
    public SimpleMessageListenerContainer container(ConnectionFactory connectionFactory, MessageListenerAdapter messageListener) {
        SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
        container.setConnectionFactory(connectionFactory);
        container.setMessageListener(messageListener);
        container.setQueueNames(this.queue);
        container.setConcurrentConsumers(80);
        container.setMaxConcurrentConsumers(400);
        container.setConsecutiveActiveTrigger(1);
        container.setConsecutiveIdleTrigger(1);
        container.setPrefetchCount(400);
        container.setConsumerStartTimeout(100);
        container.setReceiveTimeout(100);
        container.setTxSize(200);
        container.setAcknowledgeMode(AcknowledgeMode.AUTO);
        container.setAutoStartup(true);
        return container;
    }
@Bean
    public MessageListenerAdapter messageListenerAdapter(NotificationListener listener) {
        return new MessageListenerAdapter(listener, "handleMessage");
    }
 public void handleMessage(final byte[] message) throws Throwable {
        Date dt1 = new Date();
        System.out.println("Received" + dt1);
}

I tried @RabbitListener annotation and also channel.basicConsume() method but not working

0

There are 0 answers