Thanks for your reply. No I have not used that method. When/how often should I perform a mergeAll()? I don't find much information about it. Should I call it once every x:th write in my ProtocolEncoder? Should x in that case be dependent on the current incoming message rate?
On Fri, Jul 25, 2008 at 3:43 AM, Oscar <[EMAIL PROTECTED]> wrote: > Did you try the method *mergeAll* ? > > On Fri, Jul 25, 2008 at 2:13 AM, Johan Haleby <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > I'm using Mina to distribute incoming data from a hardware device to many > > connected clients. The incoming data are chunks of bytes representing > > strings. Whenever a new line is detected in a data chunk the row must be > > extracted, several prefixes (depending on the source channel of the > > hardware > > device) must be added to each row and each row must also be persisted to > > the > > file system. Each connected client also passes a regular expression > filter > > to the Mina server and only rows matching this filter should be forwarded > > to > > the client. There may potentially be a lot of clients connected to the > Mina > > server and the incoming data that should be distributed from the hardware > > device _may_ come at a rate of several Mbit/s. The problem is that the > data > > flow from the hardware device differs quite a lot. At times a single row > is > > only sent to the Mina server once every minute, at other times it may by > > several Mbits per second as I've previously mentioned. How do I deal with > > this situation? I've read in the forum ( > > http://mina.markmail.org/message/k2t5yx7xaztgykcp?q=write+throughput) > that > > under heavy load the TextLineEncoder (which I'm using but I've modified > it > > slightly) is really quite inefficient because I get LOTS of small objects > > (strings) that should be sent to the client. A better way suggested by > that > > thread was to create your own Buffer of, say 64k in size, and just flush > > the > > whole buffer to the write method when its full. I figure that this would > > probably work ok when the load is high but what about when the server > only > > receives one message per minute? Should I perhaps have a thread > monitoring > > the buffer and perform a flush on it on a given time interval if it's not > > full? Any ideas or suggestions? What write buffer size should I be using? > A > > text row is usually about 50 characters long. I'm using Mina 1.1.7. > > > > Thanks > > Johan > > >
