home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / srev13h.zip / delta.doc < prev    next >
Text File  |  2001-03-27  |  12KB  |  271 lines

  1. 23 November 1999. Daniel Hellerstein (danieh@crosslink.net)
  2.  
  3.                 SRE-http and delta encoding.
  4.  
  5. Abstract:
  6.    SRE-http ver 1.3h provides limited support for the proposed delta
  7.    encoding protocol. 
  8.  
  9.                 --------------------------------------------
  10.  
  11. Contents:
  12.  
  13. 1) Introduction
  14. 2) Configuring SRE-http's support for delta encoding
  15. 3) On whether to enable delta-encoding on a selector specific basis:
  16. 4) Technical details
  17. 5) Various notes
  18.  
  19.                 --------------------------------------------
  20.  
  21. 1) Introduction
  22.  
  23. One of the most significant advances of the http/1.1 standard is 
  24. increased support for caching.  Caching is the act of using a 
  25. a locally available version of a resource instead of re-obtaining
  26. the resource from its originating server.  To the extent that caching
  27. can be enhanced, overall internet traffic will be reduced, with concomittant
  28. increase in delivery speeds for what remains.
  29.  
  30. Unfortunately, the improved (but still relatively simple) caching schemes 
  31. supported by http/1.1 are not well suited to dynamic content.  Since a large
  32. (and probably growing) share of web resources are dynamic (that is, they
  33. change from day to day), this weakness may seriouslly undermine the 
  34. potential advantages of caching.
  35.  
  36. One strategy of dealing with this problem is through the use of "deltas".
  37. Current cache schemes require a server to instruct a client to either use a 
  38. cached item as is, or not at all.  Delta caching schemes represent a
  39. compromise -- the server can tell a client to use its cached version
  40. as a "base", and send a list of "differences". This list of differences, 
  41. which we also refer to as "deltas", may often be much smaller then
  42. the full contents of the resource.  
  43.  
  44. In recognition of this possiblity, an http working group has drafted a
  45. set of http standards for the use of "deltas" (see
  46. http://info.internet.isi.edu:80/in-drafts/files/draft-mogul-http-delta-02.txt)
  47. SRE-http implements much of this proposed standard.  
  48.  
  49.                 --------------------------------------------
  50.  
  51. 2) Configuring SRE-http's support for delta encoding
  52.  
  53. In order to enable SRE-http's support for delta encoding, you'll need 
  54. the following:
  55.  
  56.  a) You must install the (free) GNU DIFF software, and the (free)
  57.     rxGDIFF dynamic link library.
  58.  
  59.     GNU DIFF can be downloaded from Hobbes (http://hobbes.nmsu.edu); 
  60.     and GDIFF (which is NOT the same thing as Gnu DIFF) can be
  61.     obtained from http://www.srehttp.org/apps/gdiff/).
  62.  
  63.     or, you can catch them all at  ... 
  64.  
  65.         http://www.srehttp.org/pubfiles/srediff.zip. 
  66.  
  67.     After downloading srediff.zip, unzip it to your GoServe directory 
  68.     and look at the DIFF_ME.TXT file for information on conditions of use.
  69.  
  70.     Note that DIFF requires emx 0.9d.  EMX can be found at 
  71.     http://hobbes.nmsu.edu (search for EMXRT).
  72.  
  73.  b) Make sure that your SRE-http "TEMPDATA_DIR" directory has a
  74.     DELTAS\ subdirectory (if you used SRE-http's install program,
  75.     that will have been automatically created).
  76.  
  77.     This DELTAS_DIR directory MUST be on an HPFS drive. If it is not,
  78.     delta-encoding will NOT be enabled.  
  79.  
  80.  c) Set a few parameters in INIT_STA.80
  81.  
  82.     Two parameters must be set:
  83.  
  84.     delta_encoding_enable 
  85.       delta_encoding_enable can take values of:
  86.           0 = disable
  87.           1 = allow sel-specific support for delta encoding
  88.           2 = allow delta encoding for all requests 
  89.        Examples:
  90.             delta_encoding_enable=0
  91.             delta_encoding_enable=2
  92.  
  93.      delta_encoding_maxsize
  94.          delta_encoding_maxsize is the size (in Kbyte) of your 
  95.          delta-encoding cache.  SRE-http will monitor the size
  96.          of the DELTAS_DIR directory, and will remove "least
  97.          recently used" files when this size is exceeded.
  98.          Example:
  99.             delta_encoding_maxsize=5000
  100.  
  101.   d) Possibly set some selector specific advanced options.
  102.      If you've set delta_encoding_enable=1, then delta-encoding is
  103.      only attempted when a selector has a "delta-encoding" 
  104.      advanced option. For example, you can create a selector specific
  105.      advanced options file that contains the line
  106.          SET DELTA_ENCODING 1   
  107.      (where 1 means enable, and 0 means disable).
  108.      Please see ADV_OPTS.DOC for details on how to set advanced options.
  109.  
  110.  
  111.   e) You may also wish to set the DCluster and DTemplate advanced options. 
  112.      These options extend the capabilities of delta caching to families
  113.      of resources, and can greatly increase the effectiveness of
  114.      delta caching.  See ADV_OPTS.DOC, and the delta differencing proposed
  115.      standard, for further details on these extensions to delta encoding.  
  116.  
  117. Once you've done these steps, SRE-http will automatically handle
  118. requests from delta-encoding aware clients.  
  119.  
  120.                 --------------------------------------------
  121.  
  122. 3) On whether to enable delta-encoding on a selector specific basis
  123.  
  124. Delta encoding is a grand idea, but it comes at some cost to your
  125. server -- the time required to compute differences, and the 
  126. space (and time) required to store "prior instances".  
  127. In many cases, it's not worth it -- such as for resource that are
  128. rarely re-requested, for resources that rarely change, or for small 
  129. resources that contain many possible changes.  
  130.  
  131. Thus, we recommend that the "selector specific" version of delta-encoding
  132. be used (delta_encoding_enable=1). This does require more work on
  133. the server administrator's part, though you can use wildcarded selector 
  134. specific advanced options to refer to broad sets of resources.
  135.  
  136. Conversely, the "allow for all requests" mode means delta encoding
  137. is attempted for all resources; which will probably lead to an 
  138. overall reduction in throughput speeds (depending on how fast your server 
  139. is, how slow the lines to your clients are, and how extensively
  140. delta-encoding is understood). 
  141.  
  142. If you want to allow delta-encoding for most of your web resources, you
  143. could set delta_encoding_enable=0, and then use SET DELTA_ENCODING 0
  144. parameters for all the resources that should NOT be subject to
  145. delta encoding (say, all your .ZIP files).
  146.  
  147.                 --------------------------------------------
  148.  
  149. 4) Technical details
  150.  
  151. Although  not necessary for its use, the reader may be interested in some
  152. of the details of SRE-http's support for delta encoding.  We strongly suggest
  153. reading the proposed standard -- it's generally well-written, especially if
  154. you don't try to grok all the details.
  155.  
  156. First off, let's define "instances". 
  157.    * An instance is the state of a web resource at a given instant. 
  158.    * When asked for a resource, the server return's a "current instance". 
  159.    * A client may have one or several prior instances of a resource (say, 
  160.      from earlier requests for the same URI),
  161.    * A server may also retain copies of some of these prior instances.
  162.  
  163. If the server and client can ascertain that both have the same copy of
  164. a prior instance, then the server can compute the difference between
  165. this "commonly owned" prior instance and the current instance. 
  166. One can think of this difference as being an "encoding" of the current
  167. instance, in much the same way that GZIP compression is an encodng
  168. Upon reciept of this "difference", the client can create a duplicate of the
  169. new version by combining the "difference" with the "old version". 
  170.  
  171. Delta-encoding is supported either as a "content-encoding" or
  172. a "transfer-encoding" (but NEVER as both). For practical purposes, the 
  173. differences mostly effect how "range" requests are dealt with.  
  174.  
  175.     A "range request with delta content-encoding" will result in the requested
  176.     range of the "delta" being returned. That is, the server first computes a 
  177.     "difference" between the current and "commonly owned" prior instance, and 
  178.     the range of this difference is returned.
  179.  
  180.     A "range request with delta transfer-encoding" will result in a difference
  181.     between the corresponding ranges of the two instances. That is,
  182.     first the desired range of the current instance is extracted, then
  183.     the same range is extracted from the prior instance, and then
  184.     a difference is computed between these two ranges.
  185.  
  186. Due to the complexities of the latter operation (of extracting ranges), delta
  187. transfer encoding is not supported when multiple byte ranges are desired.
  188.  
  189. However, due to complexities of dealing with content encodings that are not
  190. dynamically generated, delta content encoding is never used when an explicit
  191. content encoding is desired. In particular, if content negotiation (as
  192. described in NEGOTIAT.DOC) is used to determine a content encoding, then
  193. delta content encoding is not attempted.
  194.  
  195.                 --------------------------------------------
  196.  
  197. 5) Various Notes
  198.  
  199. * For several reasons, the delta encoding proposal recommends
  200.   that delta content encoding be used in preference to delta transfer
  201.   encoding. However, due to implementation hassles, in SRE-http transfer 
  202.   encoding is somewhat better supported. In particular, you can combine 
  203.   GZIP and delta encoding when they are used as transfer encodings,  but 
  204.   not when they are to be used as content encodings.
  205.  
  206. * Currently, SRE-http supports the GDIFF and  DIFF-E "delta encoding types".
  207.   DIFF software is readily available, and free; a free OS/2 version of 
  208.   GDIFF can be found at http://www.srehttp.org/apps/gdiff.  DIFF
  209.   does NOT work with binary files, but tends to be better then GDIFF 
  210.   for non-binary (text) files.
  211.  
  212.   The delta encoding spec mentions VCDIFF. If OS/2 implementations
  213.   of these (or other common) differencing algorithims become available, 
  214.   we will be happy to add support (code donations are gratefully accepted!)
  215.  
  216. * To avoid some odd definitional problems, and implementation hassles,
  217.   SRE-http places the following restrictions on gzip and delta-encoding:
  218.  
  219.   Given:
  220.      i) gzip and a delta-coding-type (such as vcdiff or diff-e) appear
  221.         in a TE request header
  222.     ii) gzip precedes the delta-content-encoding. For example; 
  223.         Accept-Encoding: gzip, diff-e
  224.    iii) a successful (smaller sized) delta-encoding can be computed 
  225.         between the current instance and a base instance the client owns
  226.         (as referred to by the etag in a If-None-Match: etag request header)
  227.    Then
  228.        GZIP will not be used. That is, the delta-encoded response will be 
  229.        returned as is (without compression)
  230.  
  231.    Conversely,
  232.        iia) if the GZIP follows the delta-content-encoding -- for example"
  233.             Accept-Encoding: diff-e,gzip
  234.    Then
  235.         GZIP will be used. That is, the delta-encoded response will be 
  236.         compressed.
  237.  
  238.   * If your TEMPDATA_DIR is NOT on an HPFS drive, you can explicitily
  239.     set the DELTAS_DIR to point to a directory on a different, HPFS,
  240.     drive.  See SREFMON.CMD for the details.
  241.  
  242.   * If a selector specific advanced options are used to define a 
  243.     CONTENT-ENCODING response header, then delta content encoding will 
  244.     not be attempted.
  245.  
  246.   * If a selector specific advanced options is used to define an ETAG
  247.     response header, then delta encoding is NOT attempted.
  248.  
  249.   * As an alternative to delta encoding, consider the use of the "SRErsync"
  250.     pre-reply procedure (see SRERSYNC.DOC).
  251.  
  252.   * Keep in mind that for dynamic resources (say, a web page that
  253.     contains a hit counter, or a clock), every single request
  254.     results in a different instance, so that each request results in
  255.     the server retaining a copy of the response (for use as a "prior 
  256.     instance" in future requests).  Hence the need for the 
  257.     delta_encoding_maxsize parameter!
  258.  
  259.   * DoGET.CMD, that comes with SRE-http, contains a "delta encoding"
  260.     option that makes it (relatively) easy to issue a request with
  261.     the necessary delta transfer encoding headers. DoGET.CMD can
  262.     also "unDIFF" and "unGDIFF" a delta-encoded response.
  263.  
  264.   * When DELTA_ENCODING_ENABLE=1, SRE-http "addons" will not attempt
  265.     delta encoding (that is, you can't use a selector specific advanced
  266.     option to enable delta encoding for "addons").
  267.  
  268.   * For now, delta-encoded responses will be set to be non-cachable.
  269.  
  270.  
  271.