Closed neeraj20gupta closed 7 years ago
Incorrect usage of async write.
Async write will write when it can, you can't keep shoving content at the endpoint, having Jetty queue messages infinitely.
You have to pay attention to return on the Future, or use the Callback to identify when a message has been send (and more importantly, if it hasn't been sent after a certain amount of time).
Don't send messages to slow endpoints, drop messages if you can, enqueue messages on your application for when the prior write has completed.
This is can get rather complicated, and you'll probably want to use one of the many libraries built on top of WebSockets to handle this kind of messaging. (cometd is our go-to)
I have written a websocket application using jetty in which the server send Json frames on the connected websocket clients.
For better performance I am using async Send string method.
session.getRemote().sendString(message, writecallback)
For my connected 200 clients I see OOM error after sending data(approximately 500 records per second) for 20-25 mins.Following is the trace
Jetty Version :- 9.4.0.v20161208. Heap Size :- 16 GB(both min and max). Default GC setting of JDK 1.8 The OOM is not happening when I use blocking SendString() Is this a bug with jetty or incorrect usage of async write? Thanks in advance :)