저는 프로듀서와 소비자를 동시에 시작했습니다. 6 시간 후 생산자는 약 6 개의 crores 메시지를 대기열로 보내고 6 시간 후에 생산자가 멈추었지만 소비자는 18 시간 후에도 4 개의 crores 메시지가 대기열에 계속 남아 있습니다. 소비자 성능이 매우 느린 이유를 알려주시겠습니까?왜 spring-amqp 소비자 성능이 매우 느 립니까?
미리 감사드립니다.
@Bean
public SimpleMessageListenerContainer listenerContainer() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory());
container.setQueueNames(this.queueName);
container.setMessageListener(new MessageListenerAdapter(new TestMessageHandler(), new JsonMessageConverter()));
return container;
}
@Bean
public ConnectionFactory connectionFactory() {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory(
"localhost");
connectionFactory.setUsername("guest");
connectionFactory.setPassword("guest");
return connectionFactory;
}
@Bean
public RabbitTemplate rabbitTemplate() {
RabbitTemplate template = new RabbitTemplate(connectionFactory());
template.setMessageConverter(new JsonMessageConverter());
template.setRoutingKey(this.queueName);
template.setQueue(this.queueName);
return template;
}
public class TestMessageHandler {
// receive messages
public void handleMessage(MessageBeanTest msgBean) {
// Storing bean data into CSV file
}
}
감사합니다 Russel. 소비자는 1 억 개의 메시지를 소비하는 데 32 시간이 걸렸습니다. 생산 된 메시지를 소비하는 거래를하지 않는 소비자는 게시물에 구성을 추가했습니다. 감사합니다 – Pand005
메시지의 크기가 얼마나 큽니까? 나는 방금 30 초 이내에 10 만 개의 짧은 메시지를 발행했으며 모두 100 초 내에 소비되었다. 그리고 그것은 작은 랩탑에있었습니다. TestMessageHandler를 벤치마킹 해 보셨습니까? RabbitMQ가 없으면 초당 몇 개의 메시지를 처리 할 수 있습니까? –
각 메시지 크기는 46 바이트입니다. 나는 위에서 언급 한 것처럼 10 만 건의 메시지로 작업 할 때 시간이 덜 필요하다는 것에 동의합니다. 여기에서 RabbitMQ 서버는 LAN의 RAM 크기가 30GB 인 서버 하나와 3.4GB의 RAM을 가진 데스크톱의 생산자와 소비자를위한 Java 클라이언트에서 실행됩니다. 소비자가받은 메시지를 다른 작업이 아닌 CSV 파일에 삽입하는 논리. 나는 "당신 TestMessageHandler를 벤치마킹 해 봤어?"라고 이해하지 못했습니다. pls 말해 줄래? – Pand005