You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by colincrist <co...@hermesjms.com> on 2006/09/22 13:30:30 UTC

Limiting connection messages/bandwidth


Hi,

I'm looking for a way to configure/implement a throttle on the number of
messages a client (over any transport) can send or receive messages,
initially just by a rate (e.g. 10 per second) but possibly in the future by
bandwidth (e.g. 1G per day) based on users or remote IP addresses/ranges.

I would also be nice to be able to collect these statistics in reports.

I'm considering placing an broker on a publicly accesible server as a
default Hermes provider for new users to experiment with and would rather it
was not swamped :-) It could also be a good example of using SSL etc.

Any pointers to where in the codebase this could be implemented would be
very welcome.

Regards,

Colin.
http://hermesjms.com
-- 
View this message in context: http://www.nabble.com/Limiting-connection-messages-bandwidth-tf2317249.html#a6445301
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Limiting connection messages/bandwidth

Posted by Hiram Chirino <hi...@hiramchirino.com>.
On 9/22/06, James Strachan <ja...@gmail.com> wrote:
> On 9/22/06, colincrist <co...@hermesjms.com> wrote:
> >
> >
> > Hi,
> >
> > I'm looking for a way to configure/implement a throttle on the number of
> > messages a client (over any transport) can send or receive messages,
> > initially just by a rate (e.g. 10 per second) but possibly in the future by
> > bandwidth (e.g. 1G per day) based on users or remote IP addresses/ranges.
> >
> > I would also be nice to be able to collect these statistics in reports.
> >
> > I'm considering placing an broker on a publicly accesible server as a
> > default Hermes provider for new users to experiment with and would rather it
> > was not swamped :-) It could also be a good example of using SSL etc.
>
> Ah I understand :)
>
> > Any pointers to where in the codebase this could be implemented would be
> > very welcome.
>
> It should be relatively easy to add an interceptor to the broker to do
> this kinda thing...
>
> http://incubator.apache.org/activemq/interceptors.html
>
> where you could overload the send() method and keep around counts for
> the messages/message sizes per connection/session/producer whatever

Agreed.. The coupled with user security so that users need a valid
userid/password would also allow you to track usage to a specific
user.  If there were any limits exceeded your custom broker plugin
could (1) disconnect the user and (2) send a message to queue that
disabled the user account.

> you want. The only real question is what to do if a user exceeds their
> quota - close them?
>

Yeah. and disable the account.  So that subsequent connect fails too :)

> --
>
> James
> -------
> http://radio.weblogs.com/0112098/
>


-- 
Regards,
Hiram

Blog: http://hiramchirino.com

Re: Limiting connection messages/bandwidth

Posted by James Strachan <ja...@gmail.com>.
On 9/22/06, colincrist <co...@hermesjms.com> wrote:
> Thanks, I'll take a closer look in there.
>
> > The only real question is what to do if a user exceeds their quota - close
> > them?
>
> Mostly likely, yes, although it would be nice to get an exception back to
> the client with a "Your quota for this broker has been exceeded" message
> first.

Yeah - you could just send the client an advisory message, block it
from sending for a short time or just kill it - maybe a combination of
all 3 depending on how naughty the producer is :)

-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Limiting connection messages/bandwidth

Posted by colincrist <co...@hermesjms.com>.

Thanks, I'll take a closer look in there.

> The only real question is what to do if a user exceeds their quota - close
> them?

Mostly likely, yes, although it would be nice to get an exception back to
the client with a "Your quota for this broker has been exceeded" message
first.

Regards,

Colin.
http://hermesjms.com
-- 
View this message in context: http://www.nabble.com/Limiting-connection-messages-bandwidth-tf2317249.html#a6445468
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Limiting connection messages/bandwidth

Posted by James Strachan <ja...@gmail.com>.
On 9/22/06, colincrist <co...@hermesjms.com> wrote:
>
>
> Hi,
>
> I'm looking for a way to configure/implement a throttle on the number of
> messages a client (over any transport) can send or receive messages,
> initially just by a rate (e.g. 10 per second) but possibly in the future by
> bandwidth (e.g. 1G per day) based on users or remote IP addresses/ranges.
>
> I would also be nice to be able to collect these statistics in reports.
>
> I'm considering placing an broker on a publicly accesible server as a
> default Hermes provider for new users to experiment with and would rather it
> was not swamped :-) It could also be a good example of using SSL etc.

Ah I understand :)

> Any pointers to where in the codebase this could be implemented would be
> very welcome.

It should be relatively easy to add an interceptor to the broker to do
this kinda thing...

http://incubator.apache.org/activemq/interceptors.html

where you could overload the send() method and keep around counts for
the messages/message sizes per connection/session/producer whatever
you want. The only real question is what to do if a user exceeds their
quota - close them?

-- 

James
-------
http://radio.weblogs.com/0112098/