chenBright opened a new pull request, #3782:
URL: https://github.com/apache/brpc/pull/3782

   ### What problem does this PR solve?
   
   Issue Number: resolve 
   
   Problem Summary:
   
   A client that requests a shared receive queue (SRQ) can fall back to TCP 
even when both peers support RDMA with a dedicated receive queue (RQ).
   
   ### What is changed and the side effects?
   
   Changed:
   
   - Try a dedicated RQ before falling back to TCP. If local SRQ allocation 
fails before the first hello, the client uses the original TCP connection for 
the dedicated-RQ hello. If a v3 peer declines SRQ, replies with dedicated-RQ 
parameters, or local SRQ activation fails, the client sends `ACK=0` and 
allocates a dedicated QP. It reconnects only if allocation succeeds. Otherwise, 
it can send the pending RPC over the original TCP connection.
   - Recognize both the current all-zero v3 refusal and the early v3 refusal 
with `qp_num=0` and valid dedicated-RQ parameters. Peers that only support v2 
can still negotiate a dedicated RQ. Each logical connection gets at most two 
hello exchanges under the original connect deadline. A scheduling delay after 
the final ACK no longer turns a completed handshake into a timeout.
   - Add `rdma_connect_srq` for outgoing connections (default `false`) and 
`rdma_accept_srq` for incoming connections (default `true`). Turning off server 
admission through `/flags` declines new SRQ requests before allocating 
resources. Established SRQ connections continue serving RPCs.
   
   Handshake fallback:
   
   `A` is the original TCP connection. `B` is opened only for a second 
handshake. Before sending any hello, the client can switch from SRQ to a 
dedicated RQ on `A`. If neither QP can be allocated and the connection is still 
usable, the RPC goes directly over TCP on `A`.
   
   ```mermaid
   flowchart TD
       A{"First v3 hello on A"}
       A -->|Matching QP activated| RDMA["Send ACK=1 and use RDMA"]
       A -->|Retryable SRQ failure| P["Send ACK=0 on A, then allocate a 
dedicated QP"]
       A -->|Peer may require v2| V["Reconnect to B, then reuse or allocate a 
dedicated QP"]
       A -->|Other complete but unusable reply| AT["Send ACK=0 and use TCP on 
A"]
   
       P -->|Allocation failed| TCPA["Use TCP on A"]
       P -->|QP ready| V3["Reconnect to B and send a v3 dedicated-RQ hello"]
       V -->|Allocation failed| TCPB["Use TCP on B"]
       V -->|QP ready| V2["Send a v2 dedicated-RQ hello on B"]
   
       V3 --> B{"Second hello on B"}
       V2 --> B
       B -->|Matching QP activated| RDMA
       B -->|Complete but unusable reply| BT["Send ACK=0 and use TCP on B"]
       B -->|Another version retry requested| FAIL["Fail the connection"]
   ```
   
   A retryable SRQ failure is an explicit or historical refusal, a valid 
dedicated-RQ reply to an SRQ offer, or a local SRQ QP activation failure. A 
legacy all-zero refusal gives no indication whether the server supports a 
dedicated RQ. Cancellation, deadline expiry during negotiation, a failed 
reconnect, or a fatal I/O or framing error ends the handshake with an error.
   
   Side effects:
   - Performance effects:
   
   - Breaking backward compatibility: 
   
   ---
   ### Check List:
   - Please make sure your changes are compilable.
   - When providing us with a new feature, it is best to add related tests.
   - Please follow [Contributor Covenant Code of 
Conduct](https://github.com/apache/brpc/blob/master/CODE_OF_CONDUCT.md).
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to