xxx-using-spdy.txt 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. Filename: xxx-using-spdy.txt
  2. Title: Using the SPDY protocol to improve Tor performance
  3. Author: Steven J. Murdoch
  4. Created: 03-Feb-2010
  5. Status: Draft
  6. Target:
  7. 1. Overview
  8. The SPDY protocol [1] is an alternative method for transferring
  9. web content over TCP, designed to improve efficiency and
  10. performance. A SPDY-aware browser can already communicate with
  11. a SPDY-aware web server over Tor, because this only requires a TCP
  12. stream to be set up. However, a SPDY-aware browser cannot
  13. communicate with a non-SPDY-aware web server. This proposal
  14. outlines how Tor could support this latter case, and why it
  15. may be good for performance.
  16. 2. Motivation
  17. About 90% of Tor traffic, by connection, is HTTP [2], but
  18. users report subjective performance to be poor. It would
  19. therefore be desirable to improve this situation. SPDY was
  20. designed to offer better performance than HTTP, in
  21. high-latency and/or low-bandwidth situations, and is therefore
  22. an option worth examining.
  23. If a user wishes to access a SPDY-enabled web server over Tor,
  24. all they need to do is to configure their SPDY-enabled browser
  25. (e.g. Google Chrome) to use Tor. However, there are few
  26. SPDY-enabled web servers, and even if there was high demand
  27. from Tor users, there would be little motivation for server
  28. operators to upgrade, for the benefit of only a small
  29. proportion of their users.
  30. The motivation of this proposal is to allow only the user to
  31. install a SPDY-enabled browser, and permit web servers to
  32. remain unmodified. Essentially, Tor would incorporate a proxy
  33. on the exit node, which communicates SPDY to the web browser
  34. and normal HTTP to the web server. This proxy would translate
  35. between the two transport protocols, and possibly perform
  36. other optimizations.
  37. SPDY currently offers five optimizations:
  38. 1) Multiplexed streams:
  39. An unlimited number of resources can be transferred
  40. concurrently, over a single TCP connection.
  41. 2) Request prioritization:
  42. The client can set a priority on each resource, to assist
  43. the server in re-ordering responses.
  44. 3) Compression:
  45. Both HTTP header and resource content can be compressed.
  46. 4) Server push:
  47. The server can offer the client resources which have not
  48. been requested, but which the server believes will be.
  49. 5) Server hint:
  50. The server can suggest that the client request further
  51. resources, before the main content is transferred.
  52. Tor currently effectively implements (1), by being able to put
  53. multiple streams on one circuit. SPDY however requires fewer
  54. round-trips to do the same. The other features are not
  55. implemented by Tor. Therefore it is reasonable to expect that
  56. a HTTP <-> SPDY proxy may improve Tor performance, by some
  57. amount.
  58. The consequences on caching need to be considered carefully.
  59. Most of the optimizations SPDY offers have no effect because
  60. the existing HTTP cache control headers are transmitted without
  61. modification. Server push is more problematic, because here
  62. the server may push a resource that the client already has.
  63. 3. Design outline
  64. One way to implement the SPDY proxy is for Tor exit nodes to
  65. advertise this capability in their descriptor. The OP would
  66. then preferentially select these nodes when routing streams
  67. destined for port 80.
  68. Then, rather than sending the usual RELAY_BEGIN cell, the OP
  69. would send a RELAY_BEGIN_TRANSFORMED cell, with a parameter to
  70. indicate that the exit node should translate between SPDY and
  71. HTTP. The rest of the connection process would operate as
  72. usual.
  73. There would need to be some way of elegantly handling non-HTTP
  74. traffic which goes over port 80.
  75. 4. Implementation status
  76. SPDY is under active development and both the specification
  77. and implementations are in a state of flux. Initial
  78. experiments with Google Chrome in SPDY-mode and server
  79. libraries indicate that more work is needed before they are
  80. production-ready. There is no indication that browsers other
  81. than Google Chrome will support SPDY (and no official
  82. statement as to whether Google Chrome will eventually enable
  83. SPDY by default).
  84. Implementing a full SPDY proxy would be non-trivial. Stream
  85. multiplexing and compression are supported by existing
  86. libraries and would be fairly simple to implement. Request
  87. prioritization would require some form of caching on the
  88. proxy-side. Server push and server hint would require content
  89. parsing to identify resources which should be treated
  90. specially.
  91. 5. Security and policy implications
  92. A SPDY proxy would be a significant amount of code, and may
  93. pull in external libraries. This code will process potentially
  94. malicious data, both at the SPDY and HTTP sides. This proposal
  95. therefore increases the risk that exit nodes will be
  96. compromised by exploiting a bug in the proxy.
  97. This proposal would also be the first way in which Tor is
  98. modifying TCP stream data. Arguably this is still meta-data
  99. (HTTP headers), but there may be some concern that Tor should
  100. not be doing this.
  101. Torbutton only works with Firefox, but SPDY only works with
  102. Google Chrome. We should be careful not to recommend that
  103. users adopt a browser which harms their privacy in other ways.
  104. 6. Open questions:
  105. - How difficult would this be to implement?
  106. - How much performance improvement would it actually result in?
  107. - Is there some way to rapidly develop a prototype which would
  108. answer the previous question?
  109. [1] SPDY: An experimental protocol for a faster web
  110. http://dev.chromium.org/spdy/spdy-whitepaper
  111. [2] Shining Light in Dark Places: Understanding the Tor Network Damon McCoy,
  112. Kevin Bauer, Dirk Grunwald, Tadayoshi Kohno, Douglas Sicker
  113. http://www.cs.washington.edu/homes/yoshi/papers/Tor/PETS2008_37.pdf