Getting total bandwidth currently utilized in an iRule
Hope someone can help.
I have finite internet bandwidth available. There are times when there are too many incoming user requests. I would like to turn away new users (new login requests) based on the amount of internet bandwidth that is already utilized.
I can think of the following ways to achieve this - but they all get stuck at one point - my iRule needs to know the total bandwidth being utilized so that it can flash the "server busy" page to new users.
Method 1
A simple virtual server with the iRule attached. The iRule can compare the current bandwidth (incoming or outgoing) being utilized by this virtual server. If it is greater than my a pre-defined threshold, the iRule will respond with a "Server Busy" message. This way, new users will not get into the system while users already logged-in will continue to get good experience.
Method 2
Apply a Rate Class to the virtual server. This will ensure the pre-defined bandwidth limit is not exceeded. But unless the above mentioned iRule is applied, new users as well as already-logged-in users will see deteriorating performance.
To make the iRule work, I would need to know the cumulative bandwidth being consumed by all connections that have this Rate Class applied.
Method 3
Very similar to Method 2 - but using Bandwidth Controller instead. Same problem - need to know the cumulative bandwidth being utilized by all connections that have this Bandwidth Controller applied.
I was hoping the BWC class would have the required information available directly.
thanks,
MM