aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_stream_h.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-12-04 11:17:34 +0100
committerLoïc Hoguin <[email protected]>2020-01-06 12:58:14 +0100
commitdb0d6f8d254f2cc01bd458dc41969e0b96991cc3 (patch)
tree5d77236bc703223fcb36e45cbf3de72de1763d50 /src/cowboy_stream_h.erl
parent592029070dea7c1f7b85d465e250ef6842e1a46b (diff)
downloadcowboy-db0d6f8d254f2cc01bd458dc41969e0b96991cc3.tar.gz
cowboy-db0d6f8d254f2cc01bd458dc41969e0b96991cc3.tar.bz2
cowboy-db0d6f8d254f2cc01bd458dc41969e0b96991cc3.zip
Use active,N
This reduces the number of times we need to ask for more packets, and as a result we get a fairly large boost in performance, especially with HTTP/1.1. Unfortunately this makes Cowboy require at least Erlang/OTP 21.3+ because the ssl application did not have active,N. For simplicity the version required will be Erlang/OTP 22+. In addition this change improves hibernate handling in cowboy_websocket. Hibernate will now work for HTTP/2 transport as well, and stray or unrelated messages will no longer cancel hibernate (the process will handle the message and go back into hibernation). Thanks go to Stressgrid for benchmarking an early version of this commit: https://stressgrid.com/blog/cowboy_performance_part_2/
Diffstat (limited to 'src/cowboy_stream_h.erl')
-rw-r--r--src/cowboy_stream_h.erl1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cowboy_stream_h.erl b/src/cowboy_stream_h.erl
index 2a50d6a..9f42acc 100644
--- a/src/cowboy_stream_h.erl
+++ b/src/cowboy_stream_h.erl
@@ -92,6 +92,7 @@ data(StreamID, IsFin, Data, State=#state{read_body_pid=Pid, read_body_ref=Ref,
send_request_body(Pid, Ref, IsFin, BodyLen, Data),
do_data(StreamID, IsFin, Data, [{flow, byte_size(Data)}], State#state{
read_body_ref=undefined,
+ %% @todo This is wrong, it's missing byte_size(Data).
body_length=BodyLen
});
%% Stream is waiting for data but we didn't receive enough to send yet.