maskit commented on PR #14035:
URL: https://github.com/apache/trafficserver/pull/14035#issuecomment-6782359233

   Thanks for the detailed write-up. I'm fine with this going in as an OpenSSL 
change. Below are short answers to the three questions, then some background on 
how this compares with the quiche backend. Everything after the answers is for 
later, not for this PR.
   
   ### Answers
   
   1. **Default on / name:** +1 to Brian. Default on is fine, and 
`listen_per_thread` works. For later: quiche already spreads a port over one 
socket per ET_UDP thread, controlled by `proxy.config.udp.threads`. Eventually 
it would be nice for both backends to share one setting, and this name would 
fit.
   2. **Per ET_NET thread vs. a count:** +1 to Brian, per ET_NET thread as done 
here. Thanks for taking the 2 ms tick in the next PR. One thing for that 
design: both backends also poll each open connection every 2 ms for writes, so 
a wake-up mechanism that isn't tied to OpenSSL would let us remove that later 
too.
   3. **Rebinding:** documenting it as unsupported is fine for now. The 
background below explains why I'd like the design to leave room for it later.
   
   ### Background: the two backends today
   
   | Aspect | quiche build | OpenSSL build with this PR |
   |---|---|---|
   | Sockets | One `SO_REUSEPORT` socket per ET_UDP thread 
(`proxy.config.udp.threads`), set up in `UDPNetProcessor::UDPBind()` | One 
`SO_REUSEPORT` socket per ET_NET thread 
(`proxy.config.quic.server.listen_per_thread`), set up in `_start_listener()` |
   | Who demultiplexes | ATS: `quiche_header_info()` plus a global 
`QUICConnectionTable` with a lock per partition | OpenSSL, inside each listener 
|
   | How the demux reaches the event loop | ET_UDP reads the socket, then 
queues the datagram to the connection's ET_NET thread and signals that thread | 
`SSL_handle_events()` on a 2 ms timer; the socket isn't registered with the 
event loop |
   | What the reuseport hash decides | Only which UDP thread reads the datagram 
| Which thread owns the connection for its whole life |
   | Connection placement | Round-robin across ET_NET threads, independent of 
the socket | The thread whose socket received the first datagram |
   | Server CIDs | Chosen by ATS: the first one at accept, and later ones 
possible through `quiche_conn_new_scid()` | Chosen by OpenSSL, with no public 
API to choose or read them |
   | Token key | Retry only (no NEW_TOKEN); one key per process, from 
`token_key.filename` or random | Random per OpenSSL port, so per listener, for 
both Retry and NEW_TOKEN |
   | Rebinding | Fails today, but fixably: the global table finds the 
connection whichever socket receives the datagram, and quiche validates paths 
and reports where to send (`send_info.to`). ATS ignores that and sends to the 
address recorded at accept | Not possible without OpenSSL changes: OpenSSL 
never validates or switches to a new peer address, and with per-thread 
listeners the datagram usually reaches a listener that doesn't know the 
connection |
   | Fixed-interval timers | 2 ms WRITE_READY per connection; 100 ms 
closed-connection collector per acceptor | 2 ms per listener, 2 ms per 
connection; 100 ms collector per listener |
   
   ### Later: rebinding, steering and QUIC-LB
   
   - **quiche: fixable.** quiche implements path validation and migration. The 
known gap is on the ATS side: it ignores `send_info.to`.
   - **OpenSSL: blocked upstream.** The server answers PATH_CHALLENGE but never 
validates or switches to a new peer address, and no API changes that.
   - **Steering for per-thread sockets.** With one socket per thread, a rebound 
client usually lands on another socket. An eBPF `SK_REUSEPORT` program can read 
the DCID and pick the socket from a `REUSEPORT_SOCKARRAY` map. If it doesn't 
recognize the CID, it selects nothing and the kernel falls back to its hash. 
That needs server CIDs that encode the socket, which ATS can do with quiche and 
can't with OpenSSL today. This PR already keeps the acceptor at index *i* on 
net thread *i*, which is the stable mapping such a map needs, so it would be 
good to keep that.
   - **QUIC-LB** (draft-ietf-quic-load-balancers) needs the same control over 
server CIDs: every CID, including those in NEW_CONNECTION_ID, follows its 
format, and a config rotation means issuing new CIDs mid-connection.
   
   ### Later: a shared abstraction
   
   Today the two backends share almost nothing below `QUICNetVConnection`: one 
header with `#if` around the members, and CMake picks one of two sets of `.cc` 
files. When we get to it, I'd like the differences behind an interface. Roughly:
   
   - **Port (backend-neutral):** socket layout, creating and binding sockets 
(one helper rather than `UDPBind()` and `_start_listener()`), fallback and 
logging. It also owns a CID policy designed so a BPF program can read the CIDs: 
one fixed length, the endpoint index at a fixed offset, and version bits in the 
first octet. The policy covers random, steering and QUIC-LB, and the port fills 
the steering map.
   - **Paths:** datagrams carry their own addresses in both directions, the 
engine reports a validated new path, and `disable_active_migration` is forced 
on when the engine can't migrate.
   - **Per-thread endpoint:** registers the socket with the event loop, wakes 
the NetVC that owns each datagram, and schedules the engine's next deadline.
   - **Engine (per backend):** an OpenSSL listener or quiche, reporting what it 
supports: externally supplied CIDs and migration.
   
   None of this needs to block this PR. We can move both backends toward it in 
follow-ups.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to