From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24727C282CE for ; Wed, 13 Feb 2019 17:23:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F369F2175B for ; Wed, 13 Feb 2019 17:23:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392921AbfBMRXJ (ORCPT ); Wed, 13 Feb 2019 12:23:09 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37936 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392909AbfBMRXD (ORCPT ); Wed, 13 Feb 2019 12:23:03 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DA32781DE6; Wed, 13 Feb 2019 17:23:02 +0000 (UTC) Received: from localhost (ovpn-200-19.brq.redhat.com [10.40.200.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B2E75D9C6; Wed, 13 Feb 2019 17:23:00 +0000 (UTC) Date: Wed, 13 Feb 2019 18:22:55 +0100 From: Stefano Brivio To: Stephen Hemminger Cc: Eric Dumazet , netdev@vger.kernel.org, Sabrina Dubroca , David Ahern Subject: Re: [PATCH iproute2 net-next v2 3/4] ss: Buffer raw fields first, then render them as a table Message-ID: <20190213182012.34a6928f@redhat.com> In-Reply-To: <20190213085101.7474ba5d@shemminger-XPS-13-9360> References: <82f1bc98-df6d-2b0a-17e5-fa057563284e@gmail.com> <20190213093711.13ab560e@redhat.com> <20190213085101.7474ba5d@shemminger-XPS-13-9360> Organization: Red Hat MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 13 Feb 2019 17:23:03 +0000 (UTC) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, 13 Feb 2019 08:51:01 -0800 Stephen Hemminger wrote: > On Wed, 13 Feb 2019 09:37:11 +0100 > Stefano Brivio wrote: > > > On Tue, 12 Feb 2019 16:42:04 -0800 > > Eric Dumazet wrote: > > > > > I do not get it. > > > > > > "ss -emoi " uses almost 1KB per socket. > > > > > > 10,000,000 sockets -> we need about 10GB of memory ??? > > > > > > This is a serious regression. > > > > I guess this is rather subjective: the worst case I considered back then > > was the output of 'ss -tei0' (less than 500 bytes) for one million > > sockets, which gives 500M of memory, which should in turn be fine on a > > machine handling one million sockets. > > > > Now, if 'ss -emoi' on 10 million sockets is an actual use case (out of > > curiosity: how are you going to process that output? Would JSON help?), > > I see two easy options to solve this: > > > > 1. flush the output every time we reach a given buffer size (1M > > perhaps). This might make the resulting blocks slightly unaligned, > > with occasional loss of readability on lines occurring every 1k to > > 10k sockets approximately, even though after 1k sockets column sizes > > won't change much (it looks anyway better than the original), and I > > don't expect anybody to actually scroll that output > > > > 2. add a switch for unbuffered output, but then you need to remember to > > pass it manually, and the whole output would be as bad as the > > original in case you need the switch. > > > > I'd rather go with 1., it's easy to implement (we already have partial > > flushing with '--events') and it looks like a good compromise on > > usability. Thoughts? > > > I agree with eric. The benefits of buffering are not worth it. > Let's just choose a reasonable field width, if something is too big, columns won't line up > which i snot a big deal. That's how it was before, and we couldn't even get fields aligned with TCP and UDP sockets in a 80 columns wide terminal. See examples at: https://patchwork.ozlabs.org/cover/847301/. I tried, but I think it's impossible to find a "reasonable" field width, especially when you mix a number of socket types. > Unless you come up with a better solution, I am going to revert this. That's why I asked for feedback about my proposals 1. and 2. above. I'll go for 1. then. -- Stefano