Telling senders to back off on overloaded server?

Norman Maurer norman.maurer at googlemail.com
Thu Oct 27 06:40:02 EDT 2011


I think for your needs the setReadable(false) should be good enough.

Bye,
Norman


2011/10/27 Kevin Burton <burtonator at gmail.com>:
> Ah... so what I really need to do is have a queue that accepts these but
> DOES NOT block on capacity ... it would instead block setReadable( false )
> when the capacity is hit but still accept writes which go into the buffer.
>
> 2011/10/25 Norman Maurer <norman.maurer at googlemail.com>
>>
>> Just be aware that this will only prevent future reads. Everything
>> that is already in the "queue" will get dispatched to your
>> ChannelHandler.
>>
>> Bye,
>> Norman
>>
>>
>> 2011/10/26 Kevin Burton <burtonator at gmail.com>:
>> > Brilliant... that's what I thought :)
>> >
>> > Kevin
>> >
>> > On Tue, Oct 25, 2011 at 4:45 PM, "이희승 (Trustin Lee)" <trustin at gmail.com>
>> > wrote:
>> >>
>> >> Channel.setReadable(false)?
>> >>
>> >> Kevin Burton wrote:
>> >> > So how do you do this at the TCP layer and not use threads within
>> >> > Netty...
>> >> >
>> >> > You should be able to tell netty to not read from the socket even if
>> >> > it is available because you're not yet ready for the data.
>> >> >
>> >> > This way all TCP protocols will work the same way without application
>> >> > specific changes or controlling the client.
>> >> >
>> >> > Otherwise you have to use lots of threads which defeats the whole
>> >> > point :-(
>> >> >
>> >> > Kevin
>> >> >
>> >> > On Tue, Oct 25, 2011 at 4:23 PM, "이희승 (Trustin Lee)"
>> >> > <trustin at gmail.com <mailto:trustin at gmail.com>> wrote:
>> >> >
>> >> >     Yes.  If you have more control over the behavior of the client, I
>> >> >     would make use of 100-continue, and send an error response when
>> >> >     the server is under load.
>> >> >
>> >> >     HTH
>> >> >
>> >> >
>> >> >     Kevin Burton wrote:
>> >> >     > I assume I basically have to change interest ops on the channel
>> >> >     when
>> >> >     > the buffer is empty/full?
>> >> >     >
>> >> >     > Kevin
>> >> >     >
>> >> >     > On Tue, Oct 25, 2011 at 4:18 PM, Kevin Burton
>> >> >     <burtonator at gmail.com <mailto:burtonator at gmail.com>
>> >> >     > <mailto:burtonator at gmail.com <mailto:burtonator at gmail.com>>>
>> >> > wrote:
>> >> >     >
>> >> >     >     How do I tell the sender of data (I control both) to back
>> >> >     off if I
>> >> >     >     can't accept any more data on the server?
>> >> >     >
>> >> >     >     Specifically, I have an HTTP PUT implementation that first
>> >> >     writes
>> >> >     >     to a queue and then I drain the queue to disk.
>> >> >     >
>> >> >     >     When the queue fills up because the server is overloaded, I
>> >> >     need a
>> >> >     >     way to tell the sender to back off...
>> >> >     >
>> >> >     >     Normally the TCP buffers would just fill up on both ends
>> >> > and
>> >> > the
>> >> >     >     sender wouldn't receive ACKs any more and wouldn't send
>> >> > more
>> >> >     >     packets until the existing ones have been ack'd ...
>> >> >     >
>> >> >     >     I just don't now how to tell Netty to stop sending me data
>> >> >     because
>> >> >     >     I can't handle it...
>> >> >     >
>> >> >     >     I don't want to use any threads in my application if
>> >> > they're
>> >> > not
>> >> >     >     needed.
>> >> >     >
>> >> >     >
>> >> >     > _______________________________________________
>> >> >     > netty-users mailing list
>> >> >     > netty-users at lists.jboss.org
>> >> > <mailto:netty-users at lists.jboss.org>
>> >> >     > https://lists.jboss.org/mailman/listinfo/netty-users
>> >> >
>> >> >     _______________________________________________
>> >> >     netty-users mailing list
>> >> >     netty-users at lists.jboss.org <mailto:netty-users at lists.jboss.org>
>> >> >     https://lists.jboss.org/mailman/listinfo/netty-users
>> >> >
>> >> >
>> >> > _______________________________________________
>> >> > netty-users mailing list
>> >> > netty-users at lists.jboss.org
>> >> > https://lists.jboss.org/mailman/listinfo/netty-users
>> >> _______________________________________________
>> >> netty-users mailing list
>> >> netty-users at lists.jboss.org
>> >> https://lists.jboss.org/mailman/listinfo/netty-users
>> >
>> >
>> > _______________________________________________
>> > netty-users mailing list
>> > netty-users at lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/netty-users
>> >
>>
>> _______________________________________________
>> netty-users mailing list
>> netty-users at lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/netty-users
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>



More information about the netty-users mailing list