http/2: make MAX_CONCURRENT_STREAMS configurable
many long connection continuous connect to envoy, and call use grpc stream channel to backend grp stream server, when after many connections(about 6000 connections) connected and send call, but the envoy return 503 to client, and not pass request to backend server
such as below: client -> envoy -> grp_strean_server
some log : [debug][pool] max requests overflow
the envoy circuit_breaks config :
server::default_priority::max_connections::300000 server::default_priority::max_pending_requests::2000000 server::default_priority::max_requests::1000000 server::default_priority::max_retries::300 server::high_priority::max_connections::300000 server::high_priority::max_pending_requests::2000000 server::high_priority::max_requests::1000000 server::high_priority::max_retries::300
Please post full config and output of /stats and /clusters in a gist when this problem happens.
With that said, this is likely due to: https://github.com/lyft/envoy/blob/master/source/common/http/http2/conn_pool.cc#L249
Right now we effectively hard code max concurrent streams to 1024 for http/2 connection, and we only have 1 http/2 connection per connection pool (times concurrency in the server). Also, we are also at the whim of the other side in terms of what they set max concurrent streams to for each http/2 connection.
The best way of "fixing" this is probably to a) max max concurrency per connection configurable and b) to allow http/2 connection pools to actually have more than 1 connection. a) is easy, b) is not easy.
Thanks for reply. My case is like that, many front client(grpc stream) connect to envoy, when connected, the client send a request to envoy which forward to backend server. The connection do not close and the http2 stream do not destroy, because i want to use envoy as a long connection access server, and the backend server is grpc stream service. When i use --concurrency 1, the max connections is 1024 because of :1.MAX_CONCURRENT_STREAMS limit 2.Request is type of grpc stream, it do not destroy after call to backend server, it will keep the stream http2 stream util the front client tcp connection closed.
I can solve this problem though 2 ways : a) Max max concurrency per connection configurable and This way, i need to rewrite this code, and rebuild.
static const uint64_t MAX_CONCURRENT_STREAMS = 1024;
b) To allow http/2 connection pools to actually have more than 1 connection. This way, it is hard to do, and i don't know how to do it. c) To allow concurrency is very large This way, set the param --concurrency very large, so that, the envoy will create more connections to the backend server. If there is 409600 front client connect to envoy, it will need 409600/1024 = 400 worker threads at least, but this is the ideal situation which all front client connect is averagely connect to per thread, so in fact, it need more worker threads, at the same time, too many work threads will make the machine's cpu and memory very high. Even if very large work threads, it also work not very well, because we can't make the front client is oppositely averagely connect to per thread, it is not under control.
The last question, The MAX_CONCURRENT_STREAMS param will support set by config?
The MAX_CONCURRENT_STREAMS param will support set by config?
If you are asking will we add config support so this is configurable, I think we should, but someone has to do it. Also, note that you are at the whim of the http/2 stack on the other side. If they limit stream concurrency, you will have a similar issue: https://tools.ietf.org/html/rfc7540#section-6.5.2
thanks! i changethe MAX_CONCURRENT_STREAMS , set a very large number, and then rebuild, at the same time i set the backend grpc server change the limit is very large number, and then it work ok.
add a pull request #981 , work in progress.
Closing in favor of other issues and open PRs.