You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by Niklas Therning <ni...@trillian.se> on 2005/10/31 22:09:30 UTC

[mina] Traffic control implementation

Hi,

I have attached a diff against the current trunk which contains my shot
at implementing traffic control. I have concentrated on TCP connections
so the suspend/resume/Read/Write methods have been added to
SocketSession for now. Please let me know what you think of the code and
if you have any idea on how to test this. I have tested
suspending/resuming read operations in our application and it seems to
be working just fine. But I would really like to write a TestCase
testing suspending/resuming reads and writes.

/Niklas


Re: [mina] Traffic control implementation

Posted by Trustin Lee <tr...@gmail.com>.
2005/11/3, Niklas Therning <ni...@trillian.se>:
>
> One thought though. Would it still be possible to have suspendRead/Write
> and resumeRead/Write methods on IoSession? To do the equivalent of
> suspendRead() now without touching the write bit in the mask I would
> have to do:
>
> session.setTrafficMask(session.getTrafficMask().and(TrafficMask.READ.not
> ()));
>
> and to resumeRead():
>
> session.setTrafficMask(session.getTrafficMask().or(TrafficMask.READ));


Actually I was considering to do so. Now I checked in the shortcut methods.

Cheers,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Re: [mina] Traffic control implementation

Posted by Niklas Therning <ni...@trillian.se>.
Trustin Lee wrote:

> I've just applied your patch, and added an additional check to
> SocketSessionManagerFilterChain.  Here's the summary of changes:
>
> http://svn.apache.org/viewcvs?rev=330182&view=rev
> <http://svn.apache.org/viewcvs?rev=330182&view=rev>
>
> <http://gleamynode.net/>

Great! Thanks!

One thought though. Would it still be possible to have suspendRead/Write
and resumeRead/Write methods on IoSession? To do the equivalent of
suspendRead() now without touching the write bit in the mask I would
have to do:

session.setTrafficMask(session.getTrafficMask().and(TrafficMask.READ.not()));

and to resumeRead():

session.setTrafficMask(session.getTrafficMask().or(TrafficMask.READ));

It would be nice to have those shortcuts for these common operations.

/Niklas


Re: [mina] Traffic control implementation

Posted by Trustin Lee <tr...@gmail.com>.
I've just applied your patch, and added an additional check to
SocketSessionManagerFilterChain. Here's the summary of changes:

http://svn.apache.org/viewcvs?rev=330182&view=rev

Thanks,
Trustin
--
what we call human nature is actually human habit
--
http://gleamynode.net/

Re: [mina] Traffic control implementation

Posted by Trustin Lee <tr...@gmail.com>.
Hi Niklas,

I looked into your patch, but I found a problem that it doesn't throttle
write requests. I guess we shouldn't call flush(SocketSessionImpl) if the
mark doesn't contain OP_WRITE. WDYT?

Cheers,
Trustin

2005/11/1, Niklas Therning <ni...@trillian.se>:
>
> Hi,
>
> I have attached a diff against the current trunk which contains my shot
> at implementing traffic control. I have concentrated on TCP connections
> so the suspend/resume/Read/Write methods have been added to
> SocketSession for now. Please let me know what you think of the code and
> if you have any idea on how to test this. I have tested
> suspending/resuming read operations in our application and it seems to
> be working just fine. But I would really like to write a TestCase
> testing suspending/resuming reads and writes.
>
> /Niklas
>
>
>
>


--
what we call human nature is actually human habit
--
http://gleamynode.net/