Blame doc/protocol-binary-range.txt

Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Network Working Group                                   Aaron Stone, Ed.
Packit 4e8bc4
Internet-Draft                                           Six Apart, Ltd.
Packit 4e8bc4
Intended status: Informational                         December 14, 2007
Packit 4e8bc4
Expires: June 16, 2008
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
              Memcache Binary Protocol: Extensions for UDP
Packit 4e8bc4
                      draft-stone-memcache-udp-01
Packit 4e8bc4
Packit 4e8bc4
Abstract
Packit 4e8bc4
Packit 4e8bc4
   This memo explains extensions to the memcache binary protocol for use
Packit 4e8bc4
   in a UDP environment.
Packit 4e8bc4
Packit 4e8bc4
   Memcache is a high performance key-value cache.  It is intentionally
Packit 4e8bc4
   a dumb cache, optimized for speed only.  Applications using memcache
Packit 4e8bc4
   do not rely on it for data -- a persistent database with guaranteed
Packit 4e8bc4
   reliability is strongly recommended -- but applications can run much
Packit 4e8bc4
   faster when cached data is available in memcache.
Packit 4e8bc4
Packit 4e8bc4
Status of This Memo
Packit 4e8bc4
Packit 4e8bc4
   This Internet-Draft is submitted in full conformance with the
Packit 4e8bc4
   provisions of BCP 78 and BCP 79.
Packit 4e8bc4
Packit 4e8bc4
   Internet-Drafts are working documents of the Internet Engineering
Packit 4e8bc4
   Task Force (IETF).  Note that other groups may also distribute
Packit 4e8bc4
   working documents as Internet-Drafts.  The list of current Internet-
Packit 4e8bc4
   Drafts is at http://datatracker.ietf.org/drafts/current/.
Packit 4e8bc4
Packit 4e8bc4
   Internet-Drafts are draft documents valid for a maximum of six months
Packit 4e8bc4
   and may be updated, replaced, or obsoleted by other documents at any
Packit 4e8bc4
   time.  It is inappropriate to use Internet-Drafts as reference
Packit 4e8bc4
   material or to cite them other than as "work in progress."
Packit 4e8bc4
Packit 4e8bc4
   This Internet-Draft will expire on June 16, 2008.
Packit 4e8bc4
Packit 4e8bc4
Copyright Notice
Packit 4e8bc4
Packit 4e8bc4
   Copyright (c) 2007 IETF Trust and the persons identified as the
Packit 4e8bc4
   document authors.  All rights reserved.
Packit 4e8bc4
Packit 4e8bc4
   This document is subject to BCP 78 and the IETF Trust's Legal
Packit 4e8bc4
   Provisions Relating to IETF Documents
