Live data from Hacker News

Defcon: Preventing overload with graceful feature degradation (2023)

micahlerner.com

81–90 of 107 posts

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#81

Isn't this referred to as Load Shedding in some circles? If its not, can someone explain how its different?

This is the other side of the load shedding coin.

The situation is that A depends on B, but B is overloaded; if we allow B to do load shedding, we must also write A to gracefully degrade when B is not available.

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#82

> if (disableCommentsRanking.enabled == False) This could use some light-touch code reviewing

Because the HN crowd likes learning new things: if `enabled` is a nullable boolean in C# (i.e. has type `bool?`) then this check must indeed be written this way, to avoid confusing null with false.

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#83
post #39

I'm surprised they don't have automated degradation (or at least the article implies that it must be operator initiated). We built a similar tool at Netflix but the degradations could be both manual and automatic.

There's definitely automated degradation at smaller scale ("if $random_feature's backend times out, don't show it", etc.).

The manual part of Defcon is more "holy crap, we lost a datacenter and the whole site is melting, turn stuff off to bring the load down ASAP"

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#84
post #2

Am I reading the second figure right? Facebook can do 130*10^6 queries/second == ‭130,000,000‬ queries/second?!

I think about 10 years ago when I was working there I checked the trace to load my own homepage. Just one page, just for myself, and there were 100,000 data fetches.

By "homepage" you mean your Facebook profile?

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#85

Earlier quoted context omitted.

The developer, tester and devops time required to properly implement graceful degradation could easily accumulate to hundreds of hours. Those hours are directly expensive when your developers cost hundreds of dollars a day; and have a material opportunity cost in that their commitment to one particular project delays the delivery of other features. Moreover, any new features would have to be made compatible with the…

Could be as simple as just some feature flags with environment variables

I also found that when building a feature iteratively, with feature flags for rollout, a simple feature degradation path often appears natively.

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#86
One of the most satisfying feature degradation steps I did with FastComments was making it so that if the DB went offline completely, the app would still function:

1. It auto restarts all workers in the cluster in "maintenance mode".

2. A "maintenance mode" message shows on the homepage.

3. The top 100 pages by comment volume will still render their comment threads, as a job on each edge node recalculates and stores this on disk periodically.

4. Logging in is disabled.

5. All db calls to the driver are stubbed out with mocks to prevent crashes.

6. Comments can still be posted and are added into an on-disk queue on each edge node.

7. When the system is back online the queue is processed (and stuff checked for spam etc like normal).

It's not perfect but it means in a lot of cases I can completely turn off the DB for a few minutes without panic. I haven't had to use it in over a year, though, and the DB doesn't really go down. But useful for upgrades.

built it on my couch during a Jurassic park marathon :P

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#87
post #82

> if (disableCommentsRanking.enabled == False) This could use some light-touch code reviewing

Because the HN crowd likes learning new things: if `enabled` is a nullable boolean in C# (i.e. has type `bool?`) then this check must indeed be written this way, to avoid confusing null with false.

I thought OP meant to imply that the readability could use some tweaking. You have 'disable', 'enabled' and 'False' used in the same expression so it requires some (more) thinking while reading it and trying to decipher what it's trying to do.

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#88
post #16

Earlier quoted context omitted.

This is how information slowly changes. The original numbers from facebook needed to be taken with a grain of salt. 2 billion a day raises it more. Facebook claims to have 2 billion accounts but no where near 2 billion unique accounts. I don't know what facebook calls an active user but it use to mean logged in once in the past 30 days.

No, the person you're responding to was correct. Facebook has over 2 billion daily active users [1], and DAU refers to unique users who used the product in a day [2]. 1: https://www.statista.com/statistics/346167/facebook-global-d... 2: https://www.innertrends.com/blog/active-users-measuring-busi...

Heh. Gave me a chuckle, because DAU also means "Dümmster Anzunehmender User" in German (dumbest assumed user, in context of creating idiot-proof software, and a wordplay on GAU, which means grösster anzunehmender Unfall, biggest assumed accident, which comes from fission power plants). And that kinda fits for the kind of people that perceivedly are left on the likes of Facebook and X.

Re: Defcon: Preventing overload with graceful feature degradation (2023)

#90

Earlier quoted context omitted.

Could someone tell me what these hundreds of requests could do?

A lot of them appear to be that they've split their javascript into a gazillion files for whatever reason (I suppose because they have several MB of it). But someone or lots of people there did seem to get addicted to dynamic loading. Like I've got 100 or so friends, but my friends page loads them 8-16 at a time as I scroll. Just send all 100 and set the profile pictures to deferred fetch. It'd probably be smaller th…

Could be so they can track what you're looking at on the back end
Post reply on HN