Hacker News new | ask | show | jobs
by tunesmith 4047 days ago
I'm curious what the bounds are on the client-side use case. For instance, machines can handle tons of simultaneous http connections, but it's easier to reach that limit if you hold SSE connections open for a while.

I've used SSE in the context where we sent chunked pages of one output stream (where the stream was generated server-side all at once), but not where the connection is opened and then actually waiting for additional server information. Is it common for SSE connections to be held open for 30 seconds or even several minutes to be able to stream information?

2 comments

Both Chrome and Firefox limit you to 6 simultaneous http connections to the same host. Try opening this app in 7 separate tabs, and you'll see the 7th one just spin and not even load the page's HTML.

At least in Firefox, the limit for websockets is much more generous (200, but shared across the whole browser, IIRC).

Both the Chrome and Firefox dev teams WONTFIXed my suggestion to increase the limit for Server Sent Event connections.

https://code.google.com/p/chromium/issues/detail?id=275955

https://bugzilla.mozilla.org/show_bug.cgi?id=906896

SSE lets you keep the connection as long as you want. I am not sure what you mean by client-side. If you mean Web Browser then I believe there is certain limit of parallel HTTP connections that you can have depending on the browser. http://stackoverflow.com/questions/985431/max-parallel-http-....
I'm more wondering about the number of open HTTP connections that a server can support. Googling around, I see mentions of 64,000 for vanilla servers, perhaps millions depending on the server (affected by # of processor...?)

So if your SSE connection is 10 minutes long and you might have more than 64,000 simultaneous connections to your vanilla box in those 10 minutes, you just need to start load-balancing I guess.

There's a common misconception about the number of TCP connections a server can handle being limited by the number of local ports (~64K). The real limit is in the number of LocalIP+LocalPort+RemoteIP+RemotePort pairs. If your traffic is coming from arbitrary Internet addresses, then you are not limited by ports.

Of course you'll be limited by other factors such as kernel fd limits (which are adjustable) and the CPU needed to monitor lots of sockets.

The issue with maximum open connections will go away with HTTP/2, and you can get around it today using SPDY since both multiplex connections to a domain.