How do you implement load shedding?

As I am running into a classical case of cascading failure on overload involving Django (i.e. my service is overloaded, thus slow to respond to its prober, thus the orchestrator decides to restart it, thus making the problem worse), I am looking into how to make my service degrade (more) gracefully. The only existing Django middleware I can find that addresses this seems unmaintained and quite limited (only looking at response time of requests). I also find nothing in the Django documentation about this topic.

How do Django operators normally deal with this? Do you actually do anything at Django-level or do you handle that in a reverse-proxy in front of Django?

If you’re doing something expensive on your view, that is taking a long time to process, you probably should be doing it outside of the django request/response cycle.
One common approach is to use celery to dispatch and process background tasks.
If you need more details, please provide the current code being executed by the view, and related models.

Hope that helps.

It helps in the sense that nobody reading this seems to be doing load shedding at the level of Django. So I should probably focus on doing it at another level of my stack (: