Skip to content

look into TCP fastopen and TCP_QUICKACK #14173

@andrewrk

Description

@andrewrk

Extracted from #13980.

Here's an example of using TCP fastopen to send data along with the tcp connection:

    struct msghdr mh = {
        .msg_name = (void *)sa,
        .msg_namelen = sl,
        .msg_iovlen = 2,
        .msg_iov = (struct iovec [2]){
            { .iov_base = (uint8_t[]){ ql>>8, ql }, .iov_len = 2 },
            { .iov_base = (void *)q, .iov_len = ql } }
    };
    int fd = socket(family, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
    if (!setsockopt(fd, IPPROTO_TCP, TCP_FASTOPEN_CONNECT, &(int){1}, sizeof(int))) {
        r = sendmsg(fd, &mh, MSG_FASTOPEN|MSG_NOSIGNAL);

TCP_QUICKACK is another option that could be enabled in setsockopt. Both options are intended to reduce latency.

This issue is to change the std lib API for making an HTTPS request to take advantage of these things, and see if we can reduce the latency of establishing a connection. For HTTP GET requests it should do the same but with the HTTP header instead of the TLS ClientHello.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingImplementing this issue could cause existing code to no longer compile or have different behavior.enhancementSolving this issue will likely involve adding new logic or components to the codebase.optimizationstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions