A11 (C++ runtime)
Native C++ implementation of the A11 streaming action runtime
Loading...
Searching...
No Matches
connection_pool.h File Reference

Sharing one HTTP connection between concurrent requests to a peer. More...

#include <memory>
#include <string>
#include <utility>
#include <absl/container/flat_hash_map.h>
#include <absl/status/statusor.h>
#include "a11/concurrency/future.h"
#include "a11/net/http/url.h"
#include "a11/net/http2.h"
#include "thread/boost_primitives.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  a11::net::HttpConnectionLease
 A borrowed connection, held for as long as a caller needs it. More...
 
class  a11::net::HttpConnectionPool
 Hands out connections to origins, sharing them while they are in use. More...
 

Namespaces

namespace  a11
 
namespace  a11::net
 

Detailed Description

Sharing one HTTP connection between concurrent requests to a peer.

HTTP/2 multiplexes several exchanges over one connection. Reusing an active connection avoids another TCP and TLS handshake and preserves the peer's header-compression context.

The pool retains only weak references. A connection lives while it has active leases and closes when its final request finishes, avoiding idle file descriptors, peer sessions, and keep-alive timers.

HTTP/1.1 is not pooled. A11's HTTP/1.1 connection carries a single request by design – there is no pipelining – so those leases are exclusive and the connection is dropped when the request ends. Reuse happens where the protocol actually multiplexes.