Scrivio Interview library
DesignAdvanced6 min read · updated 13 November 2026

A food delivery platform of 80 services has evening peaks and occasional overloads. Each service sheds randomly when overloaded, so placing an order is as likely to be dropped as a background refresh of restaurant ratings.

Design criticality-based load shedding across the platform: how requests are classified, how the class travels through service calls, and how each service decides what to drop.

We define a few criticality levels with written rules, such as CRITICAL for placing and paying for orders and courier location, DEFAULT for browsing, SHEDDABLE for recommendations and prefetch, and BATCH. The edge assigns the level from the route and client type, it travels in a header or tracing baggage, and callees inherit the caller's level unless configured lower, so nothing can raise its own status. A shared library in every service measures overload and rejects the lowest level first, raising the bar step by step; asynchronous work gets separate lanes; and rejection metrics by level, alerts on CRITICAL shedding and game days prove the order holds.

Why this question is asked

When a food delivery platform is overloaded on a Friday evening, the worst outcome is not that some requests fail. It is that the wrong ones fail: a customer's order is dropped while a background refresh of restaurant ratings succeeds. Random shedding protects the servers but not the business. Interviewers ask this design question to see whether we can make every one of 80 services agree on what matters most, without a central bottleneck and without every team calling its own traffic critical. In this answer, we will define the levels, assign them at the edge, carry them through service calls, decide what to drop inside each service, extend the idea to asynchronous work, and make it visible and tested.

1Define a Few Criticality Levels

Criticality is a label on a request that says how bad it is to drop it. We keep the number of levels small, four is plenty, so everyone can remember what each means. CRITICAL covers what the business cannot lose: placing and paying for an order, and courier location updates that keep deliveries moving. DEFAULT covers normal user activity such as browsing restaurants and menus. SHEDDABLE covers work whose loss users barely notice: recommendations, prefetching, analytics events. BATCH covers background jobs that can wait minutes or hours.

The levels come with written rules and examples, and a small review group, typically reliability engineers and a product representative, decides what may be called CRITICAL. That review is what stops the label from losing its meaning.

Criticality levels for the platform
LevelExamplesShed when
CRITICALPlace order, pay, courier locationOnly at true capacity
DEFAULTBrowse restaurants, menus, order statusOverload continues after SHEDDABLE is gone
SHEDDABLERecommendations, prefetch, ratings refreshEarly in overload
BATCHReports, reindexing, analytics jobsFirst, at any sign of overload

2Assign the Level at the Edge

The level is set once, where requests enter the platform: the API gateway or edge proxy. It looks at the route and the client type, for example POST /orders from the customer app is CRITICAL and GET /recommendations is SHEDDABLE, using a route catalogue that the review group maintains. Any criticality header that arrives from outside is removed first, so clients cannot choose their own level.

Internal jobs that do not pass through the edge, such as a scheduled reindex, are given their level by configuration in the job framework, usually BATCH. Nothing starts a request without a level; a missing level is treated as DEFAULT for user traffic or BATCH for internal callers.

3Carry the Level Through Service Calls

The level travels with the request through every hop, in a header such as X-Criticality or in tracing baggage, the key-value context that OpenTelemetry propagates alongside the trace. A shared client library copies it onto every outgoing call automatically, so teams do not have to remember.

The important rule is inheritance with a ceiling: a callee uses the caller's level unless its own configuration says the call should be lower. The order service calling the payment service passes CRITICAL. But when the order service fires off a call to update recommendations, that call is configured as SHEDDABLE, even inside a CRITICAL request. And no service may raise the level it received. So a background job running at BATCH cannot borrow CRITICAL status by calling the same endpoints the checkout uses.

Java
enum Criticality { BATCH, SHEDDABLE, DEFAULT, CRITICAL } // ordered: lowest first
Criticality outgoing(Criticality incoming, Criticality configuredForThisCall) {
return incoming.compareTo(configuredForThisCall) < 0 ? incoming : configuredForThisCall; // the lower one
}
outgoing(CRITICAL, CRITICAL); // CRITICAL: order -> payment
outgoing(CRITICAL, SHEDDABLE); // SHEDDABLE: order -> recommendations update
outgoing(BATCH, CRITICAL); // BATCH: a batch job can never call in as CRITICAL

4Decide What to Drop Inside Each Service

Every service uses the same shared library for admission. It measures overload with signals that reflect real work: in-flight requests against a concurrency limit, how long requests wait in the queue, and CPU. From those it computes a load level and a bar: requests below the bar are rejected with 503 and Retry-After, requests at or above it are served.

