XEP-0495: Happy Eyeballs

Abstract
When a server's IPv4 path and protocol are working, but the server's IPv6 path and protocol are not working, a dual-stack application that initiates a connect experiences significant connection delay compared to an IPv4-only application. This is undesirable because it causes the dual-stack initiating entity to have a worse user experience. This XEP defines how IETF's 'Happy Eyeballs' algorithm requirements that reduce this user-visible delay are applied to XMPP.
Author
Guus der Kinderen
Copyright
© 2024 – 2024 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Experimental

WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
Type
Standards Track
Version
0.1.0 (2024-10-17)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

In context of establishing TCP connections between XMPP entities, RFC 6120 [1] defines the resolution of Fully Qualified Domain Names of the receiving entity (server) by an initiating entity (client or server). The described Preferred Process uses SRV lookup, based on RFC 2782 [2], and a Fallback Process using A or AAAA record resolution.

The Preferred Process definition explicitly states that resolved addresses are tried in a particular sequence, progressing to the next address only after a preceding connection attempt has failed. As specific addresses or entire address families (IPv4 vs IPv6) may perform suboptimal on a network, or may be blocked, or broken completely, this can lead to user-visible delay.

Requirements for algorithms that reduce such delay are specified in RFC 8305 [3]. This XEP defines how this 'Happy Eyeballs' technique can be applied to XMPP, thus reducing the aforementioned user-visible delays.

2. Glossary

This document mostly uses terminology borrowed from RFC 2782 [2], RFC 6724 [4] and RFC 8305 [3].

Dual Stacked (hosts) (from RFC 2782)
Hosts that support both the IPv4 and IPv6 address families.
Target host (from RFC 2782)
A host (typically represented by a domain name) that is announced in the Target attribute of an SRV resource record. Used to identify service that provide an (XMPP) service.
Priority group
Target hosts in an SRV response that share the same 'priority' value
Resolution Delay
The time to wait for an AAAA response after receiving an A response (from RFC 8305) and to wait for a response to the request made against the first (by SRV 'weight' ordering) target after receiving a response for a later target.

3. Requirements

The primary goal of 'Happy Eyeballs' is to reduce user-visible delays when connections are established, notably on dual-stacked hosts.

The 'Happy Eyeballs' algorithm as defined in RFC 8305 [3] does not take into account the SRV lookup that is defined to be XMPP's Preferred Process for the resolution of Fully Qualified Domain Names. SRV defines attributes that are used for target host priority and server selection.

By deploying multiple SRV Resource Records (RR) that contain 'weight' and 'priority' attributes that are unequal to that of other RRs, the administrator explicitly defines that certain servers are more preferable than others. As this is a deliberate act, such information SHOULD NOT be discarded. This XEP describes how these attributes are best applied in a 'Happy Eyeballs' algorithm.

4. Algorithm

The 'Happy Eyeballs' algorithm described in this section applies primarily to the Preferred Process of resolution of fully qualified domain names as described in RFC 6120 [1], section 3.2.1, as it largely focuses on the incorporation of address characteristics discovered through SRV lookups.

When an initiation entity makes use of the Fallback Process defined in RFC 6120 [1], Section 3.2.2, then the 'Happy Eyeballs' algorithm defined in this XEP is essentially the same as the algorithm that is specified in RFC 8305 [3].

4.1 Service Resolution

The initiating entity preforms an SRV lookup, sorts and orders the resulting list of target hosts, as defined in the 'Usage rules' section of RFC 2782 [2]. This results in a complete, ordered list of target hosts.

To maintain strict ordering as defined by the 'priority' attribute of SRV, the remainder of the algorithm is applied iteratively for each group of target hosts that shares the same SRV 'priority' value ('priority groups'), in priority order (lowest first, as specified in RFC 2782 [2]). Only after all connection attempts (as described in section 4.4) for all target hosts in the first priority group are exhausted, target hosts for the subsequent priority group are processed. This is repeated for all priority groups.

4.2 Hostname Resolution

The initiating entity sends out both AAAA and A DNS queries, largely following the process as defined in section 3 'Hostname Resolution Query Handling' of RFC 8305 [3]. The process defined therein, which is based on resolution of one hostname, is adjusted as follows to accommodate the lookup of more than one hostname (each of the target hosts returned by the SRV lookup):