Packit 4e8bc4
   (http://trustee.ietf.org/license-info) in effect on the date of
Packit 4e8bc4
   publication of this document.  Please review these documents
Packit 4e8bc4
   carefully, as they describe your rights and restrictions with respect
Packit 4e8bc4
   to this document.  Code Components extracted from this document must
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Aaron Stone               Expires June 16, 2008                 [Page 1]
Packit 4e8bc4

Packit 4e8bc4
Internet-Draft              Memcache Over UDP              December 2007
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
   include Simplified BSD License text as described in Section 4.e of
Packit 4e8bc4
   the Trust Legal Provisions and are provided without warranty as
Packit 4e8bc4
   described in the Simplified BSD License.
Packit 4e8bc4
Packit 4e8bc4
Table of Contents
Packit 4e8bc4
Packit 4e8bc4
   1.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
Packit 4e8bc4
     1.1.  Conventions Used In This Document . . . . . . . . . . . .   2
Packit 4e8bc4
   2.  Defined Values  . . . . . . . . . . . . . . . . . . . . . . .   3
Packit 4e8bc4
     2.1.  Magic Byte  . . . . . . . . . . . . . . . . . . . . . . .   3
Packit 4e8bc4
     2.2.  Response Status . . . . . . . . . . . . . . . . . . . . .   3
Packit 4e8bc4
     2.3.  Command Opcodes . . . . . . . . . . . . . . . . . . . . .   3
Packit 4e8bc4
     2.4.  Data Types  . . . . . . . . . . . . . . . . . . . . . . .   3
Packit 4e8bc4
   3.  Commands  . . . . . . . . . . . . . . . . . . . . . . . . . .   3
Packit 4e8bc4
     3.1.  Get Response  . . . . . . . . . . . . . . . . . . . . . .   3
Packit 4e8bc4
     3.2.  Get Range Request . . . . . . . . . . . . . . . . . . . .   4
Packit 4e8bc4
     3.3.  Get Range Response  . . . . . . . . . . . . . . . . . . .   4
Packit 4e8bc4
   4.  Security Considerations . . . . . . . . . . . . . . . . . . .   5
Packit 4e8bc4
   5.  Normative References  . . . . . . . . . . . . . . . . . . . .   5
Packit 4e8bc4
   Author's Address  . . . . . . . . . . . . . . . . . . . . . . . .   5
Packit 4e8bc4
Packit 4e8bc4
1.  Introduction
Packit 4e8bc4
Packit 4e8bc4
   Memcache is a high performance key-value cache.  It is intentionally
Packit 4e8bc4
   a dumb cache, optimized for speed only.  Applications using memcache
Packit 4e8bc4
   do not rely on it for data -- a persistent database with guaranteed
Packit 4e8bc4
   reliability is strongly recommended -- but applications can run much
Packit 4e8bc4
   faster when cached data is available in memcache.
Packit 4e8bc4
Packit 4e8bc4
   Sites may find that, due to their network architecture or application
Packit 4e8bc4
   usage patterns, the stateless [UDP] protocol better suits their
Packit 4e8bc4
   needs.  This document provides extensions and descriptions of use of
Packit 4e8bc4
   the memcache protocol [MEMCACHE] in a UDP environment.
Packit 4e8bc4
Packit 4e8bc4
   It is a goal of this document to provide sufficient information in
Packit 4e8bc4
   each UDP packet as to avoid any requirement for statefulness on the
Packit 4e8bc4
   part of the server nor significant caching of outstanding packets on
Packit 4e8bc4
   the part of the client.
Packit 4e8bc4
Packit 4e8bc4
1.1.  Conventions Used In This Document
Packit 4e8bc4
Packit 4e8bc4
   The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
Packit 4e8bc4
   "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
Packit 4e8bc4
   document are to be interpreted as described in [KEYWORDS].
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Aaron Stone               Expires June 16, 2008                 [Page 2]
Packit 4e8bc4

Packit 4e8bc4
Internet-Draft              Memcache Over UDP              December 2007
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
2.  Defined Values
Packit 4e8bc4
Packit 4e8bc4
2.1.  Magic Byte
Packit 4e8bc4
Packit 4e8bc4
   The magic bytes remains the same as in [MEMCACHE].
Packit 4e8bc4
Packit 4e8bc4
2.2.  Response Status
Packit 4e8bc4
Packit 4e8bc4
   Additional status values:
Packit 4e8bc4
Packit 4e8bc4
   0x0004  Value is larger than a single response packet
Packit 4e8bc4
Packit 4e8bc4
2.3.  Command Opcodes
Packit 4e8bc4
Packit 4e8bc4
   Additional opcode values:
Packit 4e8bc4
Packit 4e8bc4
   0x0C    Get Range
Packit 4e8bc4
   0x0D    Set Range
Packit 4e8bc4
Packit 4e8bc4
2.4.  Data Types
Packit 4e8bc4
Packit 4e8bc4
   There are no new data types in this extension.
Packit 4e8bc4
Packit 4e8bc4
3.  Commands
Packit 4e8bc4
Packit 4e8bc4
3.1.  Get Response
Packit 4e8bc4
Packit 4e8bc4
   This section extends the behavior of the Get and GetQ commands as
Packit 4e8bc4
   described in [MEMCACHE].
Packit 4e8bc4
Packit 4e8bc4
   When a Get or GetQ request is made via UDP, and the value of the key
Packit 4e8bc4
   for which the request was made is larger than can be placed into a
Packit 4e8bc4
   single UDP packet (noting that the protocol header must also be
Packit 4e8bc4
   counted), a Get Range response packet MUST be sent instead of the Get
Packit 4e8bc4
   response packet.  In this instance:
Packit 4e8bc4
Packit 4e8bc4
   1.  The Status field of the response header MUST be 0x0004.
Packit 4e8bc4
   2.  The Offset field of the GetR response extras MUST be 0.
Packit 4e8bc4
   3.  The Length field of the GetR response extras, and the data
Packit 4e8bc4
       contained in the Value field of the packet, SHOULD be the maximum
Packit 4e8bc4
       allowed length of a UDP packet, less the space required by the
Packit 4e8bc4
       header and extras; however it MAY be any amount below this
Packit 4e8bc4
       maximum.
Packit 4e8bc4
   4.  The Total value length field of the response extras MUST be the
Packit 4e8bc4
       actual length of the complete value.
Packit 4e8bc4
Packit 4e8bc4
   The client, upon receipt of a Get Range response bearing Status 0x004
Packit 4e8bc4
   and a Message ID corresponding to its Get request, shall then know
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Aaron Stone               Expires June 16, 2008                 [Page 3]
Packit 4e8bc4

Packit 4e8bc4
Internet-Draft              Memcache Over UDP              December 2007
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
   that it has received only the first portion of the value.  The client
Packit 4e8bc4
   MAY choose to request the remaining portion of the value by sending
Packit 4e8bc4
   one or more Get Range requests.
Packit 4e8bc4
Packit 4e8bc4
3.2.  Get Range Request
Packit 4e8bc4
Packit 4e8bc4
   The Get Range request is primarily intended for use over a UDP
Packit 4e8bc4
   transport to request byte ranges of the value for a key.  In the
Packit 4e8bc4
   event that the Data version check fails to match that of the key, an
Packit 4e8bc4
   error MUST be returned.
Packit 4e8bc4
Packit 4e8bc4
   Extra data for get range request:
Packit 4e8bc4
Packit 4e8bc4
   Byte/     0       |       1       |       2       |       3       |
Packit 4e8bc4
      /              |               |               |               |
Packit 4e8bc4
     |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
    0| Flags                                                         |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
    4| Data version check                                            |
Packit 4e8bc4
     |                                                               |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
   12| Offset                                                        |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
   16| Length                                                        |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
   Total 20 bytes
Packit 4e8bc4
Packit 4e8bc4
3.3.  Get Range Response
Packit 4e8bc4
Packit 4e8bc4
   The Get Range request is primarily intended for use over a UDP
Packit 4e8bc4
   transport to indicate the location of the bytes of the value for a
Packit 4e8bc4
   key contained in a given packet.  A client receives enough
Packit 4e8bc4
   information in each Get Range extras to construct an appropriately
Packit 4e8bc4
   sized buffer in its own memory and blindly insert the contents of the
Packit 4e8bc4
   packet at the given byte offset.
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Aaron Stone               Expires June 16, 2008                 [Page 4]
Packit 4e8bc4

Packit 4e8bc4
Internet-Draft              Memcache Over UDP              December 2007
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
   Extra data for get range response:
Packit 4e8bc4
Packit 4e8bc4
   Byte/     0       |       1       |       2       |       3       |
Packit 4e8bc4
      /              |               |               |               |
Packit 4e8bc4
     |0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|0 1 2 3 4 5 6 7|
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
    0| Flags                                                         |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
    4| Data version check                                            |
Packit 4e8bc4
     |                                                               |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
   12| Offset                                                        |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
   16| Length                                                        |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
   20| Total value length                                            |
Packit 4e8bc4
     +---------------+---------------+---------------+---------------+
Packit 4e8bc4
   Total 24 bytes
Packit 4e8bc4
Packit 4e8bc4
4.  Security Considerations
Packit 4e8bc4
Packit 4e8bc4
   This document does not introduce any new security considerations
Packit 4e8bc4
   beyond those discussed in [MEMCACHE].
Packit 4e8bc4
Packit 4e8bc4
5.  Normative References
Packit 4e8bc4
Packit 4e8bc4
   [KEYWORDS]
Packit 4e8bc4
              Bradner, S., "Key words for use in RFCs to Indicate
Packit 4e8bc4
              Requirement Levels", BCP 14, RFC 2119, March 1997.
Packit 4e8bc4
Packit 4e8bc4
   [MEMCACHE]
Packit 4e8bc4
              Bradner, S., "Key words for use in RFCs to Indicate
Packit 4e8bc4
              Requirement Levels", BCP 14, RFC 2119, March 1997.
Packit 4e8bc4
Packit 4e8bc4
   [UDP]      Postel, J., "User Datagram Protocol", STD 6, RFC 768,
Packit 4e8bc4
              August 1980.
Packit 4e8bc4
Packit 4e8bc4
Author's Address
Packit 4e8bc4
Packit 4e8bc4
   Aaron Stone (editor)
Packit 4e8bc4
   Six Apart, Ltd.
Packit 4e8bc4
   548 4th Street
Packit 4e8bc4
   San Francisco, CA  94107
Packit 4e8bc4
   USA
Packit 4e8bc4
Packit 4e8bc4
   Email: aaron@serendipity.palo-alto.ca.us
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Packit 4e8bc4
Aaron Stone               Expires June 16, 2008                 [Page 5]