0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00
Commit graph

3 commits

Author SHA1 Message Date
Loïc Hoguin
1724575b42
Avoid resetting HTTP/2 idle_timeout timer too often
Following the same strategy as Websocket described in
commit cbed21c383e4cebb7df5a0a8b81f18c1738bef3e

Gains are comparable as far as Websocket over HTTP/2
is concerned.
2025-01-15 13:31:19 +01:00
Loïc Hoguin
086f60cca4
Avoid resetting Websocket idle_timeout timer too often
`perf` has shown that Cowboy spends a lot of time
cancelling and starting this timer. Instead of resetting
for every data received, we now only reset a field in the
state.

Before it was working like this:

- start idle timeout timer
- on trigger, close the connection
- on data, cancel and start again

Now it's working like this:

- start idle timeout timer for a tenth of its duration, with tick number = 0
- on trigger, if tick number != 10
  - start the timer again, again for a tenth of its duration
  - increment tick number
- on trigger, if tick number = 10
  - close the connection
- on data, set tick number to 0
2025-01-15 13:31:19 +01:00
Loïc Hoguin
643b335ba8
Add ws_perf_SUITE to measure Websocket performance
It benchmarks binary, ascii, mixed and japanese data
using Websocket and Websocket over HTTP/2.

HTTP/2 options get set to ensure that performance is
better than the default HTTP/2 options.

It switches to Gun and Ranch branches that include
fixes that are required for tests to complete successfully.
2025-01-15 13:28:57 +01:00