Open pstrumni opened 2 years ago
You will have to tell us more. The emitter is using a buffer to handle back-pressure, so you are not sending immediately, but write it to a buffer and the connector poll the items from the buffer.
Thanks for reply. Could you tell me how to send messages immediately?
I have following code:
@ApplicationScoped
public class NumbersClient {
@OnOverflow(OnOverflow.Strategy.NONE)
@Channel("numbers-out")
Emitter<String> numbersEmitter;
public void send(final int i) {
numbersEmitter.send(String.valueOf(i));
}
}
@Path("/")
public class TestRestController {
private final NumbersClient numbersClient;
public TestRestController(final NumbersClient numbersClient) {
this.numbersClient = numbersClient;
}
@Path("/test1")
@GET
public Response test1() {
numbersClient.send(1);
return Response.accepted().build();
}
}
I run apache jmeter thread pool with size 100, each 1000 requests. Without @OnOverflow(OnOverflow.Strategy.NONE) it throws exception:
SRMSG00034: Insufficient downstream requests to emit item
With @OnOverflow(OnOverflow.Strategy.NONE) it runs without exception, but very slow.
Yes, you can use an unbounded buffer (risky).
With 'none' it just blocks which is also wrong.
I would not use jmeter to do benchmark as it differs from coordinated omissions.
So there is no other way to simply send message to broker from non reactive code?
You can use any rabbitmq client directly, or the vertx rabbitmq client (it will work in native).
Why the buffer is being processed so slow? Can I do something to improve performance without switching to other library?
I've investigated why publishing messages by quarkus (with smallrye reactive messaging) is so slow and noticed that it uses only one channel to send messages to RabbitMQ while spring and micronaut use multiple channels (32 in micronaut and ~200 in spring).
Why don't you use multiple channels for publishing messages to RabbitMQ?
@kdubb any idea?
@cescoffier , @kdubb any updates?
@ozangunalp did a few experiment. Seems like it got fixed, but I will let him comment.
Hi, I'm trying to compare multiple frameworks (spring, micronaut and quarkus) by RabbitMQ integration support. I run simple benchmark which simply publish numbers from 0 to 100 000 . While spring and micronaut need max 2 seconds to publish messages, quarkus with smallrye-reactive-messaging need at least 10 seconds.
I have suspected, that it could be related with https://github.com/smallrye/smallrye-reactive-messaging/issues/220 issue, but setting waitForWriteCompletion=false doesn't change anything.
Sample code:
and configuration:
I've tried also another piece of code, but also run really slow:
I'm using quarkus version 2.6.1.Final with jdk11.
Why publishing messages using quarkus with smallrye is so slow?