[ opensips-Patches-2694682 ] New network-based algorithm in RateLimit

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ opensips-Patches-2694682 ] New network-based algorithm in RateLimit

SourceForge.net
Patches item #2694682, was opened at 2009-03-19 17:24
Message generated for change (Settings changed) made by bogdan_iancu
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=2694682&group_id=232389

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: modules
Group: trunk
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Arnaud Boussus (aboussus)
>Assigned to: Ovidiu Sas (osas)
Summary: New network-based algorithm in RateLimit

Initial Comment:
Bugfixed signed/unsigned byte sign in ipAddress happening when shifting and ANDing with 0xFF mask and reading IP addresses bytes greater than 127.

Added exported function "snmp_pending_bytes" from SNMPStats to be used with ratelimit module to drop incoming SIP message when rx_queue gets too high.

This algorithm relies on information provided by network interfaces. Indeed, it uses an exported function from SMTPStats module to work
(snmp_pending_bytes). The total amount of bytes waiting to be consumed on all the network interfaces is retrieved once every timer_interval seconds.
If the returned amount exceeds the limit specified in the modparam, OpenSIPS starts dropping SIP messages sending a 503 error (the default
value whose default message is "Service Unavailable").

Ratelimit ModParam sample :
/* -- ratelimit -- */
modparam("ratelimit", "timer_interval", 1)
modparam("ratelimit", "queue", "0:INVITE")
modparam("ratelimit", "pipe", "0:NETWORK:10000")
modparam("ratelimit", "load_source", "network")

where, in the pipe definition, 10000 is the max size of rx_queue (in bytes) before starting to answer "Service unavailable" and "network"
is a new source used to sample data from (in addition to "cpu" source).


----------------------------------------------------------------------

>Comment By: Bogdan-Andrei Iancu (bogdan_iancu)
Date: 2009-03-25 08:48

Message:
Thanks to Ovidiu, the patch is on SVN.

----------------------------------------------------------------------

Comment By: Ovidiu Sas (osas)
Date: 2009-03-25 05:43

Message:
The patch in a modified version was integrated into the trunk branch of
opensips.
Please test and let me know if everything works as expected and after that
we can close this item.  Please close all the other items that were opened
with respect to this issue.

Later on I will commit some optimization to the ratelimit module.


Regards,
Ovidiu Sas

PS: It would be also interesting to add the ability to check the network
load per specific socket as opposed to all sockets.

----------------------------------------------------------------------

Comment By: Ovidiu Sas (osas)
Date: 2009-03-20 22:14

Message:
Actually, a better solution would be to move the relevant code from
snmpstats module into the core and make it accessible to other modules.  I
already have a patch that does that.
This will remove any dependency on the snmpstats module (there shouldn't
any module dependent on snmpstats).

The code is in frozen state right now.  After the 1.5 release we will see
how are we going to integrate this one.

Regards,
Ovidiu Sas

----------------------------------------------------------------------

Comment By: Arnaud Boussus (aboussus)
Date: 2009-03-20 18:08

Message:
Hello Ovidiu,

Thanks for answering my post.

I followed your suggestion and removed the SNMPStats dependency when not
using "network" algorithm within the ratelimit module.
I've submitted the related changes in a new patch.

Yet, I'm still considering applying your second suggestion in a near
future...

Thanks,
Arnaud.

----------------------------------------------------------------------

Comment By: Ovidiu Sas (osas)
Date: 2009-03-19 19:06

Message:
Hello Arnaud,

The patch looks interesting.  thanks for sharing it.
There is one issue: it creates a dependency on the snmpstats module.
Ratelimit should work even if the snmstats module is not loaded (not
everyone would want to load the snmpstats just to get basic ratelimit
functionality).
Can you please re-work the patch and upload a new version?
Only when "load_source" is set to "network" the snmp_binds should be
loaded.

Maybe the real solution here would be to create a new module on top of the
ratelimit module that will bind to the snmpstats and only this new module
will have the dependency on the snmpstats.  This should be a cleaner way to
add this new functionality.

Thanks,
Ovidiu Sas

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=1086412&aid=2694682&group_id=232389

_______________________________________________
Devel mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/devel