Hi Guys, First post to the list, but I'm a long time mina fan. We are using it in the red5 server with great success. I'm currently refactoring the event design and trying to figure ways to reduce overhead. I have a question about using lots of small buffers and making many writes.
Let me explain the situation. We have implemented RTMP protocol, which is a proprietary streaming protocol used by flash. Data in the protocol is chunked into 128 byte segments, in between each chunk there are a variable number of header bytes. The headers range in size from 1 byte to 12. The data can be audio, video, or amf serialized objects. Currently we have an internal buffer in the packet which holds the raw data, in the serializer this is copied to another buffer adding the header bytes. This process has to be done for every client the packet is written to, since the header bytes may change for different clients. I'm wondering if I could split this up, making lots of writes.. header buffer, chunk buffer, header buffer, chunk buffer, etc. This way I can share the chunk buffers between clients (by caching them against the packet), and dispose them when we have finished writing the packet to all clients. I imagine this would be more memory efficient. Video packets can get quite large. So.. my questions are.. Will making lots of writes have a negative impact on performance? Or is it better to use a larger buffer even if it cant be shared? And... does mina use scattered writes under the hood? Hope the above makes sense, and you can point me in the right direction. Thanks for your work on an excellent framework. -- Luke
