FW: smppbox bulk sms: slow reception from a client

"Rene Kluwen" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Sorry, forgot to copy the list.

-----Original Message-----
From: Rene Kluwen [mailto:[email protected]] 
Sent: Sunday, 22 August, 2010 20:53
To: 'Hillel Bilman'; 'Davit Mirzoyan'; 'Alvaro Cornejo'; 'Nikos Balkanas';
'[email protected]'
Subject: RE: smppbox bulk sms: slow reception from a client

For the ones who are worried about smppbox performance. Here is something
that I believe in better than the queue implementation (like in my earlier
post of today).

At some point in time, I made smppbox wait for a bearerbox ack before
acknowledging the message back to the ESME and vice versa. In the following
patch, I turned that back again. I immediately acknowledge the message,
irregardless what it's relaying status later is going to be.

If you have problems with smppbox and/or slow performance, this patch might
be for you. I made the patch in such a manner that it is easy to make a
configuration option for this, in a later stage.

Please test.

== Rene


-----Original Message-----
From: Hillel Bilman [mailto:[email protected]]
Sent: Sunday, 22 August, 2010 18:59
To: [email protected]
Cc: [email protected]
Subject: RE: smppbox bulk sms: slow reception from a client

Thanks for the update and to Chimit for smppbox in general.

To take up the discussion from the user group, you mentioned a great idea to
have another set of queues that smppbox only uses. 
To add to this, it would be great to have the same set of queues where you
can set priority and range 0-3 is allowed.  Then this prevents your smppbox
flooding bearer box and also you can far more easily isolate problems from
smppbox.

Regards
smppbox_direct_acks_1.patch (application/octet-stream, 3.4 KB)
Index: gw/smppbox.c
===================================================================
--- gw/smppbox.c	(revision 47)
+++ gw/smppbox.c	(working copy)
@@ -114,6 +114,7 @@
 static int smpp_autodetect_addr = 0;
 static long smpp_dest_addr_ton = -1;
 static long smpp_dest_addr_npi = -1;
+static long smpp_direct_acks = 1;
 
 static Octstr *smppbox_id;
 static Octstr *our_system_id;
@@ -1487,10 +1488,13 @@
 					octstr_destroy(msg2->sms.service);
 					msg2->sms.service = hold_service;
 				}
-				uuid_unparse(msg2->sms.id, id);
-				msgid = octstr_create(id);
-				dict_put(box->msg_acks, msgid, resp);
-				resp = NULL;
+				if (!smpp_direct_acks) {
+					uuid_unparse(msg2->sms.id, id);
+					msgid = octstr_create(id);
+					dict_put(box->msg_acks, msgid, resp);
+					octstr_destroy(msgid);
+					resp = NULL;
+				}
 				send_msg(box->bearerbox_connection, box, msg2);
 				if (parts_list) {
 					/* destroy values */
@@ -1528,11 +1532,13 @@
 					octstr_destroy(msg2->sms.service);
 					msg2->sms.service = hold_service;
 				}
-				uuid_unparse(msg2->sms.id, id);
-				msgid = octstr_create(id);
-				dict_put(box->msg_acks, msgid, resp);
-				octstr_destroy(msgid);
-				resp = NULL;
+				if (!smpp_direct_acks) {
+					uuid_unparse(msg2->sms.id, id);
+					msgid = octstr_create(id);
+					dict_put(box->msg_acks, msgid, resp);
+					octstr_destroy(msgid);
+					resp = NULL;
+				}
 				send_msg(box->bearerbox_connection, box, msg2);
 				if (parts_list) {
 					/* destroy values */
@@ -1542,18 +1548,20 @@
 		}
 		break;
 	case deliver_sm_resp:
-		msgid = octstr_format("%ld", pdu->u.deliver_sm_resp.sequence_number);
-		mack = dict_get(box->deliver_acks, msgid);
-		if (mack) {
-			msg = msg_duplicate(mack);
-			/* TODO: ack_failed_tmp */
-			if (pdu->u.deliver_sm_resp.command_status != 0) {
-				msg->ack.nack = ack_failed;
+		if (!smpp_direct_acks) {
+			msgid = octstr_format("%ld", pdu->u.deliver_sm_resp.sequence_number);
+			mack = dict_get(box->deliver_acks, msgid);
+			if (mack) {
+				msg = msg_duplicate(mack);
+				/* TODO: ack_failed_tmp */
+				if (pdu->u.deliver_sm_resp.command_status != 0) {
+					msg->ack.nack = ack_failed;
+				}
+				send_msg(box->bearerbox_connection, box, msg);
+				dict_put(box->deliver_acks, msgid, NULL);
 			}
-			send_msg(box->bearerbox_connection, box, msg);
-			dict_put(box->deliver_acks, msgid, NULL);
+			octstr_destroy(msgid);
 		}
-		octstr_destroy(msgid);
 		break;
 	case unbind_resp:
 		box->logged_in = 0;
@@ -1780,7 +1788,7 @@
             msg_destroy(msg);
             continue;
         }
-	if (msg_type(msg) == ack) {
+	if (msg_type(msg) == ack && !smpp_direct_acks) {
 	    uuid_unparse(msg->ack.id, id);
 	    msgid = octstr_create(id);
 	    pdu = dict_get(box->msg_acks, msgid);
@@ -1902,9 +1910,14 @@
 		if (pdulist != NULL) {
 			while ((pdu = gwlist_extract_first(pdulist)) != NULL) {
 				if (NULL == msgid) {
-					/* Put ack in dict. We will send it as soon as we received a deliver_sm_resp */
 					msgid = octstr_format("%ld", pdu->u.deliver_sm.sequence_number);
-					dict_put(receiver_box->deliver_acks, msgid, mack);
+					if (smpp_direct_acks) {
+						send_msg(receiver_box->bearerbox_connection, receiver_box, mack);
+					}
+					else {
+						/* Put ack in dict. We will send it as soon as we received a deliver_sm_resp */
+						dict_put(receiver_box->deliver_acks, msgid, mack);
+					}
 				}
 				send_pdu(receiver_box->smpp_connection, box->boxc_id, pdu);
 				smpp_pdu_destroy(pdu);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.