Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The Jetty and JSR APIs do have an aysnchronous call back style of write. In Jetty it is: sendBytes(ByteBuffer data, WriteCallback callback) and the JSR API is: sendBinary(ByteBuffer data, SendHandler handler)</p> <p>both have text message equivalents. But there are some problems with both of these. Firstly if the callback is used for flow control, then the callback will "be notified when the message has been transmitted". That is not optimal for high throughput as it means that the sending of the next message will always wait until the previous message has been transmitted, giving no opportunity to aggregate multiple messages into single write.</p> <p>If subsequent calls to sentBytes or sendBinary do not wait for the callback, then they can queue up multiple frames that will be efficiently transmitted, but then the problem is that there is no back pressure on sending, so the internal queue can possibly grow forever.</p> <p>One "solution" is to have a limited queue size, but then you get problems with a supposedly async call to sendBytes suddenly blocks!</p> <p>I think the solution is to have an alternative form of callback for sends that are called once the message is queued to be transmitted, but not actually transmitted. Once this callback is called, then any buffers passed can be reused/recycled and another call and another call to sendBytes/sendBinary can be made.</p> <p>Perhaps something like:</p> <p>public interface QueuedWriteCallback extends WriteCallback { writeQueued(); }</p> <p>and for the JSR:</p> <p>public interface QueuedSendHandler extends SendHandler { onQueued(); }</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload