Re: [sip-overload] draft-ietf-soc-overload-control-07 section 6.3 algorithm

Adam Roach <adam@nostrum.com> Thu, 08 March 2012 21:29 UTC

Return-Path: <adam@nostrum.com>
X-Original-To: sip-overload@ietfa.amsl.com
Delivered-To: sip-overload@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 3499D21F8550 for <sip-overload@ietfa.amsl.com>; Thu, 8 Mar 2012 13:29:06 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -102.507
X-Spam-Level:
X-Spam-Status: No, score=-102.507 tagged_above=-999 required=5 tests=[AWL=0.093, BAYES_00=-2.599, SPF_PASS=-0.001, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id cn0HnLcZR9EQ for <sip-overload@ietfa.amsl.com>; Thu, 8 Mar 2012 13:29:01 -0800 (PST)
Received: from nostrum.com (nostrum-pt.tunnel.tserv2.fmt.ipv6.he.net [IPv6:2001:470:1f03:267::2]) by ietfa.amsl.com (Postfix) with ESMTP id DDDD721F853D for <sip-overload@ietf.org>; Thu, 8 Mar 2012 13:28:56 -0800 (PST)
Received: from dn3-228.estacado.net (vicuna-alt.estacado.net [75.53.54.121]) (authenticated bits=0) by nostrum.com (8.14.3/8.14.3) with ESMTP id q28LSq41034150 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Thu, 8 Mar 2012 15:28:52 -0600 (CST) (envelope-from adam@nostrum.com)
Message-ID: <4F592494.2030207@nostrum.com>
Date: Thu, 08 Mar 2012 15:28:52 -0600
From: Adam Roach <adam@nostrum.com>
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2
MIME-Version: 1.0
To: "Vijay K. Gurbani" <vkg@bell-labs.com>
References: <D05CF57C-B7B8-4187-BF55-70426DB3762D@estacado.net> <4F57B393.3020702@nostrum.com> <4F58F595.9070107@bell-labs.com> <4F58FACB.2020602@nostrum.com> <4F5902D9.1080006@bell-labs.com> <4F5904A0.5090709@nostrum.com> <4F5908C1.8060709@bell-labs.com> <4F5910BE.2010505@nostrum.com> <4F591621.7040805@bell-labs.com>
In-Reply-To: <4F591621.7040805@bell-labs.com>
Content-Type: text/plain; charset="ISO-8859-1"; format="flowed"
Content-Transfer-Encoding: 7bit
Received-SPF: pass (nostrum.com: 75.53.54.121 is authenticated by a trusted mechanism)
Cc: sip-overload@ietf.org
Subject: Re: [sip-overload] draft-ietf-soc-overload-control-07 section 6.3 algorithm
X-BeenThere: sip-overload@ietf.org
X-Mailman-Version: 2.1.12
Precedence: list
List-Id: SIP Overload <sip-overload.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/sip-overload>, <mailto:sip-overload-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/sip-overload>
List-Post: <mailto:sip-overload@ietf.org>
List-Help: <mailto:sip-overload-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/sip-overload>, <mailto:sip-overload-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 08 Mar 2012 21:29:07 -0000

On 3/8/12 2:27 PM, Vijay K. Gurbani wrote:
> I'd respectfully urge you one more time to see if you can make sense
> with the context that get_sip_msg() picks up the next SIP message from
> its processing queue to focus on the overload control part.  But if
> that is still not clear, then I am open to suggestions on how to
> proceed.  I can work with you to break this up into two processing
> loops and see if they make things more understandable.

If you're really concerned about the concurrency implications of showing 
this as two different loops, I'm okay collapsing it into a single loop 
servicing a work queue. But we really need to be clear about where the 
messages are coming from.

I think you really do want to show something that works for both user 
agents and for proxies. I don't think most implementors will be able to 
adapt what you have right now into something applicable to user agents. 
On the other hand, if you split things up to handle message receipt 
separately from message sending, then use in a user agent context 
becomes much clearer.

What's nice about doing it that way is that it allows you to completely 
ignore the complexities of proxy message handling (e.g. forking) by 
hiding them behind the "process_msg" function.

So, here's what I propose. It's based heavily on your most recent code, 
but it handles inbound and outbound messages separately and explains 
where the SIP messages are coming from:

cat1 := 80.0         // Category 1 --- subject to reduction
cat2 := 100.0 - cat1 // Category 2 --- Not subject to reduction
                      // 80/20 mix.


while (true)
{
   // We're modeling message processing as a single work queue
   // that contains both incoming and outgoing messages.
   sip_msg := get_next_message_from_work_queue()

   switch (sip_msg.type) {

     case outbound request:
       destination := get_next_hop(sip_msg)
       oc_context := get_oc_context(destination)

       if (oc_context == null)  {
           send_to_network(sip_msg) // Process it normally by sending the
           // request to the next hop since this particular destination
           // is not subject to overload
       }
       else  {
          // Determine if server wants to enter in overload or is in
          // overload
          in_oc := extract_in_oc(oc_context)

          oc_value := extract_oc(oc_context)
          oc_validity := extract_oc_validity(oc_context)

          if (in_oc == false or oc_validity is not in effect)  {
             send_to_network(sip_msg) // Process it normally by sending the
              // request to the next hop since this particular destination
              // is not subject to overload.  Optionally, clear
              // the oc context for this server (not shown).
          }
          else  {
             category := assign_msg_to_category(sip_msg)
             drop_msg := false
             pct_to_reduce := min(100, oc_value / cat1 * 100)

             r := random()
             if (r <= pct_to_reduce)  {
                drop_msg := true
             }

             if (category == cat2 && drop_msg == true)  {
                if (local_policy(sip_msg, oc_value) says process message) {
                    drop_msg := 0  // See Note 1 below
                }
             }

             if (drop_msg == false) {
                 send_to_network(sip_msg) // Process it normally by sending
                // the request to the next hop
             }
             else  {
                // Do not send request downstream, handle locally by
                // generating response (if a proxy) or treating as
                // an error (if a user agent).
             }
          }
       }

     end case // outbound request

     case outbound response:
       if (we are in overload) {
         add_overload_parameters(sip_msg)
       }
       send_to_network(sip_msg)

     end case // outbound response

     case inbound response:

        if (sip_msg has oc parameter values)  {
            create_or_update_oc_context()  // For the specific server
            // that sent the response, create or update the oc context;
            // i.e., extract the values of the oc-related parameters
            // and store them for later use.
        }
        process_msg(sip_msg)

     end case // inbound response

     case inbound request:

        if (sip_msg does not have oc parameter values &&
            we are in overload)  {
          r := random()
          if (r <= our overload metric that we're advertising) {
            send_response(sip_msg, 503)
          }
          else {
            process_msg(sip_msg)
          }

        }

     end case // inbound request


   }
}

I have at least one other major issue I think needs to be fixed, but I 
don't want to throw it into the mix until we have preliminary agreement 
on how we break up the processing.

/a