Optimize connection level remote flow control
Previously when connection level remote flow control window gets 0, we mark the stream having DATA frame with NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL. When connection level WINDOW_UPDATE is received, we checks all existing streams, including closed ones, and call nghttp2_stream_resume_deferred_data(). The profiler shows this is expensive. Now we prepare dedicated priority queue for DATA frames. And we don't mark stream with NGHTTP2_STREAM_FLAG_DEFERRED_FLOW_CONTROL when DATA cannot be sent solely due to connection level flow control. Instead, we just queue DATA item to queue. We won't pop DATA item from queue when connection level remote window size is 0. This way, we avoid the expensive operation for all streams when WINDOW_UPDATE is arrived.
Showing
This diff is collapsed.
Please register or sign in to comment