apply rate limiting policy

11
APPLY RATE LIMITING POLICY WITH MULESOFT API GATEWAY Vince Jason Soliza

Upload: vince-soliza

Post on 08-Jan-2017

318 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Apply Rate Limiting Policy

APPLY RATE LIMITING POLICYWITH MULESOFT API GATEWAY

Vince Jason Soliza

Page 3: Apply Rate Limiting Policy

Apply Policies in API ManagerThis presentation will show how to apply Rate Limiting Policy in API Gateway using Anypoint Platform for APIs

Page 4: Apply Rate Limiting Policy

Run in Anypoint Studio• Run the api application in anypoint studio

Note: Make sure the default api gateway port of 8081 is available.Skip this step if running with API Gateway Standalone outside Anypoint Studio or if deployed in Cloudhub.

Page 5: Apply Rate Limiting Policy

Apply Rate Limiting Policy• Login to anypoint platform and open the API Manager where we want to

apply the policy

• Click the Policies tab in the bottom part of the API Manager

Page 6: Apply Rate Limiting Policy

Apply Rate Limiting Policy• We can view the list of applied and currently available policies within the

API. Currently we have no applied policies.

• Look for the Rate Limiting policy then click Apply

Page 7: Apply Rate Limiting Policy

Apply Rate Limiting Policy• Set 10 Requests per second as our limit. Click Apply.

• Now we have successfully applied the Rate Limit policy

Page 8: Apply Rate Limiting Policy

Test Before Policy is Applied• Run the API using SOAPUI Load Test Runner with 20 requests per second

for 10 seconds.

• With a tps of 23.76 it accepts all the requests without a single exception.

Page 9: Apply Rate Limiting Policy

Test After Policy is Applied• Run the API using SOAPUI Load Test Runner with 20 requests per second

for 10 seconds.

• With a tps of 24.51 for 10 seconds there are 156 exceptions with error message: Tue Feb 23 12:53:37 PHT 2016:DEBUG:Receiving response: HTTP/1.1 429 Too Many Requests. This is because we set the rate limit policy to 10 requests per second only.It rejects the incoming request when the limit has been reached.

Page 10: Apply Rate Limiting Policy

Summary

• Rate limiting is used to control the rate of traffic sent or received by a network interface controller.

• A policy is a mechanism the gateway uses to enforce filters on traffic as it flows through the gateway. The Anypoint Platform for APIs comes with a number of pre-built policies including Rate Limiting, Throttling, OAuth 2, Basic HTTP Authentication, and XML and JSON threat protection.

https://docs.mulesoft.com/anypoint-platform-for-apis/api-gateway-101#what-is-a-policy

Page 11: Apply Rate Limiting Policy

QUESTIONS?Please leave a comment