[Newbie doubt] How to configure the simple query bus to reduce latency

Hi.

We are testing a new project that is has a default configuration for the query bus in a Spring Java project (not using Axon DB).

We are seeing high latency on the queryGateway.query method call.
It takes more than one second just to dispatch the query.

Is there something that we need to change on the default Spring configuration for the query gateway/bus to fix this behaviour?

Again, very newbie to Axon Framework, be gentle. :slight_smile:

Hi Miguel,

You’re using the SimpleQueryBus, and all query handling is performed in the same thread that dispatches the query; it’s thus possible the observed latency is due to your data retrieval in handling the query.

/Marc

Yes, that is what we were suspecting.

How can we modify our setup to reduce this latency when we have higher load?

Is there a way to push the query execution to its own thread or some sort of virtual thread setup we can configure?

P.S.: thank you for the quick reply.

Sure, since SimpleQueryBus itself doesn’t employ any threading, you can hand off query execution to a separate executor and return the CompletableFuture.