6

This is a "design" or a "best-practices" theoretical question.

Most commonly web apps that use websocket connections use at most one websocket connection. However, there are no limitations for a web app to use more e.g. 10. More websocket connections might be chosen for data separation or clean code use cases (obviously there's more).

My question is - Is there a significant difference (in terms of performance, uptime, etc.) between having a one open websocket and having, let's say, ten open websockets in your webapp?

Also, imagine these two architectures. In the upper one the webapp opens as many websocket connections as it needs. In the lower one the webapp has always only one websocket connection to a "proxy" server and that "proxy" server opens websocket connections to as many endpoints as needed.

enter image description here

Question - Could you point some theoretical (practical) insights of why would one choose one architecture over the other? P.S. the lower one seems to be over-complicated.

Thank you!

Laimonas Sutkus
  • 3,247
  • 2
  • 26
  • 47
  • What is the use-case of websockets in this solution? What kind of communication pattern do you expect? – Jonas Dec 04 '20 at 17:15
  • Nothing specific. It's just something that has popped into my mind. Let's say it's a two-way communication - sometimes frontend decides to send some frames, sometimes backends decide to send some frames. – Laimonas Sutkus Dec 07 '20 at 17:13
  • As with everything; it depends. The amount of open connections will no doubt have an impact in performance if you expect to have many concurrent users. Even for idle connections, connection tracking is not free. For most backend stacks this will directly translate to RAM usage. ... there are reasons why the web is moving less connections (HTTP/2 /3), not more. – istepaniuk May 17 '22 at 22:41

0 Answers0