HTTP/2 client creating multiple TCP Connections

418 views
Skip to first unread message

envee

unread,
Mar 27, 2022, 6:17:20 PM3/27/22
to golang-nuts
I have a telecom client application which connects to an HTTP/2 server (5G telecom application server, to be exact). 
At startup, I create an HTTP/2 client using the net/http2 Transport.
It starts multiple goroutines each of which share/use the same HTTP/2 client connection to send HTTP POST requests to the server.

I was of the understanding that if an HTTP/2 client is reused across multiple goroutines, it will not end up creating multiple TCP connections.

What I observed was that this is not true with (nearly) each goroutine request triggering the creation of a TCP connection. This causes my application to run out of file descriptors. I could possibly get around this by setting the ulimit to be unlimited.

I then set the UseStrictMaximumConcurrentStreams flag in the http2/Transport object to True and this then restricted the client application to establish a single TCP connection.

But the issue I face is that at when I try to send extremely high number of concurrent requests (more than about 3000-4000 per second), I see an empty JSON request body being sent out.

So I guess I have 2 issues :

1) Why is my HTTP/2 client creating multiple TCP connections when the http2.Transport.StrictMaxConcurrentStreams is FALSE ? I am guessing this is because of a large number concurrent requests being made, but still I expect the http2 transport to manage that transparently.

2) When I do manage to create just a single TCP connection (by setting StrictMaxConcurrentStreams=TRUE) over which requests/responses are multiplexed, I see a NULL payload being sent in my HTTP/2 request.

Regards,
Neeraj


 

Neeraj Vaidya

unread,
Mar 30, 2022, 4:11:37 PM3/30/22
to golang-nuts
Hi All,
Any comments on my post ?

Regards,
Neeraj


On 28 Mar 2022, at 9:17 am, envee <neeraj....@gmail.com> wrote:

I have a telecom client application which connects to an HTTP/2 server (5G telecom application server, to be exact). 
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/b6aaca96-7bf1-4a8a-af57-78740742c6a0n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages