RFC 5573
Asynchronous Channels for the Blocks Extensible Exchange Protocol (BEEP)
RFC 5573: Asynchronous Channels for the Blocks Extensible Exchange Protocol (BEEP) π
Network Working Group πΈ It's a Request for Comments (RFC) from the IETF crew. Author: M. Thomson (Andrew) π Category: Experimental π§ͺ This is an experiment, not an Internet standard! Date: June 2009 π Obsoletes / Updates: The title block doesn't list anything here, so there's nothing it obsoletes or updates. π¦
Status of This Memo β¨
okay so this memo defines an Experimental Protocol for the Internet community. it is NOT an Internet standard of any kind π The authors are asking for discussion and suggestions for improvement, and distribution of this memo is unlimited π
Copyright Notice π
Copyright (c) 2009 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 in effect on the date of publication of this document (http://trustee.ietf.org/license-info). Please read these documents carefully, bestie, because they explain your rights and restrictions for this document ππ«Ά
Abstract π¦
The Blocks Extensible Exchange Protocol (BEEP) gives you a protocol framework for building application protocols π§ This document describes a BEEP feature that makes individual channels asynchronous π₯
Table of Contents π
1. Introduction ....................................................2
2. Asynchronous BEEP Channels ......................................3
2.1. Asynchronous Feature .......................................3
2.2. Starting an Asynchronous Channel ...........................4
2.3. Asynchronous Channel Behavior ..............................5
2.4. Error Handling .............................................6
3. Alternatives ....................................................6
3.1. Increasing Throughput ......................................6
3.2. Asynchrony in the Application Protocol .....................7
4. Security Considerations .........................................7
5. IANA Considerations .............................................8
6. References ......................................................8
6.1. Normative References .......................................8
6.2. Informative References .....................................8
1. Introduction β¨
okay so BEEP is giving framework energy π It handles a bunch of the stuff you need when building an application protocol: framing, encoding, privacy, authentication, and asynchrony π«Ά The catch is that BEEP's asynchrony only works between channels. Replies to messages sent on any one channel are strictly ordered, so they have to come back in order π
Serial processing is a vibe for lots of applications πΈ But it's less suitable for apps that lean hard into asynchrony. Like, if a response takes a long time to make, that channel is basically stuck until the request is processed and the response is sent. Pipelining helps with network latency, but it doesn't fix the real problem: later requests still can't be processed until the reply to the first one goes out π
Async apps need a protocol that can handle a lot of concurrent outstanding requests. Thinking of a channel as a thread doesn't scale to the huge number of threads modern systems run π Modern apps regularly have tons of concurrent processing threads, so we need a better way to multiplex loads of concurrent requests π
So this document describes a BEEP feature, an extension to BEEP, that lets you create an asynchronous channel π¦ An asynchronous channel is one where the response order isn't locked to the order the client peer sent the requests in. It's otherwise identical to other channels and uses unmodified framing. The only difference is that requests may be processed in parallel and responses may be sent in any order π
This means one channel can handle multiple concurrent requests efficiently π§ Timing of responses to other requests doesn't affect a given request. The requesting peer can handle responses as they become available, and the serving peer can run things in parallel without artificial limits on response order. Iconic, honestly β¨
Asynchronous channels give you more throughput when the serving peer needs time to process requests π₯ This is especially useful when the serving peer has to do long computations or make network-based requests while it's servicing a request.
BEEP feature negotiation makes sure that both peers are mutually willing to create asynchronous channels π«Ά This document also describes how to establish one.
This document is published as an Experimental RFC so the community can find out whether the extension gets deployed across a variety of use cases and applications π§ͺπ
2. Asynchronous BEEP Channels π
This document defines a BEEP feature that enables asynchronous channels π¦ An asynchronous channel is a BEEP channel that is not subject to the restrictions of Section 2.6.1 of [RFC3080] about response ordering. Requests can be processed and responded to in any order by the serving peer, which is the whole point π
Asynchronous channels use the "msgno" element of the BEEP frame header to correlate requests and responses π Regular BEEP channels don't use "msgno" for request/response correlation, even though the parameter might make you think they do π In a regular BEEP channel, "msgno" only serves as a way to check for protocol errors.
Asynchronous channels aren't suitable for applications where state established by requests is relied upon in later requests, or where message ordering matters π
2.1. Asynchronous Feature πΈ
The "feature" attribute in the BEEP greeting holds a whitespace-separated list of features that each peer supports π If both lists contain the same feature, either peer may use that feature.
This document registers the feature "async" π§ If either peer doesn't include this feature in its greeting message, neither peer can create an asynchronous channel. no cap, it's all or nothing π
Figure 1 shows an example exchange where both peers say they're willing to use this feature β¨
L: <wait for incoming connection>
I: <open connection>
L: RPY 0 0 . 0 133
L: Content-Type: application/beep+xml
L:
L: <greeting features="async x-foo">
L: <profile uri="http://example.com/beep/APP" />
L: </greeting>
L: END
I: RPY 0 0 . 0 69
I: Content-Type: application/beep+xml
I:
I: <greeting features="async" />
I: END
Figure 1: BEEP Greetings with Asynchronous Feature
The registration template for BEEP features is included in Section 5 π
2.2. Starting an Asynchronous Channel π¦
To create an asynchronous channel, you include an "async" parameter set to "true" in the "start" request π₯ If it's omitted, or set to "false", the channel is not asynchronous π
Figure 2 shows how the "async" attribute can be used to start an asynchronous channel π
C: MSG 0 1 . 52 130
C: Content-Type: application/beep+xml
C:
C: <start number="1" async="true">
C: <profile uri="http://example.org/protocol"/>
C: </start>
C: END
S: RPY 0 1 . 221 102
S: Content-Type: application/beep+xml
S:
S: <profile uri="http://example.org/protocol"/>
S: END
Figure 2: Asynchronous Channel Start
If the serving peer can't create an asynchronous channel for any reason, the channel start gets rejected π This could happen if the selected profile isn't suitable for an asynchronous channel. The response can include the "553" response code (parameter invalid) and an appropriate message, as Figure 3 shows πΈ
C: MSG 0 1 . 52 128
C: Content-Type: application/beep+xml
C:
C: <start number="1" async="true">
C: <profile uri="http://example.org/serial"/>
C: </start>
C: END
S: ERR 0 1 . 221 152
S: Content-Type: application/beep+xml
S:
S: <error code="553">Profile <http://example.org/serial>
S: cannot be used for asynchronous channels.</error>
S: END
Figure 3: Asynchronous Channel Start Error
2.3. Asynchronous Channel Behavior π§
Asynchronous channels differ from normal BEEP channels in exactly one way π An asynchronous channel isn't subject to the restrictions in Section 2.6.1 of [RFC3080] about processing and response ordering. A peer in the serving role may process and respond to requests in any order it likes β¨
On an asynchronous channel, the "msgno" element of the frame header is used to correlate requests and responses π A BEEP peer that receives responses in a different order than the requests that triggered them must not treat this as a protocol error π«Ά
"MSG" messages sent on an asynchronous channel may be processed in parallel by the serving peer π₯ Responses ("RPY", "ANS", "NUL", or "ERR" messages) can be sent in any order. Different "ANS" messages sent in a one-to-many exchange may be interleaved with responses to other "MSG" messages π
An asynchronous channel still has to follow the rules in [RFC3080] about segmented messages π Each message must be completed before any other message can be sent on that same channel.
Note: There's an exception to this rule in [RFC3080] for interleaved "ANS" segments sent in response to the same "MSG". BEEP peers are recommended not to generate interleaved ANS segments π
The BEEP management channel (channel 0) is never asynchronous π¦
2.4. Error Handling π
BEEP doesn't have any mechanism for managing a peer that doesn't respond to a request π Synchronous channels can't be used or even closed if a peer never provides a response to a request. The only remedy available is closing the underlying transport π
An asynchronous channel can't be closed in that situation, but it can still be used for further requests π§ However, any outstanding request still consumes state resources. Client peers may dispose of that state after a configured interval, but they must be prepared to discard unrecognized responses if they do π«Ά
3. Alternatives π
The option in this document gives you asynchronous communication π¦ Asynchronous channels might not be applicable in every situation, especially where the ordering of requests matters π Depending on the application protocol's requirements, the alternatives discussed in this section could be a better fit π
3.1. Increasing Throughput π
okay so, in some cases asynchronous channels can be used to remove limits on how fast messages get processed, which is iconic π Pipelining your requests can also boost throughput a lot when network latency is the thing holding you back. And if throughput is the only thing you care about, spreading requests over several channels increases overall throughput. β¨
Note: Be wary of false optimizations that rely on pipelining requests π If later requests in a series rely on state set up by earlier requests, an error in an earlier request could invalidate the later ones. Not me pipelining my way into a mess π
The flow control window used in the TCP mapping [RFC3081] can become a throughput bottleneck for individual channels, and the choice of TCP window size limits throughput too, see [RFC1323] π¦ To get around the limits that flow control creates, receiving peers can increase the window size they use, and sending peers can open additional channels with the same profile. Managing flow control properly applies to asynchronous channels as well, so don't forget it bestie π«Ά
3.2. Asynchrony in the Application Protocol π§
With changes to the application protocol, serial channels can be used for asynchronous exchanges. Asynchrony can be provided at a protocol layer above BEEP by separating request and response. This does require adding proprietary MIME headers or modifying the application protocol, which is a lot of work ngl π
Here's how the vibe goes: the serving peer sends an immediate "RPY" (or "NUL") response to requests. That frees the channel up for more requests πΈ The actual response then gets sent as a separate "MSG", using a special identifier that was included in the original request so the response can be matched back to it. This second "MSG" can go out on the same channel (since these are full duplex) or on a channel made specifically for it π
This method is not favored, honestly, because it means the application protocol has to solve the problem of matching requests with responses on its own. BEEP is supposed to be a general framework for building application protocols, and if it didn't provide request/response correlation, it would be way less useful π€ Using a MIME header is also possible, but using msgno is the most elegant solution, periodt π
4. Security Considerations π
Okay, this section is important, so pay attention bestie π³ Enabling asynchronous messaging for a channel potentially requires keeping track of additional state information. A peer in the server role that doesn't reply to messages can cause state to pile up at the client peer. If that state information weren't limited, this mode could be abused to perform a denial of service attack π This problem already exists in BEEP, but it's potentially more serious because of the processing a serving peer might do for requests received on an asynchronous channel. How much denial is possible depends on what a serving peer accepts, and the number of outstanding requests can be restricted to protect against state piling up too much β¨
A client peer keeps state for each request it sends. A client peer should enforce a configurable limit on how many requests it will allow to be outstanding at any time π§ This limit could be enforced at the channel, connection, or application scope. Once the limit is reached, the client peer might prevent or block further requests from being generated.
Peers that serve requests on asynchronous channels also accumulate state when a request is accepted for processing π« Peers in the serving role may similarly limit the number of requests that are processed concurrently. Once that limit is reached, the receiving peer can either stop reading new requests, or start rejecting them by generating error responses. Alternatively, flow control [RFC3081] can be used: "SEQ" frames can be suppressed, which lets the flow control window close and stops further requests from being received π₯
5. IANA Considerations π
This section registers the BEEP async feature in the BEEP parameters registry, following the template from Section 5.2 of [RFC3080] π
Feature Identification: async
Feature Semantics: This feature enables the creation of asynchronous
channels, see Section 2 of RFC 5573.
Contact Information: Martin Thomson <martin.thomson@andrew.com>
6. References π
6.1. Normative References
[RFC3080] Rose, M., "The Blocks Extensible Exchange Protocol Core",
RFC 3080, March 2001.
6.2. Informative References
[RFC3081] Rose, M., "Mapping the BEEP Core onto TCP", RFC 3081,
March 2001.
[RFC1323] Jacobson, V., Braden, B., and D. Borman, "TCP Extensions
for High Performance", RFC 1323, May 1992.
Author's Address π
Martin Thomson
Andrew
PO Box U40
Wollongong University Campus, NSW 2500
AU
Phone: +61 2 4221 2915
EMail: martin.thomson@andrew.com
URI: http://www.andrew.com/
π¦ where this page comes from
- ietf: rfc5573 2009-06
- π girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms