Load Shedding with APIs

aditya goel
2 min readJan 7, 2023

--

Question: What is the concept of Load-Shedding ?

Question: What are the factors, based upon which we can be performing the Load-Shedding ?

Question: Share with an example, what would happen with all the dropped requests, while we are doing the Load-Shedding ?

Question: Demonstrate the step by step example to implement the Load-Shedding with Spring Boot based Microservice ?

Step #1.) First, we create the Spring boot based application :-

Step #2.) Secondly, the controller looks like this :-

Step #3.) Next, we would write the code for our FILTER as below :-

Step #4.) Now that we run our application :-

  • We start four different shells and we hit the curl from all 4 of them.
  • We can observe that, for first three requests, the request has been well accepted and response is well served, whereas for the 4th shell, the response “Service Unavailable” has been returned.

That’s all in this blog. If you liked reading this, do clap on the same. We would meet you in next topic on another blog.

--

--