Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3444159ioo; Mon, 30 May 2022 02:07:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtPh7PITnc0Xor/QaUiva+FYYpUJiwS0ychsm1/dKiQDpLdm6itd+COXC5+BImDxLWnG2E X-Received: by 2002:a17:902:e80a:b0:163:c2a4:4c9a with SMTP id u10-20020a170902e80a00b00163c2a44c9amr8242904plg.161.1653901678580; Mon, 30 May 2022 02:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653901678; cv=none; d=google.com; s=arc-20160816; b=IWsljK2RCYJqJFzdb5v1mqPatgcJAY+yosB6kJQ4BLlRp1bZpHrG2d/1TwPOBQJ6vd narywt09FCrYp0Rm7Pqi/4QosIMbdV7pmEJXtfAGvFK33WTHb86iXH738P+Sf/hr7hYm KwHGW6yrocBZgPkxXrJqgf2uEOcMYuXQsb6SVGqszLmxIbzTJeIN8xm+mQu+WYY1ePD/ jMlBQRCZMF4VHwIXBIxp5zhc4UBaXuMMY7beSkcpfWmsLMORVh6DBBsDOZSbP0D4pAe6 LQn4svL/V+Lh6v9ctzJ2jgJsl9hgkjKNlSBG/NYA5UUhYMzQdFKdIcy3ylLFc4p6UDpx 44Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date; bh=CiLQ9bVUaYjUq7lIB9loVPU5/eQgwLbOVkS04TqDIUE=; b=HsBQS8v38oDRqpjZ/EkkfpXasUs8qkWwEVcWHgZG+d+SWMhsxV8xIQNkrInpYwLY5R J5s2B7wGw0qCl92FfLtRhOgbDGGBLw4QHoyJiKp01Op92F8wP9zWS7tF8G6KbjqxuQGC 0Jn7XcK5w+oTF8JQkP05A3np4hidc8g43rWoLUMCPh4tgxaB7wO0VtqBq4MaQSAzmYqB WEwTORkBkT/X4420G0ArkapqmY1CjBTPNswdyphCwlm1/C4meetV37Xw5SLue6WE4pag sfl+EG7ioZYF1th4xj6uMBBDD45FmLnWLxXoQuLi0/koqcpWs9vEK0cS17IY4hzIMHvw WBrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a637f49000000b003f9e8c4b388si17023442pgn.504.2022.05.30.02.07.44; Mon, 30 May 2022 02:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232526AbiE3FK2 (ORCPT + 99 others); Mon, 30 May 2022 01:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231535AbiE3FK0 (ORCPT ); Mon, 30 May 2022 01:10:26 -0400 Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D60B360A8B; Sun, 29 May 2022 22:10:23 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04357;MF=tonylu@linux.alibaba.com;NM=1;PH=DS;RN=10;SR=0;TI=SMTPD_---0VEhVvoG_1653887420; Received: from localhost(mailfrom:tonylu@linux.alibaba.com fp:SMTPD_---0VEhVvoG_1653887420) by smtp.aliyun-inc.com(127.0.0.1); Mon, 30 May 2022 13:10:21 +0800 Date: Mon, 30 May 2022 13:10:19 +0800 From: Tony Lu To: liuyacan@corp.netease.com Cc: kgraul@linux.ibm.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ubraun@linux.ibm.com Subject: Re: SMC-R problem under multithread Message-ID: Reply-To: Tony Lu References: <20220530031604.144875-1-liuyacan@corp.netease.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220530031604.144875-1-liuyacan@corp.netease.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 30, 2022 at 11:16:04AM +0800, liuyacan@corp.netease.com wrote: > Hi experts, > > I recently used memcached to test the performance of SMC-R relative to TCP, but the results > are confusing me. When using multithread on the server side, the performance of SMC-R is not as good as TCP. > > Specifically, I tested 4 scenarios with server thread: 1\2\4\8. The client uses 8threads fixedly. > > server: (smc_run) memcached -t 1 -m 16384 -p [SERVER-PORT] -U 0 -F -c 10240 -o modern > client: (smc-run) memtier_benchmark -s [SERVER-IP] -p [SERVER-PORT] -P memcache_text --random-data --data-size=100 --data-size-pattern=S --key-minimum=30 --key-maximum=100 -n 5000000 -t 8 > > The result is as follows: > > SMC-R: > > server-thread ops/sec client-cpu server-cpu > 1 242k 220% 97% > 2 362k 241% 128% > 4 378k 242% 160% > 8 395k 242% 210% > > TCP: > server-thread ops/sec client-cpu server-cpu > 1 185k 224% 100% > 2 435k 479% 200% > 4 780k 731% 400% > 8 938k 800% 659% > > It can be seen that as the number of threads increases, the performance increase of SMC-R is much slower than that of TCP. > > Am I doing something wrong? Or is it only when CPU resources are tight that SMC-R has a significant advantage ? > > Any suggestions are welcome. Hi Yacan, This result matches some of our scenarios to some extent. Let's talk about this result first. Based on your benchmark, the biggest factor affecting performance seems that the CPU resource is limited. As the number of threads increased, neither CPU usage nor performance metrics improved, and CPU is limited to about 200-250%. To make it clear, could you please give out more metrics about per-CPU (usr / sys / hi / si) and memcached process usage. Secondly, it seems that there is lots of connections in this test. If it takes too much time to establish a connection, or the number of final connections does not reach the specified value, the result will be greatly affected. Could you please give out more details about the connections numbers during benchmark? We have noticed SMC has some limitations in multiple threads and many connections. This benchmark happens to be basically in line with this scenario. In general, there are some aspects in brief: 1. control path (connection setup and dismiss) is not as fast as TCP; 2. data path (lock contention, CQ spreading, etc.) needs further improvement; About CPU limitation, SMC use one CQ and one core to handle data transmission, which cannot spread workload over multiple cores. There is is an early temporary solution [1], which also need to improve (new CQ API, WR refactor). With this early solution, it shows several times the performance improvement. About the improvement of connection setup, you can see [2] for more details, which is still a proposal now, and we are working on it now. This show considerable performance boost. [1] https://lore.kernel.org/all/20220126130140.66316-1-tonylu@linux.alibaba.com/ [2] https://lore.kernel.org/all/1653375127-130233-1-git-send-email-alibuda@linux.alibaba.com/ Thanks, Tony LU