Laurent Cohen a écrit :
Hello,

In fact, while coming up with a small reproducing sample, I realized that the code is working with multiple clients if the data sent is small. In the sample, the objects are around 1 KB, and in the case that doesn't work, much larger objects are sent ( > 700 KB).
Big objects ! MINA should be used carefully when dealing with such objects, as they will remain in memory. It will be easy to kill the stack (OOM) if the codec is not carefully written. I certainly won't suggest to use the standard deserialization in this case, but instead implement a file based deserialization : store all the data on disk until the full object has been received, then deserialize it. The reason for doing such a strange thing is that you may receive many big objects, and as they will remain in memory until the very last byte is received, it may suck up all the memory. As you know the objects size, it's easy to switch to such a file based system when the object size is, say, lager than 4Kb.

Another aspect is that MINA use some stupid extensible buffers (yuk !) to deal with such data. You don't want to see some buffer being realocated many times just because MINA don't use a list of buffers to store spillted messages... (something we will fix in MINA 3)
This tells me that something is definitely wrong in my code. Let me do a little more investigation into this, and I will update you on what I find.

Ok, np.

Reply via email to