Skip to content

Latest commit

 

History

History
42 lines (28 loc) · 1.99 KB

BP_4022_en.md

File metadata and controls

42 lines (28 loc) · 1.99 KB

Limit HTTP API calls

Identifiers

GreenIT V2 V3 V4
4022

Categories

Life cycle Tiers Responsible
2. Design Datacenter Software Architect/Developer

Indications

Priority Implementation difficulty Ecological impact
4 3 5
Saved resources
Processor / Network / Queries

Description

When users visit web pages, websites may retrieve content through an HTTP API (webservices). In those cases, each web page display will result in as many HTTP requests to different APIs even though content will probably be the same for some time.

As an API provider (server), you can set quotas to encourage users to define response caching strategies thus avoiding systematic calls. As an API user (client), you should cache retrieved results in order to be able to serve them again without systematically calling the HTTP API.

Example

  • You can probably limit the number of requests to one per day if you retrieve customer reviews through an API.
  • You can probably limit the number of requests to one per hour if you retrieve a Twitter feed to display on your site.
  • You can set up a 2-second cache to prevent thousands of simultaneous visitors to your site from generating thousands of API calls during the same second if you display "real-time" data on your site homepage.
  • As a provider, if you offer an API, you can set quotas per user and for a limited period of time.

Validation rule

The number of ... is equal to or less than
endpoints that do not benefit from a relevant caching strategy 0