From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 33081138330 for ; Mon, 10 Oct 2016 14:24:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 72886E0B95; Mon, 10 Oct 2016 14:24:42 +0000 (UTC) Received: from mail-it0-f53.google.com (mail-it0-f53.google.com [209.85.214.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2C409E09B3 for ; Mon, 10 Oct 2016 14:24:42 +0000 (UTC) Received: by mail-it0-f53.google.com with SMTP id e203so14673731itc.0 for ; Mon, 10 Oct 2016 07:24:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:in-reply-to:references :mime-version; bh=6b14Zrg3PmVDuFht5yXVdRuSNpia20nkK+a/WR5JC1Q=; b=vcRpHy+JhcYBV9Ajd/kGqDIi82+TXI3wRHUMHs9MiQ2P81vzETD3OKbwBdhS6klg73 qLb7zfxJDiI8FfhNZPCsPsbTsfqLt32c7p9qRGMkwQGgrHw+rh6Q3uRQLdd7wmelvwnG 7d68hyIXbQHfyMFXG4IR/zvldJLddhfPZFPuIUclOGj7LEwAcBVCLDc5s9XGlJMnoukF 14tIuyytJkA92FJBho3kpwgRDlId7RaXOK27oDOTU1uDlCN2ihDtXVr349na67iw+UT0 PIjM+TnaGK63v26t6Y5yoPfzSqXL4rbx8hwXXK1G6VW7ZsKJ4RgeKwXEHnOEHcdXb21+ 1T4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:user-agent :in-reply-to:references:mime-version; bh=6b14Zrg3PmVDuFht5yXVdRuSNpia20nkK+a/WR5JC1Q=; b=QxSMK1CAAk+34hCIvDWA0uXrWicxhrzA1rnRwnlqQ+Q8v5umU4/csf/iTYeDKHoeda wKjvVAEoEHXGQG7t/vKtO+Jdxya87qwrEU3xNdRb9MWUU56+Xlr8F17cE9bRwi4Fj2D3 zWhzhXfQQPYCbzzBN/Zq+q3FFM4UbtlSfDu3A0e36+3pKleQ7iVwfmTP3geOKTu2OQeM 8/AeT0fwvdngpDzMwq1Ch+Jv9hnWuTLaIQxRP+FGzFdi9aCNrvSkVl+PIfx3tt6TfMpV h/aU0cBhoTJInDvXJHi2RaFx13KleRJPvWghD7mLsYzOUlHlJVolFnBiNFdrTEFNdjvx eCEQ== X-Gm-Message-State: AA6/9Rk/OnTUUEzEyIt4KATJnn2R7Bnu0o6Xgw9PvLInfll8v7Vng5EzJiCP8jLFhb0gfw== X-Received: by 10.36.93.74 with SMTP id w71mr10708899ita.12.1476109481142; Mon, 10 Oct 2016 07:24:41 -0700 (PDT) Received: from serenity.localnet (rb3450.g.visvr.net. [207.242.234.66]) by smtp.gmail.com with ESMTPSA id m127sm13318527ioe.32.2016.10.10.07.24.25 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 10 Oct 2016 07:24:30 -0700 (PDT) From: Michael Mol To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] Strive for zero swap usage? Date: Mon, 10 Oct 2016 10:24:24 -0400 Message-ID: <2060612.5pgpyyRFsI@serenity> User-Agent: KMail/4.14.10 (Linux/4.4.6-gentoo; KDE/4.14.24; x86_64; ; ) In-Reply-To: References: <15716586.VkCrMUdRYY@serenity> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart6434007.ebqHJUJZ4K"; micalg="pgp-sha256"; protocol="application/pgp-signature" X-Archives-Salt: c4fd7d9e-e796-4f8e-baaf-efb984cce67b X-Archives-Hash: 5fe6515376d242ff4e7953a46005e7c9 --nextPart6434007.ebqHJUJZ4K Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="us-ascii" On Friday, October 07, 2016 04:43:56 PM Grant wrote: > >> >>> Swap usage on Linux always seems a little tricky to me. Shoul= d my > >> >>> goal on a web server be zero swap usage, meaning the attached = graph > >> >>> should show no green lines at all if I'm doing it right? > >> >>=20 > >> >> No. You want things that aren't in use to be swapped, like mem= ory > >> >> leaks and such. You don't want things that will be used to be > >> >> swapped. > >> >=20 > >> > Does this look OK? It looks to me like heavy swapping in and ou= t with > >> > plenty of free memory (minus buffers/cache). > >>=20 > >> Or put another way, how do I know when swapping is a problem? I'm= > >> running munin so I can look over graphs of my system's characteris= tics > >> but I'm not sure what to look for to determine if I'm swapping > >> excessively. > >=20 > > "Swapping excessively" is inherently a use-case-specific problem, b= ut it > > comes down to two questions: > >=20 > > * Do you notice your system spending time in iowait swapping data i= n while > > you're waiting on it? > > * Do you notice your system spending time in iowait swapping data o= ut > > while > > you're waiting on it? (I.e. as it tries to make room for new memory= > > allocations) >=20 > I can't find a good graph for iowait in munin. Is watching wa in top= > my best bet? I've never used Munin. I use Zabbix, which monitors iowait just fine. >=20 > If I do find a correlation between iowait and web server response > times, should I just decrease memory usage until the problem goes > away? There's more than one cause for iowait, so you can't just assume iowait= is=20 related to memory consumption. iowait can happen while waiting for files to load in from disk. In this= case,=20 freeing up memory to be used by the page cache can help. iowait can happen while waiting for data to be written *to* disk. In th= is=20 case, finding what's writing to disk and reducing that can help. iowait can happen during swap. In this case, reducing things going into= swap=20 can help. You can reduce things going into swap by reducing vm.swappine= ss (I=20 prefer to set it to 0, myself; swap will be used if and only if there i= sn't=20 enough memory at the moment). You can reduce things going into swap by = tuning=20 applications to use less memory. (With a web server, there are going to= be a=20 lot of things to tune here. What is the webserver doing? What web serve= r is it=20 running? Is it running a dynamic application? What language?) >=20 > What I do notice is that my web server's response time increases alon= g > with the swapping peaks in the graph I posted before. Then you're using too much memory, which is leading you to use too much= swap,=20 which is causing an I/O bottleneck for you. Can you tell me more about = your=20 stack? What is the web server doing? What HTTPd are you using? Are you = running=20 dynamic applications? What language? Are you using any caching? =2D-=20 :wq --nextPart6434007.ebqHJUJZ4K Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAABCAAGBQJX+6SYAAoJED5TcEBdxYwQ028IAIOmg7zfJXfGIy3AH93lrB9h yYIPp2TuiJge3E9QaQnJqwxVbhqF3dFLB0kDcQ98ChzxBfHcwlKYzZ2I2iDNZSnK M3yluWRJZkiV/IBBArXwpQngYLiRDKH5j0OqwbuCSaygqwEV5EwPCdmWSwrVdmMS 2IvCm+NCGq6hY/2Yk3qibV8EqfPd6DlJ/XhjPWEf3D253ruT0FYmQ6By3ySZEOgR KVQix2hacKPgfs+4IUd0MoUB2n1DKkGH8/9jizMI5XtxD1g2ebkrHCvVUd7Q8PhL mvfFD9whWJO1229cjVZfPt64fBSBh9vV0S7lQ1r6hmng7WDO5a1qBJKi3RO0Dgg= =fEL6 -----END PGP SIGNATURE----- --nextPart6434007.ebqHJUJZ4K--