Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SimpMessagingTemplate.convertAndSend with RabbitMQ works very slow

I'm using spring STOMP over Websocket with RabbitMQ. All works fine but simpMessagingTemplate.convertAndSend works very slow, call can take 2-10 seconds (synchronously, block thread). What can be a reason??

RabbitTemplate.convertAndSend take < 1s, but I need stomp over websocket..

UPDATE

I try to use ActiveMQ and gets the same result. convertAndSend take 2-10 seconds

ActiveMQ have default configuration.

Web socket config:

@Configuration
@EnableWebSocket
@EnableWebSocketMessageBroker
class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

    @Override
    void configureMessageBroker(MessageBrokerRegistry config) {
        config.enableStompBrokerRelay("/topic", "/queue", "/exchange");
        config.setApplicationDestinationPrefixes("/topic", "/queue"); // prefix in client queries
        config.setUserDestinationPrefix("/user");
    }

    @Override
    void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/board").withSockJS()
    }

    @Override
    void configureWebSocketTransport(WebSocketTransportRegistration registration) {
        registration.setMessageSizeLimit(8 * 1024);
    }
}
like image 380
Nickolay Savchenko Avatar asked Nov 02 '16 12:11

Nickolay Savchenko


1 Answers

Problem resolved. Its bug in io.projectreactor library version 2.0.4.RELEASE. I change to 2.0.8.RELEASE and its fixed problem. Sending message now take ~50ms.

    <dependency>
        <groupId>io.projectreactor</groupId>
        <artifactId>reactor-net</artifactId>
        <version>2.0.8.RELEASE</version>
    </dependency>
like image 171
Nickolay Savchenko Avatar answered Oct 31 '22 22:10

Nickolay Savchenko