users@grizzly.java.net

Re: glassfish v3 throttling

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 27 Oct 2009 12:28:38 -0400

Salut,

which GF version are you using?

Cam Bazz wrote:
> Hello Oleksiy,
>
> I am up to the challenge but I have no idea where to start. What is an
> interceptor, is it something like filter.
>
> The reason where I came up with this throttle thing is some people are
> attacking my glassfish, like sending 2000 requests per second, and i
> get an OOM and my glassfish crashes.

Oh! Can you share the server.log? The Interceptor API is defined here:

    * http://is.gd/4Euml

Mainly, this APi gets called after the request headers has been parsed.
That might be too late for you so that's why I would like to see some
stack trace I can help. It might be better to close connection as soon
as you accept them. In that case, you would like to extends the
TCPSelectorHandler:

   * http://is.gd/4EuBO

Specifically the onAccept method

   * http://is.gd/4EuDV

Now if we go that route I will need to do some work to allow you to
configure GF to use your TCPSelectorHandler. That's simple to do.

A+

--Jeanfrancois


>
> Best.
>
>
>
> On Tue, Oct 27, 2009 at 11:47 AM, Oleksiy Stashok
> <Oleksiy.Stashok_at_sun.com> wrote:
>> Hi,
>>
>>> How can I throttle requests per ip, say, max 10 requests per ip, or
>>> rather ip/useragent when I am using glassfish v3? I though grizzly had
>>> some built in mechanisms for that, but I could not figure out how to
>>> do it.
>> AFAIK we don't have such a mechanism. You can add it by implementing custom
>> HTTP com.sun.grizzly.util.Interceptor.
>>
>> WBR,
>> Alexey.
>>
>>> Best.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
>> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>