java - WebSocket async send can result in blocked send once queue filled -


I have very handy JT-based websites which are responsible for streaming small binary messages to connect to customers .

I was using the sendBytesByFuture method to avoid any block on the server side.

After increasing the load from 20 to 20 customers, they stop receiving any data. During the problem solving I decided to switch to the synchronous sending method and eventually found possible reasons:

  java.lang.IllegalStateException: blocking message for 10000 org.eclipse .jetty.websocket.common.WebSocketRemoteEndpoint on .Olog (WebSocketRemoteEndpoint.java:130). Org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint.sendBytes (WebSocketRemoteEndpoint.java.0044)   

There are no calculations on receiving customer data, potentially connecting them slowly They can not be.

So I wonder what can I do to solve this problem? (Using JT 9.2.3)

If you receive an error message from sending a synchronous Thread - Protocol copy is nothing you have attempted to send messages to multiple remote endpoint . Only 1 message can be sent at a time. (Sending a synchronous is not necessarily a quote)

If the error message is caused by an asynchronous transmission, it means that you have messages in waiting for a message in a row, yet Still trying to write async messages

Try not to mix synchronous and asynchronous at the same time (it would be very easy to accidentally produce an invalid protocol stream)

Use of Java Futures:

Would you like to use objects that are given for return and to confirm that the message was actually sent or not (could have been an error) , And if you are without adequate messages If you start the queue to send, you can send a remote message, until the remote endpoint can not reach.

Standard Future Behavior and techniques are also applied here.

> Using JetE Callback:

There is also available in the practice and methods that will call your own code on success / error, on which you Some can put

Use of blocking:

/ p>

or you use blocking only a lot You can send all messages to not be in the queue.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -