<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-caulfield-cdni-rate-pacing-01"
     ipr="trust200902">
  <front>
    <title abbrev="CDNI Rate Pacing">CDNI Rate Pacing</title>

    <author fullname="Matt Caulfield" initials="M." surname="Caulfield">
      <organization>Cisco Systems</organization>

      <address>
        <postal>
          <street>1414 Massachusetts Ave</street>

          <city>Boxborough</city>

          <code>01719</code>

          <region>MA</region>

          <country>USA</country>
        </postal>

        <phone>+1 978 936 9307</phone>

        <email>mcaulfie@cisco.com</email>
      </address>
    </author>

    <date />

    <abstract>
      <t>Rate pacing is a class of network traffic shaping which limits the
      transmission rate of data over a network. This document defines CDNI
      extensions for downstream CDNs to support rate pacing on behalf of
      upstream CDNs.</t>
    </abstract>

    <note title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in <xref
      target="RFC2119">RFC 2119</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>Rate pacing is a class of network traffic shaping which limits the
      transmission rate of data over a network. In the context of a Content
      Delivery Network (CDN), rate pacing provides an important business
      advantage to a Content Service Provider (CSP) by ensuring that a CDN
      which is delivering content on behalf of that CSP does not deliver
      significantly more data than necessary to an end client. </t>

      <t>For example, suppose an end client is watching some Constant Bit Rate
      (CBR) video encoded at 1500 kbps. In the absence of rate pacing, the CDN
      delivering this content may send it to the client at 3000 kbps. If the
      client chooses to terminate the session before watching the entire
      video, up to half the transmitted data is wasted. This waste leads to
      unnecessary cost for the CSP and diminished useful capacity for the
      CDN.</t>

      <t>Rate pacing requires configuration on a per-content basis. In order
      to enable rate pacing in a CDNI environment, the CDNI interfaces need to
      be extended to optionally support this feature.</t>

      <t>This document describes:<list style="numbers">
          <t>CDNI interface extensions required for supporting rate pacing</t>
          <t>a token bucket rate pacing algorithm for CDNs</t>
        </list></t>
    </section>

    <section anchor="impact" title="CDNI Interfaces Impact">
      <section title="Footprint &amp; Capabilities Interface">
        <t><xref
        target="I-D.ietf-cdni-footprint-capabilities-semantics"></xref>defines
        the CDNI Footprint and Capabilities semantics. But at the time of
        writing, no FCI syntax specification has been accepted as a working
        group document. </t>

        <t><xref
        target="I-D.ietf-cdni-footprint-capabilities-semantics"></xref>states
        that:&nbsp;</t>

        <t>"The CDNI FCI specification SHOULD define the registry (and the
        rules for adding new entries to the registry) for the different
        capability types. Each capability type MAY further have a list of
        valid values. The individual CDNI interface specifications which
        define a given capability SHOULD define any necessary registries (and
        the rules for adding new entries to the registry) for the values
        advertised for a given capability type."</t>

        <t>This document defines a new capability type:
        &ldquo;RatePacing&rdquo; to be added to the FCI capability types
        registry. The value of this capability contains one or more rate 
        pacing algorithm names from the <xref target="algoreg">Rate Pacing algorithms registry</xref>.
        For example, the value may be &ldquo;token-bucket/v1&rdquo; to indicate 
        that the advertising CDN supports the token bucket algorithm described
        later in this document.
        </t>

        <t>A CDN MAY advertise the &ldquo;RatePacing&rdquo; capability in the
          FCI if it implements this specification and at least one rate pacing algorithm
          registered in the Rate Pacing algorithms registry.</t>
      </section>

      <section title="Metadata Interface">
        <t>A new RatePacing metadata object is defined to represent the
        configuration for rate pacing. The RatePacing object has MIME type
        &ldquo;application/cdni.RatePacing.v1&rdquo;. RatingPacing MAY appear
        within the metadata list of either HostMetadata or PathMetadata (i.e.
        may have either host-level scope or a path-level scope). The following
        section defines the properties of the RatingPacing object.</t>

        <section title="RatePacing Metadata">
          <t>The presence of the RatePacing Metadata indicates that a dCDN
            MUST comply with this specification in order to deliver a piece of content. The
            metadata indicates the rate pacing algorithm name required for delivering 
            the content and the relevant parameters for that algorithm.
          </t>

          <t><list style="empty">
              <t>Property: algo<list style="empty">
                  <t>Description: Rate pacing algorithm name from the Rate Pacing Algorithms
                    registry. Dictates the structure of the &ldquo;params&rdquo; value. For example,
                    &ldquo;token-bucket./v1&rdquo;.</t>

                  <t>Type: String</t>

                  <t>Mandatory-to-Specify: Yes.</t>
                </list></t>

              <t>Property: params<list style="empty">
                  <t>Description: An object containing algorithm-specific properties and
                    values which are relevant to the rate 
                    pacing algorithm specified by the &ldquo;algo&rdquo; property. Each
                  algorithm dictates its own parameters.</t>

                  <t>Type: Object</t>

                  <t>Mandatory-to-Specify: Yes.</t>
                </list></t>
            </list></t>
        </section>
      </section>

      <section title="Request Routing Redirection Interface">
        <t>The RRI is not impacted by rate pacing. However, if the metadata for 
          a piece of content indicates that rate pacing is required by the uCDN, 
          then a request router should only redirect requests for that content 
          to CDNs which advertise &ldquo;RatePacing&rdquo; as a capability. The request router
          should also limit its choice of dCDNs to those which advertise the same 
          rate pacing algorithm as is specified by the rate pacing metadata.</t>
        <t>For example, if the metadata for a piece of content includes a
          GenericMetadata object of type &ldquo;application/cdni.RatePacing.v1&rdquo;
          and the &ldquo;algo&rdquo; property in the value of that GenericMetadata is
          &ldquo;token-bucket/v1&rdquo;, then the request router of the uCDN should only
          redirect requests for that piece of content to dCDNs which advertise a capability
          type of &ldquo;RatePacing&rdquo; and a capability value of &ldquo;token-bucket/v1&rdquo;.
        </t>
      </section>

      <section title="Logging Interface">
        <t>The rate at which a piece of content was delivered MAY be indicated
        via the LI. The &ldquo;sc-rate&rdquo; field indicates the rate in
        bytes per second as a decimal number. The bytes measured should
        correspond to the sc-entity-bytes field.</t>

        <t><list style="empty">
            <t>sc-rate:<list style="empty">
                <t>format: DEC</t>

                <t>field value: the average rate in bytes per second at which
                a response was delivered from Surrogate to client.</t>

                <t>occurence: there MUST be zero or exactly one instances of
                this field.</t>
              </list></t>
          </list></t>

          <t>Note that existing fields defined by <xref target="I-D.ietf-cdni-logging"></xref>
            include the bytes delivered and the time taken to service a request. However, the time
            taken includes the acquisition latency which is not relevant to rate pacing.
          </t>
      </section>

      <section title="Control Interface">
        <t>The CI is not impacted by rate pacing.</t>
      </section>
    </section>

    <section anchor="algo" title="Rate Pacing Algorithm">
      <t>Token bucket is one example of a rate pacing algorithm. This document
        extends the CDNI interfaces with generic support for rate pacing and
        registers token bucket as a rate pacing algorithm for CDNI.
        
        Other algorithms MAY be defined but are beyond the scope of this document. 
        Token bucket is described by
      <xref target="RFC1363"></xref>. </t>

      <t>The token bucket algorithm is characterized by two parameters:<list
          style="numbers">
          <t>Rate &ndash; the number of tokens added to the bucket per
          second</t>

          <t>Size &ndash; the maximum number of tokens in the bucket</t>
        </list></t>

        <t>For the purpose of this document, each token represents one byte.</t>

        <t>The algorithm name &ldquo;token-bucket/v1&rdquo; is registered as a Rate
          Pacing algorithm. This algorithm name may appear as the value of the &ldquo;RatePacing&rdquo;
          capability. This name may also appear as the value of the &ldquo;algo&rdquo; property in the
          &ldquo;RatePacing&rdquo; metadata object. 
        </t>

        <t>If a RatePacing metadata object's &ldquo;algo&rdquo; value is &ldquo;token-bucket/v1&rdquo;
          then the metadata object's &ldquo;params&rdquo; is an object of type TokenBucketParams, described below.
        </t>

        <section anchor="tokenbucketparams" title="TokenBucketParams Object">
          <t><list style="empty">
              <t>Property: rate<list style="empty">
                  <t>Description: Rate of tokens per second to be added to the
                  bucket as described by the token bucket algorithm. This
                  value MUST be a positive integer. Each token represents one
                  byte.</t>

                  <t>Type: Integer</t>

                  <t>Mandatory-to-Specify: Yes.</t>
                </list></t>

              <t>Property: size<list style="empty">
                  <t>Description: Maximum number of tokens per bucket as
                  described by the token bucket algorithm. This value MUST be
                  a positive integer.</t>

                  <t>Type: Integer</t>

                  <t>Mandatory-to-Specify: Yes.</t>
                </list></t>
            </list></t>
          </section>

          <section title="Token Bucket Metadata Example">
            <t><figure>
                <artwork><![CDATA[{
    "metadata": [
    {
      "type": "application/cdni.RatePacing.v1",
      "value": {
        "algo": "token-bucket/v1",
        "params": {
          "rate": 100000,
          "size": 25000
        }
      }
    }
  ]
}]]></artwork>
              </figure></t> 
          </section>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document requests the following of IANA:</t>

      <t>Addition of RatePacing in the CDNI Capability Registry defined in TBD.</t>

      <t>Addition of &ldquo;RatePacing&rdquo; to the standard partition of the CDNI 
        GenericMetadata Type Registry defined in <xref target="I-D.ietf-cdni-metadata"></xref>:
      </t>
        <texttable>
          <ttcol align="left">Type name</ttcol>
          <ttcol align="left">Specification</ttcol>
          <ttcol align="left">Version</ttcol>
          <ttcol align="left">MTE</ttcol>
          <ttcol align="left">STR</ttcol>

          <c>RatePacing</c>
          <c>RFCthis</c>
          <c>1</c>
          <c>true</c>
          <c>true</c>
        </texttable>

      <t>Addition of &ldquo;sc-rate&rdquo; in the CDNI Logging Field Names Registry defined
        in <xref target="I-D.ietf-cdni-logging"></xref>.</t>

      <section anchor="algoreg" title="CDNI Rate Pacing Algorithms Registry">
        <t>
          IANA is requested to create new registry, CDNI Rate Pacing Algorithms. The following
          table defines the initial values of the registry:
        </t>
        <texttable>
          <ttcol align="left">Algorithm Name</ttcol>
          <ttcol align="left">Specification</ttcol>
          <ttcol align="left">Version</ttcol>
          <c>token-bucket</c>
          <c>RFCthis</c>
          <c>1</c>
        </texttable>
        <t>
          New rate pacing algorithm registrations SHOULD specify RatePacing parameter objects as shown in
          <xref target="tokenbucketparams"></xref> and SHOULD describe the algorithm for rate pacing.
        </t>
      </section>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>A malicious CSP might attempt to use rate pacing to instruct a dCDN
        to delivery some content at a very low rate thereby in order to exhaust
        the resources of a dCDN by forcing connection state to be maintained for
        longer than usual. The decision to enforce a rate is left to the discretion of a
      dCDN. An implementation of rate pacing should implement reasonable lower (and upper)
      bounds to avoid such cases.</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The author would like to thank Francois Le Faucheur for his
      contributions and feedback.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.1363"?>

      <?rfc include='reference.I-D.ietf-cdni-footprint-capabilities-semantics'?>

      <?rfc include='reference.I-D.ietf-cdni-metadata'?>

      <?rfc include='reference.I-D.ietf-cdni-logging'?>

      <?rfc include='reference.RFC.2119'?>
    </references>
  </back>
</rfc>
