tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Afaf Zahkya <pbaffilia...@gmail.com>
Subject Memory problems caused by the messageBufferText CharBuffer in WSFrameBase.java
Date Tue, 21 Jun 2016 12:46:43 GMT
Hello,

I m using tomcat 8.0.21.

I want to send *up* to 4 MB of text messages through a websocket connection
to my tomcat server. I set the MaxTextMessageBufferSize to 4 MB.Now as a
result, every time I open a websocket  connection and I send a message , I
can see that 4 MB are  being allocated in memory for the CharBuffer
messageBufferText regardless of the size of the message I send . 99 % of my
messages would be way smaller.The 4 MB  remain allocated in the
messageBufferText CharBuffer even after the message is handled.  The
connection can stay open up to 30 minutes in my case, and each  websocket
connection is taking 4 MB of memory all of that time even if it's inactive
which leads my server to eventually run out of memory even with inactive
connections  . Note that I m using a Whole Message Handler.

 Why not set the messageBufferText CharBuffer size to the payload length if
it doesn't exceed the maxTextMessageBufferSize, and then clearing that
buffer ( reducing its size) after the message is handled by the Handler, so
that inactive connections don't take up memory. ( same for the binary) ?

Any other / better suggestions on how to solve that problem ?

Thanks.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message