Internet Engineering Task Force S. Lasso Internet-Draft 9 August 2024 Intended status: Standards Track Expires: 10 February 2025 Dynamic Backpressure for HTTP-based systems draft-soni-http-dynamic-backpressure-00 Abstract This document describes a mechanism for introducing dynamic backpressure into an HTTP-based system, to aid in controlling server resources while minimizing tradeoffs. Status of This Memo This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79. Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet- Drafts is at https://datatracker.ietf.org/drafts/current/. Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress." This Internet-Draft will expire on 10 February 2025. Copyright Notice Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved. This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/ license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License. Lasso Expires 10 February 2025 [Page 1] Internet-Draft HTTP Backpressure August 2024 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 1.1. Requirements Language . . . . . . . . . . . . . . . . . . 2 2. Background: Why use dynamic backpressure . . . . . . . . . . 2 3. Solution: The Refresh HTTP header . . . . . . . . . . . . . . 3 4. Rejected alternatives . . . . . . . . . . . . . . . . . . . . 3 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 3 6. Security Considerations . . . . . . . . . . . . . . . . . . . 4 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 4 7.1. Normative References . . . . . . . . . . . . . . . . . . 4 7.2. Informative References . . . . . . . . . . . . . . . . . 4 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 4 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 4 1. Introduction Operating an HTTP service can get expensive. One of the ways services can manage the costs is by providing backpressure. Traditionally, HTTP backpressure is implemented variously by refusing connections after a limit, holding a connection open and slowly trickling data into it, among other techniques. This document describes a simple and widely-deployed mechanism for implementing backpressure by telling the client when to make new requests. 1.1. Requirements Language The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. 2. Background: Why use dynamic backpressure Consider the scenario: a service that is billed by requests, and an Atom feed that gains new entries every 5 minutes. This service is composed of app servers and caching load balancers, with a cache policy of 5 minutes. Yet, the service doesn't want Atom clients to send a request every 5 minutes. This scenario is exactly where dynamic backpressure would shine: it doesn't try to slow down or throttle the connections (not that it would be able to, due to the caches) or anything like that, it simply tells the client "hey, I would appreciate it if you waited N seconds before sending another request, thanks!". Lasso Expires 10 February 2025 [Page 2] Internet-Draft HTTP Backpressure August 2024 3. Solution: The Refresh HTTP header The Refresh header is composed of a non-negative integer number of seconds to wait until the next request, and an optional URI to move future requests to, according to the following syntax described in Augmented BNF [RFC5234], borrowing 'URI-reference' from [RFC3986]: refresh-value = wait-seconds [ ";url=" future-URI ] wait-seconds = 1*DIGIT future-URI = URI-reference The value of 'wait-seconds' SHOULD NOT be shorter than the value of any caching policy applied to the document. The client SHOULD wait at least 'wait-seconds' before making new requests. This syntax is in alignment with Section 7.7 of [WHATWG-HTML]. Below is a diagram of how the Refresh header can be used in a generic control loop, with requests per second as input and wait-seconds as output. Control Loop req/s + +-------------------+ wait-seconds -->(+)-->| Control function |----+-------> ^- +-------------------+ | | +-------------------+ | +----| Feedback function |<---+ +-------------------+ Figure 1: Control loop 4. Rejected alternatives The Refresh header is strongly disliked by basically everyone, but it may well be the only mechanism that provides the desired properties. One may argue the Retry-After header would be a better substitute, but the Retry-After header isn't really specified for successful content requests such as those used by Atom feeds, nor is it as widely deployed as the Refresh header. 5. IANA Considerations This document requests that the IANA update the registration for the Refresh header to also point to this document. Lasso Expires 10 February 2025 [Page 3] Internet-Draft HTTP Backpressure August 2024 6. Security Considerations This document should not affect the security of the Internet. After all, the Refresh header is already widely deployed. 7. References 7.1. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, . [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, DOI 10.17487/RFC3986, January 2005, . [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, DOI 10.17487/RFC5234, January 2008, . 7.2. Informative References [WHATWG-HTML] van Kesteren, A., "HTML Standard", Living Standard (7 August 2024), . Acknowledgements The authors would like to acknowledge the true power of the Refresh header. It had to be very powerful to survive this long. Author's Address Soni Lasso Terense Email: fakedme@gmail.com URI: https://soniex2.autistic.space/ Lasso Expires 10 February 2025 [Page 4]