Live data from Hacker News

Handling 1M websocket connections in Go

github.com

1–10 of 68 posts

Re: Handling 1M websocket connections in Go

#4
post #3

I thought you can make only 65k connections per port because of TCP limitations.

The limit is 65k connections per client IP address, limited by the number of available ports on the client. You can theoretically accept connections from all possible client IP addresses simultaneously.

This means that in order to test 1M simultaneous connections, you would need to use at least 16 client IP addresses. Probably more.

Re: Handling 1M websocket connections in Go

#5
post #3

I thought you can make only 65k connections per port because of TCP limitations.

The limit is only between a single client and server ip, since there can only be up to 65k source port/ip pairs (assuming the destination port is a single port, which it seems to be in the code examples). So if there are multiple client ips it seems like it's not an issue.

https://stackoverflow.com/a/2332756

Re: Handling 1M websocket connections in Go

#6
post #3

I thought you can make only 65k connections per port because of TCP limitations.

Deep down, the key for a connection is the concatenation of SA DA SP DP. DA and DP are constant for a given service in the simple case and the others are 4 octets [although not all of it usable] for IPv4 and 2 octets (for port).

Re: Handling 1M websocket connections in Go

#7

Can someone make a comparison between this and the Elixir Phoenix 2m websocket conmections example. I want to sleep.

I remember seeing a talk on the 2m websocket Elixir example and one of the keys to it was that the sockets were actually being used and processing messages intermittently during the test. Important thing to keep in mind vs simply opening.

The other thing I'd be interested to see Elixir demonstrate would be doing a hot deployment to avoid triggering all 2m connections to try reconnect at the same time.

The other important note with the Phoenix example was that they were starting 3 processes for each socket (to supervisor, handle failures/reconnects) if I remember correctly.

Re: Handling 1M websocket connections in Go

#9

Can someone make a comparison between this and the Elixir Phoenix 2m websocket conmections example. I want to sleep.

Do you have a link to that Elixir one by any chance?

https://phoenixframework.org/blog/the-road-to-2-million-webs...
Post reply on HN