grpc / grpc-web

gRPC for Web Clients
https://grpc.io
Apache License 2.0
8.6k stars 765 forks source link

Multiple server-side streaming calls hangs the browser #1104

Open Name-X opened 3 years ago

Name-X commented 3 years ago

We have a web page where more than 1 grpc calls (server side streaming calls)will be made , and all these will be pending state until the server responds with one response at least. If the number of these calls increases to 8 or 10 ,and the server doesn't send any response , subsequent normal calls are also getting blocked , making the UI unresponsive. Is there any limitation on having number of server-side streaming calls from browser

Name-X commented 3 years ago

@stanley-cheung any comments on this ?

ryanpbrewster commented 3 years ago

If you are using Chrome or Firefox, you may be running into a limit on the number of open connections (see https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events).

When not used over HTTP/2, SSE suffers from a limitation to the maximum number of open connections, which can be especially painful when opening multiple tabs, as the limit is per browser and is set to a very low number (6).

In the past when I've hit this issue I've worked around it by establishing a single connection and pushing all messages over it.

Name-X commented 3 years ago

@ryanpbrewster , I am using http/2 only , in browser console i can see the calls are made with http/2. Still I am facing this issue. In my use case , i can't have a single endpoint and push all messages over it . There will be different servers sending messages