From owner-freebsd-bugs@freebsd.org Mon Feb 8 15:57:36 2016 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF189AA238E for ; Mon, 8 Feb 2016 15:57:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (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 B46AF134B for ; Mon, 8 Feb 2016 15:57:36 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id u18FvaYT069594 for ; Mon, 8 Feb 2016 15:57:36 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 207022] stat() 4 to 16 times slower on FreeBSD/UFS than on Linux/Ext4 Date: Mon, 08 Feb 2016 15:57:36 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 10.2-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Many People X-Bugzilla-Who: fabianosidler@swissonline.ch X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter cc Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Feb 2016 15:57:37 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D207022 Bug ID: 207022 Summary: stat() 4 to 16 times slower on FreeBSD/UFS than on Linux/Ext4 Product: Base System Version: 10.2-RELEASE Hardware: amd64 OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: freebsd-bugs@FreeBSD.org Reporter: fabianosidler@swissonline.ch CC: freebsd-amd64@FreeBSD.org CC: freebsd-amd64@FreeBSD.org I happen a TYPO3 instance under FreeBSD/UFS running 4 to 16 times slower than on Linux/Ext4. Using XDebug I've found out that it's the stat() syscall spending the biggest part of the time. I've already tweaked vfs.ufs.dirhash_maxmem=3D104857600 vfs.ufs.dirhash_reclaimage=3D600 The UFS dirhash memory always has plenty space left so this can't be the bottleneck. I further found out with the following Dtrace script that inside the Kernel, the spinlock_exit and rdtsc functions take a huge part of the time: =3D=3D=3D snip =3D=3D=3D BEGIN { self->ts =3D timestamp; } fbt:::entry { printf("fbt enter %s\t%d\n", probefunc, timestamp-self->ts); self->ts =3D timestamp; } =3D=3D=3D snap =3D=3D=3D dtrace -qs teststat.d -c ./cstat | sort -nk4 | less =3D=3D=3D snip =3D=3D=3D fbt enter rdtsc 11744696324432 fbt enter rdtsc 11744696324802 fbt enter rdtsc 11744696324810 fbt enter rdtsc 11744696325033 fbt enter rdtsc 11744696325155 fbt enter rdtsc 11744696428364 fbt enter spinlock_exit 11744696510486 fbt enter spinlock_exit 11744697160417 fbt enter spinlock_exit 11744697807952 fbt enter spinlock_exit 11744704378856 fbt enter spinlock_exit 11744704699253 fbt enter spinlock_exit 11744716098379 fbt enter spinlock_exit 11744718145218 fbt enter spinlock_exit 11744750135790 fbt enter spinlock_exit 11744751498167 fbt enter spinlock_exit 11744767477782 fbt enter spinlock_exit 11744771142875 fbt enter spinlock_exit 11744784852745 fbt enter spinlock_exit 11744797873176 fbt enter spinlock_exit 11744804495582 fbt enter spinlock_exit 11744912093185 fbt enter spinlock_exit 11744981165023 =3D=3D=3D snap =3D=3D=3D ./cstat is a C program simply stat()ing some 1000 of existing files. Is this on purpose? What can I do to close the gap on Linux? Also, it's important to say that this is not an academic exercise! There is a client announcing to leave for a Linux-based server. The Linux tests were of course taken on absolutely identical hardware. Hopeful greetings Fabiano --=20 You are receiving this mail because: You are the assignee for the bug.=