| 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | Network Working Group Aaron Stone, Ed. |
|---|
| 5 | Internet-Draft Six Apart, Ltd. |
|---|
| 6 | Intended status: Informational December 14, 2007 |
|---|
| 7 | Expires: June 16, 2008 |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | Memcache Binary Protocol: Extensions for UDP |
|---|
| 11 | draft-stone-memcache-udp-01 |
|---|
| 12 | |
|---|
| 13 | Status of this Memo |
|---|
| 14 | |
|---|
| 15 | This document is an Internet-Draft and is NOT offered in accordance |
|---|
| 16 | with Section 10 of RFC 2026, and the author does not provide the IETF |
|---|
| 17 | with any rights other than to publish as an Internet-Draft. |
|---|
| 18 | |
|---|
| 19 | Internet-Drafts are working documents of the Internet Engineering |
|---|
| 20 | Task Force (IETF), its areas, and its working groups. Note that |
|---|
| 21 | other groups may also distribute working documents as Internet- |
|---|
| 22 | Drafts. |
|---|
| 23 | |
|---|
| 24 | Internet-Drafts are draft documents valid for a maximum of six months |
|---|
| 25 | and may be updated, replaced, or obsoleted by other documents at any |
|---|
| 26 | time. It is inappropriate to use Internet-Drafts as reference |
|---|
| 27 | material or to cite them other than as "work in progress." |
|---|
| 28 | |
|---|
| 29 | The list of current Internet-Drafts can be accessed at |
|---|
| 30 | http://www.ietf.org/ietf/1id-abstracts.txt. |
|---|
| 31 | |
|---|
| 32 | The list of Internet-Draft Shadow Directories can be accessed at |
|---|
| 33 | http://www.ietf.org/shadow.html. |
|---|
| 34 | |
|---|
| 35 | This Internet-Draft will expire on June 16, 2008. |
|---|
| 36 | |
|---|
| 37 | Abstract |
|---|
| 38 | |
|---|
| 39 | This memo explains extensions to the memcache binary protocol for use |
|---|
| 40 | in a UDP environment. |
|---|
| 41 | |
|---|
| 42 | Memcache is a high performance key-value cache. It is intentionally |
|---|
| 43 | a dumb cache, optimized for speed only. Applications using memcache |
|---|
| 44 | do not rely on it for data -- a persistent database with guaranteed |
|---|
| 45 | reliability is strongly recommended -- but applications can run much |
|---|
| 46 | faster when cached data is available in memcache. |
|---|
| 47 | |
|---|
| 48 | |
|---|
| 49 | |
|---|
| 50 | |
|---|
| 51 | |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | |
|---|
| 55 | Aaron Stone Expires June 16, 2008 [Page 1] |
|---|
| 56 | |
|---|
| 57 | Internet-Draft Memcache Over UDP December 2007 |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | Table of Contents |
|---|
| 61 | |
|---|
| 62 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 3 |
|---|
| 63 | 1.1. Conventions Used In This Document . . . . . . . . . . . . . 3 |
|---|
| 64 | 2. Defined Values . . . . . . . . . . . . . . . . . . . . . . . . 3 |
|---|
| 65 | 2.1. Magic Byte . . . . . . . . . . . . . . . . . . . . . . . . 3 |
|---|
| 66 | 2.2. Response Status . . . . . . . . . . . . . . . . . . . . . . 3 |
|---|
| 67 | 2.3. Command Opcodes . . . . . . . . . . . . . . . . . . . . . . 3 |
|---|
| 68 | 2.4. Data Types . . . . . . . . . . . . . . . . . . . . . . . . 3 |
|---|
| 69 | 3. Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 |
|---|
| 70 | 3.1. Get Response . . . . . . . . . . . . . . . . . . . . . . . 4 |
|---|
| 71 | 3.2. Get Range Request . . . . . . . . . . . . . . . . . . . . . 4 |
|---|
| 72 | 3.3. Get Range Response . . . . . . . . . . . . . . . . . . . . 5 |
|---|
| 73 | 4. Security Considerations . . . . . . . . . . . . . . . . . . . . 6 |
|---|
| 74 | 5. Normative References . . . . . . . . . . . . . . . . . . . . . 6 |
|---|
| 75 | Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 6 |
|---|
| 76 | |
|---|
| 77 | |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | Aaron Stone Expires June 16, 2008 [Page 2] |
|---|
| 112 | |
|---|
| 113 | Internet-Draft Memcache Over UDP December 2007 |
|---|
| 114 | |
|---|
| 115 | |
|---|
| 116 | 1. Introduction |
|---|
| 117 | |
|---|
| 118 | Memcache is a high performance key-value cache. It is intentionally |
|---|
| 119 | a dumb cache, optimized for speed only. Applications using memcache |
|---|
| 120 | do not rely on it for data -- a persistent database with guaranteed |
|---|
| 121 | reliability is strongly recommended -- but applications can run much |
|---|
| 122 | faster when cached data is available in memcache. |
|---|
| 123 | |
|---|
| 124 | Sites may find that, due to their network architecture or application |
|---|
| 125 | usage patterns, the stateless [UDP] protocol better suits their |
|---|
| 126 | needs. This document provides extensions and descriptions of use of |
|---|
| 127 | the memcache protocol [MEMCACHE] in a UDP environment. |
|---|
| 128 | |
|---|
| 129 | It is a goal of this document to provide sufficient information in |
|---|
| 130 | each UDP packet as to avoid any requirement for statefulness on the |
|---|
| 131 | part of the server nor significant caching of outstanding packets on |
|---|
| 132 | the part of the client. |
|---|
| 133 | |
|---|
| 134 | 1.1. Conventions Used In This Document |
|---|
| 135 | |
|---|
| 136 | The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", |
|---|
| 137 | "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this |
|---|
| 138 | document are to be interpreted as described in [KEYWORDS]. |
|---|
| 139 | |
|---|
| 140 | |
|---|
| 141 | 2. Defined Values |
|---|
| 142 | |
|---|
| 143 | 2.1. Magic Byte |
|---|
| 144 | |
|---|
| 145 | The magic bytes remains the same as in [MEMCACHE]. |
|---|
| 146 | |
|---|
| 147 | 2.2. Response Status |
|---|
| 148 | |
|---|
| 149 | Additional status values: |
|---|
| 150 | 0x0004 Value is larger than a single response packet |
|---|
| 151 | |
|---|
| 152 | 2.3. Command Opcodes |
|---|
| 153 | |
|---|
| 154 | Additional opcode values: |
|---|
| 155 | 0x0C Get Range |
|---|
| 156 | 0x0D Set Range |
|---|
| 157 | |
|---|
| 158 | 2.4. Data Types |
|---|
| 159 | |
|---|
| 160 | There are no new data types in this extension. |
|---|
| 161 | |
|---|
| 162 | |
|---|
| 163 | |
|---|
| 164 | |
|---|
| 165 | |
|---|
| 166 | |
|---|
| 167 | Aaron Stone Expires June 16, 2008 [Page 3] |
|---|
| 168 | |
|---|
| 169 | Internet-Draft Memcache Over UDP December 2007 |
|---|
| 170 | |
|---|
| 171 | |
|---|
| 172 | 3. Commands |
|---|
| 173 | |
|---|
| 174 | 3.1. Get Response |
|---|
| 175 | |
|---|
| 176 | This section extends the behavior of the Get and GetQ commands as |
|---|
| 177 | described in [MEMCACHE]. |
|---|
| 178 | |
|---|
| 179 | When a Get or GetQ request is made via UDP, and the value of the key |
|---|
| 180 | for which the request was made is larger than can be placed into a |
|---|
| 181 | single UDP packet (noting that the protocol header must also be |
|---|
| 182 | counted), a Get Range response packet MUST be sent instead of the Get |
|---|
| 183 | response packet. In this instance: |
|---|
| 184 | 1. The Status field of the response header MUST be 0x0004. |
|---|
| 185 | 2. The Offset field of the GetR response extras MUST be 0. |
|---|
| 186 | 3. The Length field of the GetR response extras, and the data |
|---|
| 187 | contained in the Value field of the packet, SHOULD be the maximum |
|---|
| 188 | allowed length of a UDP packet, less the space required by the |
|---|
| 189 | header and extras; however it MAY be any amount below this |
|---|
| 190 | maximum. |
|---|
| 191 | 4. The Total value length field of the response extras MUST be the |
|---|
| 192 | actual length of the complete value. |
|---|
| 193 | |
|---|
| 194 | The client, upon receipt of a Get Range response bearing Status 0x004 |
|---|
| 195 | and a Message ID corresponding to its Get request, shall then know |
|---|
| 196 | that it has received only the first portion of the value. The client |
|---|
| 197 | MAY choose to request the remaining portion of the value by sending |
|---|
| 198 | one or more Get Range requests. |
|---|
| 199 | |
|---|
| 200 | 3.2. Get Range Request |
|---|
| 201 | |
|---|
| 202 | The Get Range request is primarily intended for use over a UDP |
|---|
| 203 | transport to request byte ranges of the value for a key. In the |
|---|
| 204 | event that the Data version check fails to match that of the key, an |
|---|
| 205 | error MUST be returned. |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | |
|---|
| 210 | |
|---|
| 211 | |
|---|
| 212 | |
|---|
| 213 | |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | |
|---|
| 217 | |
|---|
| 218 | |
|---|
| 219 | |
|---|
| 220 | |
|---|
| 221 | |
|---|
| 222 | |
|---|
| 223 | Aaron Stone Expires June 16, 2008 [Page 4] |
|---|
| 224 | |
|---|
| 225 | Internet-Draft Memcache Over UDP December 2007 |
|---|
| 226 | |
|---|
| 227 | |
|---|
| 228 | Extra data for get range request: |
|---|
| 229 | |
|---|
| 230 | Byte/ 0 | 1 | 2 | 3 | |
|---|
| 231 | / | | | | |
|---|
| 232 | |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| |
|---|
| 233 | +---------------+---------------+---------------+---------------+ |
|---|
| 234 | 0| Flags | |
|---|
| 235 | +---------------+---------------+---------------+---------------+ |
|---|
| 236 | 4| Data version check | |
|---|
| 237 | | | |
|---|
| 238 | +---------------+---------------+---------------+---------------+ |
|---|
| 239 | 12| Offset | |
|---|
| 240 | +---------------+---------------+---------------+---------------+ |
|---|
| 241 | 16| Length | |
|---|
| 242 | +---------------+---------------+---------------+---------------+ |
|---|
| 243 | Total 20 bytes |
|---|
| 244 | |
|---|
| 245 | 3.3. Get Range Response |
|---|
| 246 | |
|---|
| 247 | The Get Range request is primarily intended for use over a UDP |
|---|
| 248 | transport to indicate the location of the bytes of the value for a |
|---|
| 249 | key contained in a given packet. A client receives enough |
|---|
| 250 | information in each Get Range extras to construct an appropriately |
|---|
| 251 | sized buffer in its own memory and blindly insert the contents of the |
|---|
| 252 | packet at the given byte offset. |
|---|
| 253 | |
|---|
| 254 | Extra data for get range response: |
|---|
| 255 | |
|---|
| 256 | Byte/ 0 | 1 | 2 | 3 | |
|---|
| 257 | / | | | | |
|---|
| 258 | |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| |
|---|
| 259 | +---------------+---------------+---------------+---------------+ |
|---|
| 260 | 0| Flags | |
|---|
| 261 | +---------------+---------------+---------------+---------------+ |
|---|
| 262 | 4| Data version check | |
|---|
| 263 | | | |
|---|
| 264 | +---------------+---------------+---------------+---------------+ |
|---|
| 265 | 12| Offset | |
|---|
| 266 | +---------------+---------------+---------------+---------------+ |
|---|
| 267 | 16| Length | |
|---|
| 268 | +---------------+---------------+---------------+---------------+ |
|---|
| 269 | 20| Total value length | |
|---|
| 270 | +---------------+---------------+---------------+---------------+ |
|---|
| 271 | Total 24 bytes |
|---|
| 272 | |
|---|
| 273 | |
|---|
| 274 | |
|---|
| 275 | |
|---|
| 276 | |
|---|
| 277 | |
|---|
| 278 | |
|---|
| 279 | Aaron Stone Expires June 16, 2008 [Page 5] |
|---|
| 280 | |
|---|
| 281 | Internet-Draft Memcache Over UDP December 2007 |
|---|
| 282 | |
|---|
| 283 | |
|---|
| 284 | 4. Security Considerations |
|---|
| 285 | |
|---|
| 286 | This document does not introduce any new security considerations |
|---|
| 287 | beyond those discussed in [MEMCACHE]. |
|---|
| 288 | |
|---|
| 289 | |
|---|
| 290 | 5. Normative References |
|---|
| 291 | |
|---|
| 292 | [KEYWORDS] |
|---|
| 293 | Bradner, S., "Key words for use in RFCs to Indicate |
|---|
| 294 | Requirement Levels", BCP 14, RFC 2119, March 1997. |
|---|
| 295 | |
|---|
| 296 | [MEMCACHE] |
|---|
| 297 | Bradner, S., "Key words for use in RFCs to Indicate |
|---|
| 298 | Requirement Levels", BCP 14, RFC 2119, March 1997. |
|---|
| 299 | |
|---|
| 300 | [UDP] Postel, J., "User Datagram Protocol", STD 6, RFC 768, |
|---|
| 301 | August 1980. |
|---|
| 302 | |
|---|
| 303 | |
|---|
| 304 | Author's Address |
|---|
| 305 | |
|---|
| 306 | Aaron Stone (editor) |
|---|
| 307 | Six Apart, Ltd. |
|---|
| 308 | 548 4th Street |
|---|
| 309 | San Francisco, CA 94107 |
|---|
| 310 | USA |
|---|
| 311 | |
|---|
| 312 | Email: aaron@serendipity.palo-alto.ca.us |
|---|
| 313 | |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | |
|---|
| 317 | |
|---|
| 318 | |
|---|
| 319 | |
|---|
| 320 | |
|---|
| 321 | |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | |
|---|
| 325 | |
|---|
| 326 | |
|---|
| 327 | |
|---|
| 328 | |
|---|
| 329 | |
|---|
| 330 | |
|---|
| 331 | |
|---|
| 332 | |
|---|
| 333 | |
|---|
| 334 | |
|---|
| 335 | Aaron Stone Expires June 16, 2008 [Page 6] |
|---|
| 336 | |
|---|