You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.lang.StringCoding.encode(StringCoding.java:350)
at java.lang.String.getBytes(String.java:929)
at org.eclipse.jetty.util.StringUtil.getUtf8Bytes(StringUtil.java:561)
at org.eclipse.jetty.websocket.common.frames.TextFrame.setPayload(TextFrame.java:44)
at org.eclipse.jetty.websocket.common.WebSocketRemoteEndpoint.sendString(WebSocketRemoteEndpoint.java:426)
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 :)
The text was updated successfully, but these errors were encountered:
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 :)
The text was updated successfully, but these errors were encountered: