We're using the Jetty Websocket server (version=9.4.35) in our application. We have a scenario where we have about a hundred messages (each of size about 2KB to 4KB) to be sent out to a remote client.
We're using the async write method RemoteEndpoint.sendString(message, new WriteCallback() { ... } ).
What we're noticing is a lot of time elapsing between the message getting queued and the message being processed and flushed.
Here's an example:
Jan 21, 2021 @ 06:59:36.981 ExtensionStack DEBUG container-22894 Queuing TEXT[len=3953,fin=true,rsv=...,masked=false]
...
Jan 21, 2021 @ 07:09:25.841 ExtensionStack DEBUG qtp1220759559-343 Processing TEXT[len=6323,fin=true,rsv=...,masked=false]
That's almost 7 mins elapsed between the two log lines!
I've gone through the Jetty code a little bit and suspect it could be because of the synchronized block within the ExtensionStack::offerEntry or ExtensionStack::pollEntry methods.
I must be doing something wrong because sending out a few hundred messages on a 2CPU/4GB RAM VM shouldn't be a large load!
I'd really appreciate any pointers on what I might be doing wrong or anything I can tweak to overcome this problem.