mina-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lilinfeng <neu.lilinf...@huawei.com>
Subject Some suggestions for the receive buffer and half package processing
Date Thu, 12 Jul 2012 09:21:52 GMT

Good afternoon.

I am a system designer at HUAWEI.

In recent 3 years, I have been using the Java NIO to develop high performance service gate
Like SMS/MMS/WAP PUSH Gateway.

This year, I do the technology selection for the industry mature NIO framework, such as Mina/Netty/NioFramwork/XSoket
I found that Mina is the most outstanding architecture.

After reading the source code and performance test, I found there are some optimization point.

Listed as follows:

The receiver buffer:

When we do reading operator, every time we create a new ByteBuffer for reading bytes from
SoketChannel, in long connection protocol,
Such as SMPP, frequently creating and destroy byte array will reduce the performance. In fact
, we can create a cache buffer in the session
As a attribute. After performance testing, this will improve performance over 20%(Long connect

Decode half package(some Frames condition):

If the receive buffer is only a part of a message, we will use the CumulativeProtocolDecoder
class Solve it, we will cache the left buffer to
Session. If there are large number of half package scene, this will lead to frequently creating
and destroy byte buffer, this is not a best choice.

In fact, before every looping, we mark the IoBuffer for record the first package position,
when the decode return false, we rest the IoBuffer to
The original position then return for receiving the next package. This will reduce the times
of IoBuffer creating and simple the process.

Above is only my personal suggestion. Look forward to your reply.

Sincerely  Li linfeng

华为技术有限公司 Huawei Technologies Co., Ltd.

地址:深圳市龙岗区坂田华为基地 邮编:518129
Huawei Technologies Co., Ltd.
Bantian, Longgang District,Shenzhen 518129, P.R.China
This e-mail and its attachments contain confidential information from HUAWEI, which
is intended only for the person or entity whose address is listed above. Any use of the
information contained herein in any way (including, but not limited to, total or partial
disclosure, reproduction, or dissemination) by persons other than the intended
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
phone or email immediately and delete it!
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message