The bar rises step by step. At mild overload, BATCH is rejected. As load keeps rising, SHEDDABLE goes too, then DEFAULT. CRITICAL is rejected only when the service is truly at capacity even after everything else has been shed. Because the steps are gradual, a small overload costs only background work, and users notice nothing.

Step throughThe rising bar inside one service
  1. Measure loadin-flight vs limit, queue time, CPU
  2. Above 80% of the limit?mild overload
    YesReject BATCHNoServe everything
  3. Above 90%?overload continues
    YesAlso reject SHEDDABLENoKeep current bar
  4. At the limit?still rising
    YesAlso reject DEFAULTNoKeep current bar
  5. Beyond the hard limit?only now
    YesReject CRITICAL tooNoCRITICAL keeps being served

5 steps in order. Play them, or step through them one at a time.

Notice the benefit of a shared library rather than 80 implementations: the same rules, the same metrics names and the same tuning everywhere, and a fix in one place reaches every service.

5The Same Idea for Asynchronous Work

A lot of this platform's work flows through Kafka: order events, courier updates, notifications, analytics. If urgent and batch messages share a topic and a consumer, a backlog of analytics events delays order confirmations. So asynchronous work gets separate lanes: different topics, or different consumer groups with their own capacity, for urgent and for batch messages.

Under overload, consumers of batch lanes pause or slow down first, so the consumers of urgent lanes keep the shared resources, such as the database, to themselves. This is the asynchronous version of raising the bar.

6Make It Visible and Tested

Shedding must be observable. Every service exports rejection counts by level and by route, so dashboards show at a glance that, say, the menu service shed 30 percent of SHEDDABLE traffic for ten minutes. An alert fires whenever CRITICAL traffic is shed anywhere, because that means the system ran out of every other option and someone should look.

Finally, we test the ordering. Load tests push services into overload with a realistic mix and check that BATCH and SHEDDABLE are dropped first and that CRITICAL success stays near 100 percent. Game days do the same in production-like conditions. Without tests, a misconfigured route or a library version that ignores the header can quietly turn the scheme back into random shedding.

7Follow-up questions

How do you stop every team from labelling its traffic critical?

Several mechanisms work together. Teams cannot set the level for user traffic at all; the edge assigns it from a route catalogue that the review group owns, and changes to CRITICAL need a short written justification and approval. Inheritance means services can only lower a level, never raise it. Each service has a CRITICAL budget, for example CRITICAL may not exceed a set share of its capacity, and dashboards show each team's share of CRITICAL traffic, so growth is visible. And the rule has a reason everyone can accept: if everything is critical, nothing is protected, including their own important requests.

What happens to a CRITICAL request whose dependency sheds its SHEDDABLE sub-call?

The CRITICAL request continues without that part, for example the order is placed but the recommendation update is skipped. That is why sub-calls marked SHEDDABLE must be optional in the caller's code, with a fallback or a later retry.

Should clients retry shed requests?

CRITICAL requests yes, with backoff and jitter. SHEDDABLE requests usually not, since the next screen load will ask again.

8Conclusion

In this answer, we designed criticality-based shedding for 80 services: four levels with written rules and a review, assignment at the edge from the route and client, propagation in a header or tracing baggage with inheritance that can only lower a level, a shared library that raises the rejection bar step by step, separate lanes for asynchronous work, and metrics, alerts and tests that keep the order honest.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start with a small set of levels and clear rules: CRITICAL for placing and paying for orders and courier location, DEFAULT for browsing and menus, SHEDDABLE for recommendations, prefetch and analytics, and BATCH for background jobs, with a small review group deciding what may be critical.

Then, if they want more

The level is assigned once at the edge, from the route and the client type using a route catalogue, and any incoming criticality header from outside is stripped. It then travels in a header or OpenTelemetry baggage, copied onto every outgoing call by a shared client library.

Callees inherit the caller's level unless the call is configured lower, and nobody can raise it, so a batch job cannot borrow critical status.

Inside each service, a shared admission library measures overload from in-flight requests, queue time and CPU, and rejects the lowest level first with 503 and Retry-After, raising the bar step by step, so CRITICAL is only rejected when the service is truly at capacity.

For asynchronous work I would use separate topics or consumer groups as priority lanes, so batch messages never delay urgent events. And I would make it visible and tested: rejection metrics by level and service, an alert whenever CRITICAL is shed, and load tests and game days that confirm the ordering holds under real overload.

About this answer

Last updated
13 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Design criticality-based load shedding across the platform: how requests are classified...": https://scrivio-interview-library.netlify.app/architecture/high-availability/05ab74ba3f/