An AAAA and A query is sent out for each host in the priority group, starting with an AAAA query for the first host, immediately followed by an A query for the first host. This is immediately followed by an AAAA query, and then an A query, for the second host. This is repeated for all hosts in the priority group.

In line with section 3 of RFC 8305 [3], a connection attempt is immediately started if a positive AAAA response for the first host is received first, and the 'Resolution Delay' is applied when the A response for that host is received first due to reordering. As stated in RFC 8305 [3], this is done to give preference to IPv6. In addition to the specification in RFC 8305 [3], the 'Resolution Delay' is also applied when responses for hosts other than the first target are received prior to receiving responses for the first target. This helps maintain the preference order that is derived from SRV's 'weight' attribute.

4.3 Sorting Addresses

RFC 8305 [3], Section 4 describes how resolved addresses are sorted before attempts are mode to connect to them, which is a slightly modified version fo the Destination Address Selection as defined in RFC 6724 [4], Section 6.

An additional Destination Selection rule that prefers an addresses by their SRV-defined Weight attribute SHOULD be added before rule 9 of RFC 6724 [4] (but after the two rules added by RFC 8305 [3]).

4.4 Connection Attempts

Connection attempts are made as described in RFC 8305 [3], Section 5. If no successful connection has been established after the entire sorted list of addresses has been processed, the initiating client can restart the algorithm with Hostname Resolution of the next priority group.

When all priority groups are exhausted and no connection has been successfully established, the initiating entity MAY attempt to establish connections using Fallback Process defined in RFC 6120 [1], Section 3.2.2. If it does, it SHOULD implement this in accordance with the 'Happy Eyeballs' algorithm as defined in RFC 8305 [3].

5. Implementation Notes

This XEP, similar to RFC 8305 [3], assumes that the preference policy for the host destination address favors IPv6 over IPv4, as it has many desirable properties designed to be improvements over IPv4. If so desired, the recommendations in this document can easily be adapted to change to reflect a different preference policy.

6. Accessibility Considerations

This document does not require any Accessibility Considerations.

7. Security Considerations

This document does not define Security Considerations in addition to those defined in RFC 2782 [2], RFC 6724 [4] and RFC 8305 [3]

8. Privacy Considerations

This document does not define Privacy Considerations in addition to those defined in RFC 2782 [2], RFC 6724 [4] and RFC 8305 [3]

9. IANA Considerations

This document does not require any IANA actions.

10. XMPP Registrar Considerations

This document does not require any XMPP Registrar actions.

11. Acknowledgements

Work on this specification was funded through the NGI0 Core Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology. The author's gratitude goes out to all those involved in realizing this valuable opportunities.


Appendices

Appendix A: Document Information

Series
XEP
Number
0495
Publisher
XMPP Standards Foundation
Status
Experimental
Type
Standards Track
Version
0.1.0
Last Updated
2024-10-17
Approving Body
XMPP Council
Dependencies
RFC 6120, RFC 2782, RFC 6724, RFC 8305
Supersedes
None
Superseded By
None
Short Name
NOT_YET_ASSIGNED
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Guus der Kinderen
Email
guus.der.kinderen@gmail.com
JabberID
guus.der.kinderen@igniterealtime.org

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.

Given that this XMPP Extension Protocol normatively references IETF technologies, discussion on the <xsf-ietf@xmpp.org> list might also be appropriate.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.

2. RFC 2782: A DNS RR for specifying the location of services (DNS SRV) <http://tools.ietf.org/html/rfc2782>.

3. RFC 8305: Happy Eyeballs Version 2: Better Connectivity Using Concurrency <http://tools.ietf.org/html/rfc8305>.

4. RFC 6724: Default Address Selection for Internet Protocol Version 6 (IPv6) <http://tools.ietf.org/html/rfc6724>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.1.0 (2024-10-17)
    XEP Editor: dg
  2. Version 0.0.1 (2024-09-19)

    First draft.

    gk

Appendix I: Bib(La)TeX Entry

@report{der kinderen2024xep0495,
  title = {Happy Eyeballs},
  author = {der Kinderen, Guus},
  type = {XEP},
  number = {0495},
  version = {0.1.0},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0495.html},
  date = {2024-09-19/2024-10-17},
}

END