Slashdot Mirror


How Facebook Keeps Messenger From Crashing On New Year's Eve (ieee.org)

Wave723 quotes IEEE Spectrum: On New Year's Eve, millions of people will use Facebook's Messenger app to wish friends and family a 'Happy New Year!' If everything goes smoothly, those messages will reach recipients in fewer than 100 milliseconds, and life will go on. But if the service stalls or fails, a small team of software engineers based in the company's New York City office will have to answer for it.
The article says the team "tested and tweaked the app throughout the year and will soon face their biggest annual performance exam," since Messenger's 1.3 billion monthly active users send more messages on New Year's Eve than any other day of the year. Many of them hit "send" at the exact moment when their clock strikes midnight, "and people often try to resend messages that don't appear to make it through right away, which piles on more requests."

The solution appears to be load testing, re-directing traffic, message batching, and discarding "read receipts" and temporarily disabling other minor Facebook functions -- or, more generally, what their engineering manager describes as "graceful degradation."

35 of 69 comments (clear)

  1. So... by Anonymous Coward · · Score: 2

    "The solution appears to be ..." Stuff we've known since 1999?

    1. Re: So... by Anonymous Coward · · Score: 1

      Release the hounds, Smithers

    2. Re: So... by edris90 · · Score: 1

      They could gain some humanitarian PR, simply making a statement that Facebook Messenger is shutting down temporarily to promote people to pay attention to the real people they are spending time with in person. . Saves buttload of money , avoid a shit ton of embarrassment and look like they cared about peoples psychological health.

    3. Re:So... by jrumney · · Score: 1

      I find it hilarious that the fix for overloading caused in part by people resending messages which don't appear to have gone through, is to discard read receipts. Did anyone in the New York office that is going to be held responsible for the inevitable outage think this through? I wish you luck, Facebook.

  2. Facebook's New Slogan by Anonymous Coward · · Score: 1

    That should be Facebook's new corporate slogan: "Graceful Degradation."

  3. Simple by Sebby · · Score: 3, Insightful

    How Facebook Keeps Messenger From Crashing On New Year's Eve

    Simple, do awful things that will make people avoid using any of your services.

    --

    AC comments get piped to /dev/null
    1. Re:Simple by KiloByte · · Score: 1

      Simple, do awful things that will make people avoid using any of your services.

      Facebook has been trying that for years; doesn't help.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
  4. How glib by SuperKendall · · Score: 4, Insightful

    "The solution appears to be ..." Stuff we've known since 1999?

    It's one thing to say you know how to do it...

    Quite another when literally BILLIONS of people are using your services all at once - especially around NYE where it's not even spread through the day, it's a huge DDOS equivalent with billions of messages at midnight exactly...

    Planning for that kind of load and super-extreme bursting is not easy, at all. No matter how much you "know".

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re: How glib by datavirtue · · Score: 1

      Yeah, it's called money. All you need is money.

      --
      I object to power without constructive purpose. --Spock
    2. Re:How glib by KiloByte · · Score: 1

      The vast majority of messages avoid that peak: hardly anyone waits for the exact midnight to send a message. So the load gets smeared onto quite a chunk of time.

      The engineering problem boils down to: send short messages between pairs of arbitrary sources and destinations (although usually the source and destination are close to each other), with message size usually within 50-100 bytes. Let's be generous and say that with metadata they fit within 1500 bytes. Hmm... I wonder, have we seen such a problem before?

      Let's estimate the flow: after everyone raises the toast, exchanges hugs and kisses, says greetings, then sits down with the phone -- sending, let's say, 10 messages. This should take around half an hour. You get 300K messages per second. Not so impressive...

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    3. Re:How glib by Anonymous Coward · · Score: 1

      One DDoS per hour then

    4. Re: How glib by donstenk · · Score: 1

      Actually, it _is_ spread throughout the day. Itâ(TM)s not NYE at the same time in the world ;-)

      --
      Dennis Onstenk
    5. Re:How glib by KiloByte · · Score: 1

      How long would it take if one of those FB-generated movies about you and your friend were sent?

      I'm pretty sure there's not a single device with Fecesbook not blocked on multiple levels within ten meters from my current position. On the other hand, what friend? I spent the NYE fitting a dual-slot external-power-needed graphics card into a board on which the PCIe x4 slot takes most of the board's length -- the stereotypes about our kind won't reinforce themselves :p

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
  5. Just don't by jwhyche · · Score: 2

    Want to keep it from crashing on New Year's Eve? Just to load the damn thing. There, simple. Problem solved.

    --
    I read at +2. If your post doesn't reach that level I will not see or respond to it.
  6. "graceful degradation." by grep+-v+'.*'+* · · Score: 1

    what their engineering manager describes as "graceful degradation."

    If they'd just use SystemD their problems would be solved! For that matter though, I wish FaceBook would gracefully degrade to /dev/null.

    Good luck to them though, it's a good engineering textbook problem. Stupid, yet necessary. (We have specific peak load times because we just do. Same thing with water supply and SuperBowl breaks, or 8AM/5PM rush-hour traffic.)

    FB should also offer a "delivery within 100ms or your money back!" guarantee. See? The timestamp says it was _delivered_ to _our_ servers in 100ms; it's not OUR fault that the carrier couldn't get thru ... for a week, it's that missing Net Neutrality thing that routinely hits and throttles NetFlix. Yeah, that's the ticket.

    OTOH they could use one of the internet broadcast functions -- "Happy New Year" simulcast everywhere. And actually, I bet they've got a embedded HNY compression bit somewhere to slightly lessen the transfer load, the same for a few other extremely common phrases.

    --
    If the universe is someone's simulation -- does that mean the stars are just stuck pixels?
  7. Loadbalancing... by shabble · · Score: 4, Funny

    ... couldn't they simply split their users up into, say, 24 groups, and reduce the load that way?

    1. Re:Loadbalancing... by sj26 · · Score: 1
      https://infiniteundo.com/post/...

      56. There are only 24 time zones

  8. translation: by Lehk228 · · Score: 1

    facebook messenger is brittle poorly tuned garbage that cannot handle an ordinary upsurge in human use. AIM never had to be reengineered to survive new years eve without crashing, and it wasn't really all that good it just wasnt a flaming heap of shit

    --
    Snowden and Manning are heroes.
    1. Re:translation: by Actually,+I+do+RTFA · · Score: 1

      FB Messenger is harder to handle loads, because they need to run machine learning on all the messages to build better profiles of their users.

      --
      Your ad here. Ask me how!
    2. Re:translation: by helpfulcorn · · Score: 1

      No, it just crashed at other points. The service where buddies were stored (feedbag) had a disastrous set of databases and there were times they all just went down *or* the whiscer (and others, essentially presence) services went down, and no buddies would show, and so people would sign off and on repeatedly trying to fix it slowing down the entire thing. It was all held together with gun tape and faith, at least in the late 90s and very early 2000s.

      There was never a test like that for AIM because people weren't on their PCs at home during new year typically and mobile IM was not that huge. I can assure you it was a flaming heap of shit of a ridiculous amount of services that somehow managed to work most of the time. AIM probably could have never gotten much bigger than it did at its height and surely never could have handled Facebook level traffic. Facebook is just slightly less poorly engineered.

  9. By stealing dimes from the Elves by Anonymous Coward · · Score: 1

    By stealing dimes from the Elves?

  10. Money doesn't (fully) help by SuperKendall · · Score: 1

    Yeah, it's called money. All you need is money.

    How many years did we all have to suffer through Twitter Fail Whales while they were flush with cash?

    There are plenty of examples of giant well funded enterprises with websites that utterly suck and can handle just about no load - especially if you look at websites where tech is secondary, any kind of unexpected load and BAM they are usually down.

    Money can indeed help to buy the servers you may really need to handle load. Money can even help hire the people that understand how to handle load.

    But money does not ENSURE you will have either thing.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  11. I don't understand by AndyKron · · Score: 1

    There's something like 26 midnights (timezones) around the world. Where's the problem?

  12. Think again, your numbers are absurdly low by SuperKendall · · Score: 2

    The vast majority of messages avoid that peak: hardly anyone waits for the exact midnight to send a message. So the load gets smeared onto quite a chunk of time.

    Look around you at the next NYE party and you will see just how wrong you are. Most people queue them up ahead of time and lots of people are hitting Send as the ball drops... (hint to devs, if someone has typed a partial message transmit that to the server in case they come back and hit send later - course Facebook was just screwed by that recently when it was found they had cached images on the server from never sent messages...).

    At least it is spread across time zones but that is still a LOT of people, especially from the U.S. coasts.

    The engineering problem boils down to: send short messages between pairs of arbitrary sources and destinations (although usually the source and destination are close to each other), with message size usually within 50-100 bytes. Let's be generous and say that with metadata they fit within 1500 bytes

    Come on man, you know that modern web API's are not that compact, and we are talking Facebook here. You are off by an order of magnitude at least, way more when you stop to think that on NYE way more people are sending images also... One single response to a post on Facebook I just did with 14 words had a 9.5kb body going out, and a 21.2 k response.

    Let's estimate the flow: after everyone raises the toast, exchanges hugs and kisses, says greetings, then sits down with the phone -- sending, let's say, 10 messages. This should take around half an hour. You get 300K messages per second. Not so impressive...

    Think MILLIONS, possibly BILLIONS and you might be closer to the mark. On a *normal* day, Messenger and Whats App process over 60 billion messages a day... so that is 2.5billion messages every hour *normally*.

    And that was from 2016. Do you think people send more, or fewer messages now than then!

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:Think again, your numbers are absurdly low by KiloByte · · Score: 1

      Look around you at the next NYE party and you will see just how wrong you are. Most people queue them up ahead of time and lots of people are hitting Send as the ball drops...

      Ouch. At least there are no "smart"phone zombies so bad anywhere near me, neither among low-tech nor high-tech friends.

      hint to devs, if someone has typed a partial message transmit that to the server in case they come back and hit send later

      And that'll speed up that 14 words message... how?

      On a *normal* day, Messenger and Whats App process over 60 billion messages a day

      Thanks for the correction, I based my estimates on numbers in the article's summary.

      Come on man, you know that modern web API's are not that compact, and we are talking Facebook here. You are off by an order of magnitude at least, way more when you stop to think that on NYE way more people are sending images also... One single response to a post on Facebook I just did with 14 words had a 9.5kb body going out, and a 21.2 k response.

      I'm talking about the problem to solve not their implementation. Of course Facebook runs a PHP script that runs a bunch of NPM modules to produce a 1.5MB response, but after you cut down that bloat, you can get the same result with orders of magnitude less resources.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    2. Re:Think again, your numbers are absurdly low by SuperKendall · · Score: 1

      Ouch. At least there are no "smart"phone zombies so bad anywhere near me, neither among low-tech nor high-tech friends.

      I am highly doubtful the people around you are as pure as you claim.

      And that'll speed up that 14 words message... how?

      Read again about actual message sizes instead of fixating on content size alone. You want to get that traffic up t the server ASAP and send only a rigger signal. Even if it WERE just 14 words it would still be... rather nice to have a few billion 14 word messages already transmitted to the server and ready for destination ahead of time.

      I'm talking about the problem to solve not their implementation.

      Article is literally about Facebook. That is the problem to solve for, given how it is built.

      Of course Facebook runs a PHP script that runs a bunch of NPM modules to produce a 1.5MB response

      Not really.

      --
      "There is more worth loving than we have strength to love." - Brian Jay Stanley
    3. Re:Think again, your numbers are absurdly low by kriston · · Score: 1

      Of course Facebook runs a PHP script that runs a bunch of NPM modules to produce a 1.5MB response

      You honestly don't believe each request to a server spools up a new PHP script instance like it's still 2006, do you?

      --

      Kriston

    4. Re:Think again, your numbers are absurdly low by KiloByte · · Score: 1

      They forked PHP as HHVM, optimized the hell of it, and do some recompilation to C++, yeah. But you can optimize it only so much.

      PHP is a shithouse -- and I don't mean a building you defecate in, I mean one whose structural material is dried excrement (as still done by some tribes). It might have been adequate for a literal "Personal Home Page" with little traffic, but trying to throw more hardware at it to get it to scale to modern Facebook workloads is a fool's errand. It's kind of like banks running unmanageable COBOL code from 1960 on emulators.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    5. Re:Think again, your numbers are absurdly low by KiloByte · · Score: 1

      Article is literally about Facebook. That is the problem to solve for, given how it is built.

      That's an XY problem -- if the transport has scaling issues, instead of throwing more hardware at it at some point it's good to take a step back and see if there are better approaches. And the core functionality is so simple that replacing just that part while keeping parts of the several-hundreds-of-megabytes-per-phone bloat they insist so much on having intact is a viable proposition.

      --
      The creatures outside looked from Alt-Right to Antifa; but already it was impossible to say which was which.
    6. Re:Think again, your numbers are absurdly low by kriston · · Score: 1

      My point is that every click doesn't spawn a new PHP instance in their architecture unlike regular PHP.

      COBOL is running just fine--its only problem is the lack of human knowledge in the marketplace.

      And, at least with IBM COBOL, today's IBM z/OS runs COBOL programs originally compiled on the System/360 in the 1960s.

      --

      Kriston

  13. WTF by ledow · · Score: 4, Interesting

    Millions of people.. sending a small TCP packet... containing a couple of hundred characters...

    Wow. Gosh. The infrastructure that must take to handle...

    Like... a couple of servers in a rack and a few gigabits of uplink at worst.

    Honestly, has modern technology come to this?

    One single YouTube video probably has more bandwidth, more data transferred, more CPU usage and less latency.

  14. Re:Everything old is new again by AndyKron · · Score: 1

    I still have an old rotary phone hanging in my basement complete with a Mr. Yuk sticker.

  15. WTF Commenters by Anonymous Coward · · Score: 1

    There's no way to reply to all the misinformed commenters here, but I'm really surprised at how naive the majority are. Clearly most of you have never worked with problems at this scale...this is a far more difficult problem to solve than you all think.

  16. Graceful degradation by Bengie · · Score: 4, Insightful

    "Graceful degradation" is the unsung hero of properly engineered systems.

  17. By pissing people off? by BishopBerkeley · · Score: 1

    Another factor may be that FB pissed so many people off by abusing their privacy that they deleted Messenger altogether. I did, anyway. Come on, people. Invite your friends for a gathering or accept another friend or family member's invitation. A messenger greeting blast has about as much impact and is about as memorable as a highway billboard encountered at 80 miles per hour. Do something meaningful.

    --
    "...who search the reason of things
    Are those who bring the most sorrow on themselves." --Euripides, The Medea