You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I have mentioned in #9355 that for some reason Cowboy's HTTP/2 over TCP is much slower than HTTP/2 over TLS. This ticket is meant to expand on that.
For the next version of Cowboy I have added a benchmark using Common Test. One of the benchmark tests is the upload of a 10GB file to Cowboy. If I use that benchmark against the current version of Cowboy, it takes more than 20 minutes to complete (I gave up). Meanwhile HTTP/2 over TLS takes about 3/4 minutes. Both TCP and TLS use the same configuration, including default buffer sizes in this scenario.
HTTP/1.1 does not suffer from this problem despite roughly the same amount of data being transferred.
On Cowboy master the optimisations have helped immensely so the problem is no longer visible. Still I would like to make sure that there isn't a problem in OTP that leads to this.
The perf flame graph capturing the first minute of the benchmark looks like this:
Additional context
I will build a more recent version to confirm it still happens. Unfortunately Arch Linux has just split the Erlang package into many packages...
The text was updated successfully, but these errors were encountered:
To further illustrate why I think there may be an issue, uploading a 10GB body in Cowboy 2.12 (with default buffer), per protocol:
HTTP/1 over TCP: 111s
HTTP/1 over TLS: 100s
HTTP/2 over TCP: 1430s
HTTP/2 over TLS: 214s
And in upcoming Cowboy 2.13 (with buffer set dynamically based on size of data received from the socket):
HTTP/1 over TCP: 9s (11x faster)
HTTP/1 over TLS: 13s (8x faster)
HTTP/2 over TCP: 25s (57x faster)
HTTP/2 over TLS: 28s (7.5x faster)
To trigger the issue, specific settings are needed (such as a large maximum HTTP/2 frame size) so there is clearly an inefficiency in the work that Cowboy performs (it does more binary appends). But I would not expect HTTP/2 over TCP to perform so much worse than HTTP/2 over TLS with the same settings (something in ssl likely prevents the issue). It is one order of magnitude worse than it should.
Edit: Forgot to add, there's similar order of magnitude differences in other benchmark scenarios, such as uploading 1MB bodies repeatedly. Basically if the data is large enough, HTTP/2 over TCP performance is abysmal.
Describe the bug
I have mentioned in #9355 that for some reason Cowboy's HTTP/2 over TCP is much slower than HTTP/2 over TLS. This ticket is meant to expand on that.
For the next version of Cowboy I have added a benchmark using Common Test. One of the benchmark tests is the upload of a 10GB file to Cowboy. If I use that benchmark against the current version of Cowboy, it takes more than 20 minutes to complete (I gave up). Meanwhile HTTP/2 over TLS takes about 3/4 minutes. Both TCP and TLS use the same configuration, including default
buffer
sizes in this scenario.HTTP/1.1 does not suffer from this problem despite roughly the same amount of data being transferred.
On Cowboy master the optimisations have helped immensely so the problem is no longer visible. Still I would like to make sure that there isn't a problem in OTP that leads to this.
The perf flame graph capturing the first minute of the benchmark looks like this:
This is probably not normal...
How to investigate this?
To Reproduce
To test TLS just change the last command:
Perf can be enabled by applying the following patch:
Expected behavior
Less time in libc 😆
Affected versions
OTP-27.1.2, OTP-27.2.2
Additional context
I will build a more recent version to confirm it still happens. Unfortunately Arch Linux has just split the Erlang package into many packages...
The text was updated successfully, but these errors were encountered: