You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Kellner, Peter" <Pe...@PeterKellner.net> on 2005/05/13 03:14:11 UTC

Looking for way to constrain bandwidth from a tomcat servlet

I have a particular web page that hits a servlet and I'm finding that
certain users suck out huge bandwidth.  Does anyone know of any products
or open source projects that work with tomcat that will allow me to
"throttle" bandwidth to certain users based on some criteria?  (like
total bandwidth already consumed by that user).

 

Thanks,  -Peter


Re: Looking for way to constrain bandwidth from a tomcat servlet

Posted by Will Hartung <wi...@msoft.com>.
> From: "Kellner, Peter" <Pe...@PeterKellner.net>
> Sent: Thursday, May 12, 2005 6:14 PM


> I have a particular web page that hits a servlet and I'm finding that
> certain users suck out huge bandwidth.  Does anyone know of any products
> or open source projects that work with tomcat that will allow me to
> "throttle" bandwidth to certain users based on some criteria?  (like
> total bandwidth already consumed by that user).

Bandwidth is hard to manage at the application level, particularly with
proxies and what not potentially in the way, but you can measure actual data
sent for a user.

You can create a system using a Filter that monitors all of the data going
out of tomcat (and technically how long it takes, thus measuring actual
bandwidth).

You would hijack the stream used in the original request so you can monitor
to the traffic.

You can then move the data from the hijacked stream to the requests stream
as fast, or as slow, as you like (perhaps by throwing some Thread.sleep()
calls in the main "copy the stream" loop).

But be aware that while Thread.sleep takes milliseconds as a parameter, it
doesn't mean it actually supports full millisecond granularity (it may, but
you should test it and make sure), but it may only go as low as 10, or even
100 milliseconds.

You could also simply use the filter to "ban" the user from a specific
hungry resource if you like.

I'm sure there are other things like this, perhaps something for Apache.

Regards,

Will Hartung
(willh@msoft.com)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org