xxx-using-spdy.txt 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. 3. Design outline
  59. One way to implement the SPDY proxy is for Tor exit nodes to
  60. advertise this capability in their descriptor. The OP would
  61. then preferentially select these nodes when routing streams
  62. destined for port 80.
  63. Then, rather than sending the usual RELAY_BEGIN cell, the OP
  64. would send a RELAY_SPDY_BEGIN cell, to indicate that the exit
  65. node should translate between SPDY and HTTP. The rest of the
  66. connection process would operate as usual.
  67. There would need to be some way of elegantly handling non-HTTP
  68. traffic which goes over port 80.
  69. 4. Implementation status
  70. SPDY is under active development and both the specification
  71. and implementations are in a state of flux. Initial
  72. experiments with Google Chrome in SPDY-mode and server
  73. libraries indicate that more work is needed before they are
  74. production-ready. There is no indication that browsers other
  75. than Google Chrome will support SPDY (and no official
  76. statement as to whether Google Chrome will eventually enable
  77. SPDY by default).
  78. Implementing a full SPDY proxy would be non-trivial. Stream
  79. multiplexing and compression are supported by existing
  80. libraries and would be fairly simple to implement. Request
  81. prioritization would require some form of caching on the
  82. proxy-side. Server push and server hint would require content
  83. parsing to identify resources which should be treated
  84. specially.
  85. 5. Security and policy implications
  86. A SPDY proxy would be a significant amount of code, and may
  87. pull in external libraries. This code will process potentially
  88. malicious data, both at the SPDY and HTTP sides. This proposal
  89. therefore increases the risk that exit nodes will be
  90. compromised by exploiting a bug in the proxy.
  91. This proposal would also be the first way in which Tor is
  92. modifying TCP stream data. Arguably this is still meta-data
  93. (HTTP headers), but there may be some concern that Tor should
  94. not be doing this.
  95. Torbutton only works with Firefox, but SPDY only works with
  96. Google Chrome. We should be careful not to recommend that
  97. users adopt a browser which harms their privacy in other ways.
  98. 6. Open questions:
  99. - How difficult would this be to implement?
  100. - How much performance improvement would it actually result in?
  101. - Is there some way to rapidly develop a prototype which would
  102. answer the previous question?
  103. [1] SPDY: An experimental protocol for a faster web
  104. http://dev.chromium.org/spdy/spdy-whitepaper
  105. [2] Shining Light in Dark Places: Understanding the Tor Network Damon McCoy,
  106. Kevin Bauer, Dirk Grunwald, Tadayoshi Kohno, Douglas Sicker
  107. http://www.cs.washington.edu/homes/yoshi/papers/Tor/PETS2008_37.pdf