From owner-freebsd-fs@FreeBSD.ORG Wed Aug 28 13:56:44 2013 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1EB648FF for ; Wed, 28 Aug 2013 13:56:44 +0000 (UTC) (envelope-from freebsd-fs@m.gmane.org) Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CD8BE291D for ; Wed, 28 Aug 2013 13:56:43 +0000 (UTC) Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1VEgEj-0001iv-1f for freebsd-fs@freebsd.org; Wed, 28 Aug 2013 15:56:41 +0200 Received: from lara.cc.fer.hr ([161.53.72.113]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Aug 2013 15:56:41 +0200 Received: from ivoras by lara.cc.fer.hr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 28 Aug 2013 15:56:41 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: freebsd-fs@freebsd.org From: Ivan Voras Subject: Call fo comments - raising vfs.ufs.dirhash_reclaimage? Date: Wed, 28 Aug 2013 15:56:30 +0200 Lines: 76 Message-ID: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="----enig2KORNWEXCTJDANISUNQEX" X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: lara.cc.fer.hr User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130322 Thunderbird/17.0.4 X-Enigmail-Version: 1.5.1 Cc: freebsd-hackers@freebsd.org X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Aug 2013 13:56:44 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2KORNWEXCTJDANISUNQEX Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, Prodded by davide@, I'd like to collect opinions about raising the vfs.ufs.dirhash_reclaimage sysctl from 5 to 60, committed at: http://svnweb.freebsd.org/changeset/base/254986 What it does: Used in lowmem handler at http://fxr.watson.org/fxr/source/ufs/ufs/ufs_dirhash.c#L1247 when determining which cache entries to evict; it skips (keeps in the cache) entries which are younger than this number of seconds. This lowmem handler only frees up to 10% of the dirhash cache at a time. A real-life example: a PHP server with session files on local storage. Even a moderately busy server will usually have several GB of these small files sharded in directories containing few hundred files each, up to several hundred thousand files total. It is a standard practice for admins to increase the dirhash if they notice PHP/apache processes stuck in the "ufs" state for too long. Why: Without ufs_dirhashreclaimage, it is possible that UFS dirhash entries will get evicted immediately after they are created if a lowmem situation occurs. The previous ufs_dirhashreclaimage value was 5, keeping the entries for at least 5 seconds before allowing them to get evicted (Reclaim Age). Why the change: Dirhash is a cache. Keeping as large number of entries as possible for as large amount of time as possible is a good thing. It can be done either by increasing maxmem or by increasing reclaimage. A scenario where increasing reclaimage helps: when a load spike happens, the following happens: 1) memory gets used up, 2) lowmem is signalled 3) dirhash entries get evicted 4) processes get slower (this can be observed in "top" as being in the "ufs" wchan) waiting for the data which could have been cached. Increasing reclaimage during a spike situation has the effect of clearing up processes faster. Why not leave it for sysadmins to tune it themselves if they want it: 1) They usually don't know about it until it's too late. 2) Dirhash is typically miniscule compared to todays memory sizes - a few dozen MBs even on very busy systems, and there are no typical situations where a large number of entries are filled in at the same time which block eviction of a large-ish amount of memory, so having reclaimage higher will automatically help in file-system intensive spikes without harming other uses. ------enig2KORNWEXCTJDANISUNQEX Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (FreeBSD) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlIeAY8ACgkQ/QjVBj3/HSzEfACgjc4tpCc9AiqrPej/QFki0vH8 u+YAoI67IgN3kTH2GptadAKQgQ5TYTnT =aryY -----END PGP SIGNATURE----- ------enig2KORNWEXCTJDANISUNQEX--