On Tue, 2023-03-21 at 07:19 +0000, Kai Shen wrote: > SMC-R performs not so well on fallback situations right now, > especially on short link server fallback occasions. We are planning > to make SMC-R widely used and handling this fallback performance > issue is really crucial to us. Here we introduce a shadow socket > method to try to relief this problem. > > Basicly, we use two more accept queues to hold incoming connections, > one for fallback connections and the other for smc-r connections. > We implement this method by using two more 'shadow' sockets and > make the connection path of fallback connections almost the same as > normal tcp connections. > > Now the SMC-R accept path is like: > 1. incoming connection > 2. schedule work to smc sock alloc, tcp accept and push to smc > acceptq > 3. wake up user to accept > > When fallback happens on servers, the accepting path is the same > which costs more than normal tcp accept path. In fallback > situations, the step 2 above is not necessary and the smc sock is > also not needed. So we use two more shadow sockets when one smc > socket start listening. When new connection comes, we pop the req > to the fallback socket acceptq or the non-fallback socket acceptq > according to its syn_smc flag. As a result, when fallback happen we > can graft the user socket with a normal tcp sock instead of a smc > sock and get rid of the cost generated by step 2 and smc sock > releasing. > > +-----> non-fallback socket acceptq > | > incoming req --+ > | > +-----> fallback socket acceptq > > With the help of shadow socket, we gain similar performance as tcp > connections on short link nginx server fallback occasions as what > is illustrated below. It looks like only the shadow sockets' receive queue is needed/used. Have you considered instead adding 2 receive queues to smc_sock, and implement a custom accept() variant fetching the accepted sockets from there? That will allow better encapsulating the changes into the smc code and will avoid creating that 2 non-listening but almost listening sockets which look quite strange. Cheers, Paolo