3

After submitting an answer for this PPCG challenge, I decided it might be cool to try playing around with Stack Exchange's web sockets. A first interesting idea I thought of, just to play around, would be to monitor a tag, and figure out stats on questions posted, like how the frequency of questions asked changes throughout the day.

Would opening potentially several web sockets (and maintaining them by responding to heartbeats) cause any kind of issue to the network? Obviously, me alone opening several sockets isn't going to be significant, but is the use of web sockets, in general, a strain on the site? Is this a service that should only be used for certain purposes?

  • not a canonical answer, but if its problematic, they'll likely rate limit it. – Journeyman Geek Dec 14 '17 at 2:26
5

According to Nick Craver:

During peak, we have about 500,000 concurrent websocket connections open. That’s a lot of browsers. Fun fact: some of those browsers have been open for over 18 months. We’re not sure why. Someone should go check if those developers are still alive. Here’s what this week’s concurrent websocket pattern looks like:

websocket use

According to Marc Gravell:

The web-socket server I wrote hosts around half a million open sockets and runs at ~0% CPU

Then again, in a podcast Nick Craver described websockets as "pain in the butt" due to so many of them being supported by one Linux box, which ends up with a huge connection table. So it looks like there is some amount of strain there.

I imagine if the aforementioned box becomes unable to support that many connections, it's going to drop some, like those that are 18 months old.

In any case, you are more likely to put a real strain on the system by running expensive search queries on Stack Overflow, or scraping content as HTML pages instead of using the API.

  • Was hoping to get a mod or staff to give the go-ahead of "screw around all you like", but I'd likely only have a couple open. Compared to the half a million figure, that's petty. – Carcigenicate Dec 14 '17 at 17:27
  • @Carcigenicate You are not likely to get a "license" for your experiments. If they do not cause problems for SE, there is no issue. If they do, you will be cut off, license or not. Also: It's easier to ask forgiveness than it is to get permission. – user315433 Dec 14 '17 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .