From owner-freebsd-questions@freebsd.org Tue May 5 09:59:16 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A1E942DF915 for ; Tue, 5 May 2020 09:59:16 +0000 (UTC) (envelope-from 4250.82.1d4c10004b0a7fa.65bc3198ac22ebcef2b175f8f30e74c4@email-od.com) Received: from s1-b0c6.socketlabs.email-od.com (s1-b0c6.socketlabs.email-od.com [142.0.176.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 49GZv72sk6z4fn3 for ; Tue, 5 May 2020 09:59:15 +0000 (UTC) (envelope-from 4250.82.1d4c10004b0a7fa.65bc3198ac22ebcef2b175f8f30e74c4@email-od.com) DKIM-Signature: v=1; a=rsa-sha256; d=email-od.com;i=@email-od.com;s=dkim; c=relaxed/relaxed; q=dns/txt; t=1588672755; x=1591264755; h=content-transfer-encoding:content-type:mime-version:references:in-reply-to:message-id:subject:cc:to:from:date:x-thread-info; bh=gVwQz5gxnPXHrKvd2bc28gwo2aRI+CxxlodZMbIwY1g=; b=VXfLoXbp5sjVwZFU12eMR6zCk3ce9yDd2Dkv87GHmceDfweVSswMFDL3xSA7Jp4/y3EIOqQzBzA+qDsF4FBjxM5GmeBg5yoRuK9soSHcWaRRMaaXKH0RriZIa9S+bSqCSpYZcdtqENGjQBN/LM3b94Wk4t4Gdrf62E7v4/tfQIk= X-Thread-Info: NDI1MC45Mi4xZDRjMTAwMDRiMGE3ZmEuZnJlZWJzZC1xdWVzdGlvbnM9ZnJlZWJzZC5vcmc= Received: from r3.h.in.socketlabs.com (r3.h.in.socketlabs.com [142.0.180.13]) by mxsg2.email-od.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Tue, 5 May 2020 05:59:04 -0400 Received: from smtp.lan.sohara.org (EMTPY [185.202.17.215]) by r3.h.in.socketlabs.com with ESMTP(version=Tls12 cipher=Aes256 bits=256); Tue, 5 May 2020 05:59:03 -0400 Received: from [192.168.63.1] (helo=steve.lan.sohara.org) by smtp.lan.sohara.org with smtp (Exim 4.92.3 (FreeBSD)) (envelope-from ) id 1jVuLu-000DQD-1y; Tue, 05 May 2020 10:59:02 +0100 Date: Tue, 5 May 2020 10:59:01 +0100 From: Steve O'Hara-Smith To: Nikita Stepanov Cc: freebsd-questions@freebsd.org Subject: Re: Does swap increase freebsd performance? Message-Id: <20200505105901.4306c0f7aa0aec652e2cc65a@sohara.org> In-Reply-To: <3971481588671556@myt2-8316c2cade1b.qloud-c.yandex.net> References: <3971481588671556@myt2-8316c2cade1b.qloud-c.yandex.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd12.0) X-Clacks-Overhead: "GNU Terry Pratchett" Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 49GZv72sk6z4fn3 X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; dkim=pass header.d=email-od.com header.s=dkim header.b=VXfLoXbp; dmarc=none; spf=pass (mx1.freebsd.org: domain of 4250.82.1d4c10004b0a7fa.65bc3198ac22ebcef2b175f8f30e74c4@email-od.com designates 142.0.176.198 as permitted sender) smtp.mailfrom=4250.82.1d4c10004b0a7fa.65bc3198ac22ebcef2b175f8f30e74c4@email-od.com X-Spamd-Result: default: False [-0.62 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.97)[-0.965,0]; R_DKIM_ALLOW(-0.20)[email-od.com:s=dkim]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:142.0.176.0/20]; MV_CASE(0.50)[]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; DMARC_NA(0.00)[sohara.org]; NEURAL_HAM_LONG(-0.98)[-0.976,0]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[email-od.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[198.176.0.142.list.dnswl.org : 127.0.15.0]; IP_SCORE(0.02)[ip: (-0.21), ipnet: 142.0.176.0/22(0.29), asn: 7381(0.08), country: US(-0.05)]; FORGED_SENDER(0.30)[steve@sohara.org,4250.82.1d4c10004b0a7fa.65bc3198ac22ebcef2b175f8f30e74c4@email-od.com]; SUBJECT_ENDS_QUESTION(1.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7381, ipnet:142.0.176.0/22, country:US]; FROM_NEQ_ENVFROM(0.00)[steve@sohara.org,4250.82.1d4c10004b0a7fa.65bc3198ac22ebcef2b175f8f30e74c4@email-od.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 May 2020 09:59:16 -0000 On Tue, 05 May 2020 15:39:16 +0600 Nikita Stepanov wrote: We seem to be getting a rash of bodyless messages with the question in the subject. Please type a body with your question even if it is a repeat of the subject. Swap can increase performance by making more of the memory available for active use. Many programs have memory allocated that is very rarely used or even only used at startup, pushing this out to swap frees physical memory for more active use such as caching. Whether this makes a difference to performance or not depends greatly on the workload, or more importantly the memory pressure the workload produces. If there is plenty of memory then swap won't help and there is overhead involved in writing pages out to swap so it will reduce performance very slightly. If there is just about enough memory then swap will make it more useful and increase performance. This 'sweet spot' is in reality often quite wide depending on the benefits of caching on workload and so forth. If there is insufficient memory then swap will keep things working but performance will suffer badly. This can be very important in the face of an unusual load spike. -- Steve O'Hara-Smith