Upgrade to Pro — share decks privately, control downloads, hide ads and more …

apidays London 2023 - API Green Score, Yannick ...

apidays
September 21, 2023

apidays London 2023 - API Green Score, Yannick Tremblais & Julien Brun, Green API Score

apidays London 2023 - APIs for Smarter Platforms and Business Processes
September 13 & 14, 2023

API Green Score : How to reduce the environmental impact of your APIs?
Yannick Tremblais, IT Innovation Manager for Groupe Rocher and Green API Score
Julien Brun, Head of APIs Center of Excellence at L’Oréal and Green API Score
------

Check out our conferences at https://www.apidays.global/

Do you want to sponsor or talk at one of our conferences?
https://apidays.typeform.com/to/ILJeAaV8

Learn more on APIscene, the global media made by the community for the community:
https://www.apiscene.io

Explore the API ecosystem with the API Landscape:
https://apilandscape.apiscene.io/

apidays

September 21, 2023
Tweet

More Decks by apidays

Other Decks in Programming

Transcript

  1. We are sharing our studies to external communities Active Member

    of the API Thinking Community head of workgroup “Sustainable digital API” External Communities • As there is no standard yet on the API Ecodesign • As environmental impact is a shared concern • as guideline and calculation rule must be shared and validated by many to be recognized
  2. Workgroup “Sustainable API” “API Numériquement Responsable” A collective that draws

    its strength from its members Since 2020, the 1st french collective dedicated to APIS Free Network Diversity
  3. Without action to limit the growth of the environmental impact

    of digital technology, its carbon footprint could triple between 2020 and 2050 ADEME-Arcep working group document listing potential game-changers in the digital sector
  4. The API Green Score is a toolkit to help API

    consumers, designers and owners to ask themselves questions about the digital impact of their APIs This tool is based on 7 differents domain in order to create relevant and realistic metrics that stakeholders can use The evaluation method is shared with all API Personas (API owners, API consumers, API developers) This toolkit concern eco-design and eco-consumption of API Excellent Acceptable Average Poor Very Poor A B C D E
  5. • Decommission an unused API • Deploy API near consumer

    • Reduce number of API versions • Unify API catalog • Create consumer referential • Identify API for single usage • Urbanization with Data Governance • Exchange with Smallest Size • Following API payload size • Prefer Opaque Token to JWT • API Customer Centricity principles • API Data / Granularity • Leverage Odata or GraphQL for DB APIs • Data Management • Dynamic Content • Optimize queries to limit returned information • Collect only required data • Provide only changed data • Use cache • Communicate on Payload size • API used geolocally close to their consumers • Promote event architecture • Filter data in payload • Pagination • Webhook or Business Notification • AsyncAPI • Define a basis of criteria for rating • Provide KPIs (Nb of call, payload size, nb of equipments used, …) • Evaluate energy consumption for one API • Know language impact for energy consumption • Use adaptive infrastructure • Use as few cloud suppliers as possible between consumer and backend • Be near Data Center • Define which actions are more relevant to do to reduce the impact of API ? • API Green Score design • Guideline resources • Sharing criteria of evaluation and methods • Adapt the communication of each personas API Lifecycle Data Exchange Data Architecture Tools Infrastructure Communication 7 domains
  6. API Lifecycle Data Exchange Data Architecture Tools Infrastructure Communication Archi

    Design Usage Logs Categories Domains Domains vs Categories
  7. Evaluation Grid: Results Excellent Acceptable Average Poor Showstopper A B

    C D E >=6000 6000<>=3000 2000<>=2000 2000<>=1000 <1000
  8. DE01 : Prefer an exchange format with the smallest size

    (JSON is smaller than XML). One of the structuring questions when designing an API is the selection of the exchange format to use. If the choice is often made by technical constraints or personal affinities, the durability aspect is also to be taken into account. Indeed, there are exchange formats that are heavier than others. For example, JSON is smaller than XML. The second format will therefore have a stronger impact on the network, the computing and the storage. In the interest of sustainability, we recommend to use a lighter exchange format to reduce the bandwidth consumed for the requests, the compute and storage resources consumption used to process and store the payloads. Expected gain: Network, compute and storage impact reduced network compute storage Data Exchange
  9. xml json Gain 717 B 623 B 94 B, 13%

    nb call /day 2 000 000 1,33 Gi 1,16 Gi 0,17 Gi nb call/month (30) 40,06 Gi 34.81 Gi 5,25 Gi <?xml version="1.0" encoding="UTF-8"?> <Catalog> <Book id="bk101"> <Author>Garghentini, Davide</Author> <Title>XML Developer's Guide</Title> <Genre>Computer</Genre> <Price>44.95</Price> <PublishDate>2000-10-01</PublishDate> <Description>An in-depth look at creating applications with XML.</Description> </Book> <Book id="bk102"> <Author>Garcia, Debra</Author> <Title>Midnight Rain</Title> <Genre>Fantasy</Genre> <Price>5.95</Price> <PublishDate>2000-12-16</PublishDate> <Description>A former architect battles corporate zombies, an evil sorceress, and her own childhood to become queen of the world.</Description> </Book> </Catalog> { "Catalog": { "Book": [ { "Author": "Garghentini, Davide", "Title": "XML Developer's Guide", "Genre": "Computer", "Price": "44.95", "PublishDate": "2000-10-01", "Description": "An in-depth look at creating applications\n with XML.", "_id": "bk101" }, { "Author": "Garcia, Debra", "Title": "Midnight Rain", "Genre": "Fantasy", "Price": "5.95", "PublishDate": "2000-12-16", "Description": "A former architect battles corporate zombies,\n an evil sorceress, and her own childhood to become queen\n of the world.", "_id": "bk102" } ] } } 717 bytes bookstore.xml 623 bytes bookstore.json
  10. DE02/DE03/DE05 : Use cache to avoid useless requests and preserve

    compute resources. The use of a cache has become common in computer architectures to store frequently used information on a fast storage. In addition to improving the response time of APIs, and therefore the consumer's experience of the service, it also saves computational resources by avoiding executing the same query on the same data multiple times. It is recommended to place a cache in front of each brick of an architecture returning data (API, database, frontend application, ...) and close to the users to preserve compute resources and improve performances of the API. Expected gain: Compute resources saved & Network impact reduced network compute storage Data Data Exchange
  11. LO01 : Collect only required data and use the right

    retention time according to the business requirements. It is quite common for applications to store a large amount of useless information without time limit. This results in an excessive consumption of storage services for data that will not be used or no longer used. It is necessary to clean up the data in order to keep only the data that is useful and to define a coherent retention policy in order to delete them once their validity or exploitation period has passed. Expected gain: Volume of data stored reduced & Network impact reduced network compute storage Tools
  12. https://www.elastic.co/guide/en/elasticsearch/reference/current/rollup-overview.html detail by each API call detail by each hour

    call keep details by brand/country/method aggregate : Average(Response Time), sum (nb of call) by hour automatic rollup process to reduce granularity Major Impact : save disk space
  13. •Define log retention per services/domain •Define log rotation (rollup) •Keep

    unit date for 45 days, and aggregate them(mn/hour) ⇒ Reduce size of Elastic indices to 4Go /month
  14. AR05 : Carbon Footprint Dashboard Some cloud providers produce carbon

    footprint dashboard. You can implement your own or adapt it based on your infrastructure and be close to your usage This is not a rule to evaluate API Green score, but it is important to be able to measure the impact on infrastructure Ex : evaluation the impact of compute, network, disk and divided by the number of calls of the evaluate API. Expected gain: Network, compute network compute storage Architecture
  15. Guidelines definition and publication 1 Eco-performance measure 2 Dashboard to

    give insight for improvement 4 ECO APIs promotion 3 4 STEPS TO SUSTAINABLE TECH BY DESIGN IN API 1 Common catalog to promote eco API
  16. Transparent calculation of the environmental IT Score Opportunity for every

    API Product Owner to continuously improve his environmental IT score Ability to relate in the API Market Place Guidelines definition and publication 1 Eco-performance measure 2 Dashboard to give insight for improvement 4 ECO APIs promotion 3 4 STEPS TO SUSTAINABLE TECH BY DESIGN IN API 1 Common dashboard to monitor eco API To be delivered
  17. C1 - Internal use • Publish ECO-guidelines and promote eco

    designed API on API marketplace 🡪 YES BUT Don’t forget to eco design your API developer portal
  18. This is the beginning of our journey, we need you

    to contribute! https://www.collectif-api-thinking.com