[PATCH] SMPP Throttling
Donald Jackson <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi everyone, Here is a patch I have created for SMPP throttling. To easily duplicate the bug you can take the following actions: -- Configure SMPP bind with very low throughput (ie: 0.1) -- Send 100 messages in quick succession What you can see from the debug output times is that when send_messages() is supposed to be sleeping for throttling purposes, it will get woken up by send_msg_cb()'s gwthread_wakeup(smpp->transmitter); call. This causes inaccuracy in the sleep time as the thread is prematurely woken up. This causes many throttling errors on high volume/load Kannel installations because of the increased throttling errors and the current default throttling sleep time which I see is being changed ;) My patch simply let's send_messages() indicate that it is sleeping for throttling purposes and shouldn't be woken up. Good luck! -- Donald Jackson http://www.ddj.co.za/ donaldjster(a)gmail.com
smpp_throttle_fix.patch
(application/octet-stream, 1.6 KB)
Index: gw/smsc/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.112
diff -u -w -r1.112 smsc_smpp.c
--- gw/smsc/smsc_smpp.c 29 Jan 2009 11:38:28 -0000 1.112
+++ gw/smsc/smsc_smpp.c 9 Feb 2009 06:21:00 -0000
@@ -153,6 +153,7 @@
int transmit_port;
int receive_port;
int quitting;
+ int throughput_sleeping;
long enquire_link_interval;
long max_pending_submits;
int version;
@@ -247,6 +248,7 @@
smpp->enquire_link_interval = enquire_link_interval;
smpp->max_pending_submits = max_pending_submits;
smpp->quitting = 0;
+ smpp->throughput_sleeping = 0;
smpp->version = version;
smpp->priority = priority;
smpp->validityperiod = validity;
@@ -1030,8 +1032,11 @@
/*
* obey throughput speed limit, if any.
*/
- if (smpp->conn->throughput > 0)
- gwthread_sleep(delay);
+ if (smpp->conn->throughput > 0) {
+ smpp->throughput_sleeping = 1;
+ gwthread_sleep_micro(delay);
+ smpp->throughput_sleeping = 0;
+ }
}
else { /* write error occurs */
smpp_pdu_destroy(pdu);
@@ -1951,7 +1956,14 @@
smpp = conn->data;
gw_prioqueue_produce(smpp->msgs_to_send, msg_duplicate(msg));
+ if(conn->throughput > 0) {
+ if(!smpp->throughput_sleeping) {
gwthread_wakeup(smpp->transmitter);
+ }
+ } else {
+ gwthread_wakeup(smpp->transmitter);
+ }
+
return 0;
}