Sudden surges in network traffic—regardless of the reason—can severely impact the performance of an API, even to the point of overwhelming it. Apigee has a built-in policy capable of handling such surges: the Spike Arrest policy. In this hands-on lab, we’ll implement the Spike Arrest policy and configure it so that traffic is throttled on a per-developer basis.
Successfully complete this lab by achieving the following learning objectives:
- Add the Spike Arrest Policy
- On the Apigee dashboard page, click API Proxies.
- Choose LA-Weather from the list of proxies.
- Switch to the DEVELOP tab.
- In the Proxy Endpoints section of the Navigator, select PreFlow.
- In the Request area, click + Step.
- Under Traffic Management, select Spike Arrest.
- Leave the default names and click Add.
- If necessary, drag the Spike Arrest policy so that it is among the first executed.
- Set the Desired Parameters
- Select the Spike Arrest policy.
- Modify the code to the following:
- Click Save.
- Test for Spiking Traffic
- Select the TRACE tab.
- In the URL field, add the following query parameters to the API proxy URI:
If you do not have a OpenWeatherMap API key, use
- Click Start Trace Session.
- Click Send 3-4 times within a minute.
- Review the results.
- Change the
devparameter value to 2.
- Click Send again.