migrating_from_2.7.asciidoc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. [appendix]
  2. == Migrating from Cowboy 2.7 to 2.8
  3. Cowboy 2.8 contains many optimizations for all
  4. protocols. HTTP/1.1 has received the largest
  5. improvements and Cowboy will now be able to
  6. handle noticeably more requests. Thanks to
  7. the folks at Stressgrid for helping identify that
  8. the performance was lower than it should have been
  9. and for benchmarking my many changes and experiments.
  10. Cowboy 2.8 also contains a small number of tweaks
  11. and bug fixes. Cowboy 2.8 is the first Cowboy release,
  12. ever, to be consistently green on all tested platforms.
  13. This is mostly due to the reworking of some test cases,
  14. but a few bugs were discovered and fixed in the process.
  15. Cowboy 2.8 requires Erlang/OTP 22.0 or greater. It may
  16. also work out of the box with Erlang/OTP 21.3 but this
  17. was not tested and is not supported.
  18. === Features added
  19. * Cowboy will now use `active,N` instead of `active,once`
  20. to receive data from the socket. This greatly improves
  21. the performance and allows Cowboy to process more
  22. requests, especially for HTTP/1.1. The `active_n`
  23. protocol option can be configured to change the
  24. `active,N` value. The default is 100 for all protocols.
  25. * Add a `linger_timeout` option for HTTP/2. The default
  26. is 1000, or one second. This helps ensure that the
  27. final GOAWAY frame will be properly received by clients.
  28. * The function `cowboy_req:parse_header/2,3` will now
  29. parse the headers `access-control-request-headers`,
  30. `access-control-request-method`, `content-encoding`,
  31. `content-language`, `max-forwards`, `origin`,
  32. `proxy-authorization` and `trailer`.
  33. * A Performance chapter has been added to the guide.
  34. More content will be added in future releases.
  35. * Update Cowlib to 2.9.1.
  36. === Experimental features added
  37. * A `protocols` protocol option allows configuring which
  38. protocol will be used for clear listeners. Setting it
  39. to `[http2]` will disable HTTP/1.1 entirely. This feature
  40. will be extended in a future release.
  41. === Features modified
  42. * The default value for HTTP/1.1's `max_keepalive` option
  43. has been increased. It now allows 1000 requests before
  44. gracefully closing the connection.
  45. * The default value for HTTP/2's `max_received_frame_rate`
  46. option has been increased. It now allows 10000 frames every
  47. 10 seconds.
  48. * Cowboy will now accept whitespace in cookie names. This
  49. is in line with the recommended parsing algorithm for the
  50. upcoming cookie RFC update, and corresponds to what browsers
  51. are doing.
  52. === Bugs fixed
  53. * The number of Transport:send/2 calls has been optimized
  54. for HTTP/2. Reducing the number of calls has a noticeable
  55. impact on the number of requests that can be processed.
  56. * Trying to use `cowboy_req:reply/4` with a status code of
  57. 204 or 304 and a non-empty response body will now result
  58. in a crash. Using `cowboy_req:stream_reply/2,3` with 204
  59. or 304 and then attempting to send a body will also result
  60. in a crash. These status codes disallow response bodies
  61. and trying to send one will break HTTP/1.1 framing.
  62. * A crash has been fixed related to HTTP/1.1 pipelining.
  63. The bug was most likely introduced in Cowboy 2.6 when
  64. flow control was added for HTTP/1.1 request bodies.
  65. * The HTTP/1.1 protocol code could get stuck because of flow
  66. control. This has been corrected.
  67. * A crash has been fixed for HTTP/1.1. It occurred when
  68. a flow control update was requested (such as reading
  69. the request body) after the body was fully read.
  70. * The timeout was incorrectly reset sometimes when a stream
  71. (a pair of request/response) terminated. This has been
  72. corrected.
  73. * Handling of hibernation for Websocket has been improved.
  74. Websocket over HTTP/2 now supports hibernating. Stray
  75. messages no longer cancel hibernation.
  76. * The `cowboy_compress_h` stream handler will now ignore
  77. malformed accept-encoding headers instead of crashing.
  78. * The manual pages for `cowboy:start_clear(3)` and
  79. `cowboy:start_tls(3)` now mentions that some protocol
  80. options may be documented in the releevant stream
  81. handler.
  82. * The manual page for `cowboy_req:parse_header(3)` was
  83. corrected. When an unsupported header is given the
  84. function crashes, it does not return an `undefined` tuple.
  85. * The routing algorithm description in the user guide has
  86. been improved.
  87. * The test suites are now consistently green on all tested
  88. platforms. Most of the test failures were caused by flaky
  89. tests. Avoiding the use of timeouts fixed most of them.
  90. A small number of tests had to be reworked.