That's good, have done very similar, but went further to report the condition to
smsbox,
Easily done, so smsbox

read_messages_from_bearerbox(void)
...
                else if (msg_type(msg) == ack) {

                        if(msg->ack.nack == ack_mt_queue_full)
                        {
                                send_mt_queue_full = 1;
                                info(0,"msg ack: ack_mt_queue_full");
                        }
                        else if(msg->ack.nack == ack_mt_queue_ok)
                        {
                                send_mt_queue_full = 0;
                                info(0,"msg ack: ack_mt_queue_ok");
                        }
                        

So now smsbox_req_handle()
...
        if(send_mt_queue_full==1)
        {
                        Octstr * ocs = octstr_format("No Send. queue full;
[tid=%ld]",tid);


Can immediately report a queue full condition. We rather queue our messages in
MSMQ where they can be managed.


-----Original Message-----
From: Alexander Malysh [mailto:[EMAIL PROTECTED] 
Sent: 22 March 2007 21:42
To: [email protected]
Subject: [PATCH] bearerbox outgoing queue limit

Hi,

attached patch implements outgoing queue limit for bearerbox. Now bearerbox
doesn't have any outgoing queue limit and therefore it's even possible to
OOM bearerbox.

The outgoing queue limit is not strict but try to be so. Strict limit
implementation is possible but will have big performance impact because all
queues SMSCs and global have to be locked.

This implementation does following (if sms-outgoing-queue-limit is set):
1) by routing of mt message ensure that sum of all SMSC queues plus global
is bellow the limit (sms-outgoing-queue-limit). If limit exceeded then
message rejected with ack_failed_tmp.
2) if global queue is not empty than queue limit is splitted to 80% for the
new messages coming from smsbox and 20% for the old messages that coming
from global queue by retry. So we ensure that retry/old messages always
find place in the SMSC queue.

This implementation works very good in production for two years already.

Please review, test and vote.

-- 
Thanks,
Alex


Reply via email to