Dear RESTEasy Maintainers,
I am trying to implement a simple messaging system based on Server-Sent Events aka SSE.
Message broker has trivial interface and implementation, source code is on GitHub
For testing purpose I am using the following:
There are 64 clients sending messages via message broker (POST request -> SSE broadcast)
On the other side there is a component (source code) that listens for the messages (RESTEasy SSE client) and process them sending response back via the message broker (again SSE broadacst).
Running some performance tests I have got quite unexpected result. Namely Client request/response latency is huge, up to a few minutes. See screenshot In the screen shot server processes 60K clients requests for a couple of minutes, while without SSE the exact same amount takes 15s
My wild guess is that SseEventSource in the processing component reads messages one by one buffering them and spending lots of time in read method: see screenshot and visualvm snapshot (attached)
Test setup is the following:
All components are on the same host. Message broker and processing application are deployed to Tomcat 9.0.12. No any special tweaks were made to increase performance (no http2, no apr connector etc)
Could you please advise whether it is feasible to decrease latency in this case? Something like reading input events in a thread pool?!