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
Hi:

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
way,
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
etc.
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
protocol).

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.
[Company_logo]

Phone:
Fax:
Mobile:
Email:
地址:深圳市龙岗区坂田华为基地 邮编:518129
Huawei Technologies Co., Ltd.
Bantian, Longgang District,Shenzhen 518129, P.R.China
http://www.huawei.com
________________________________
本邮件及其附件含有华为公司的保密信息,仅限于发送给上面地址中列出的个人或群组。禁
止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、或散发)本邮件中
的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本邮件!
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
by
phone or email immediately and delete it!
Mime
  • Unnamed multipart/related (inline, None, 0 bytes)
View raw message