From owner-freebsd-fs@freebsd.org Wed Dec 7 16:49:38 2016 Return-Path: Delivered-To: freebsd-fs@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 1A074C6CA9F for ; Wed, 7 Dec 2016 16:49:38 +0000 (UTC) (envelope-from george.wilson@delphix.com) Received: from mail-qk0-x232.google.com (mail-qk0-x232.google.com [IPv6:2607:f8b0:400d:c09::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CF88494D for ; Wed, 7 Dec 2016 16:49:37 +0000 (UTC) (envelope-from george.wilson@delphix.com) Received: by mail-qk0-x232.google.com with SMTP id n204so419505274qke.2 for ; Wed, 07 Dec 2016 08:49:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=delphix.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=3SQSLgrd+GqGvRzzqSYea+SrIgiTXE4WOz7wpilMAmw=; b=eXDq3TZSVVWvElFzn236x1pNhUco58WeHOW+GmCixvpLWkAY3JWLKyuE3bX0a3zPOX QOx5iedQ76eDUctBrO7/BpAXyWjEe6sCq3eK7NFumsxbMz2hM/OwtyiuYbyuuEquhF4e AblSJn6E10j2ujkCxQ8QiZODCp0gOtVf82SMM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=3SQSLgrd+GqGvRzzqSYea+SrIgiTXE4WOz7wpilMAmw=; b=Tlwo6iCWdzbxWwYlhFETgpu0VLrYCPgFFQ3XMzvVqOfK1u9n8f6pYsONdJX2S3sLgS Ov1beGWYc0aU5lQkWWN3nFoSqesjRAPrbQ+b9Ft2xIJ0MUAKjYUL96P6Y5w5+r1CTSp/ RZcN8VKfsJDJTk62dR3fYRusrAXUGyc1mzWKRJwf9uAdRw/2Gm2V6bWmdssL7sV8Hq9k Nq1Q32MTJWUFwXod2lxTuffu4xV5EgQcPoGkjhzB2bp013ClWbtYQgEs0brXJrPouCdx c4JEem/VEmzeo9JzP57ncf/FAjIbY2wdazbsY0NWcG+KLl2l7xlyYO81fLZuSmT8Wft5 MSBw== X-Gm-Message-State: AKaTC02g9LU/lPh1dUu/p5YWExz46AN5aRALVCIs3jYEeQL/hG2HaR43/yPQGH/Ns3mxYqDfNmXlqfC0t1ZY3rJf X-Received: by 10.55.79.86 with SMTP id d83mr57272490qkb.24.1481129376872; Wed, 07 Dec 2016 08:49:36 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.46.58 with HTTP; Wed, 7 Dec 2016 08:49:36 -0800 (PST) In-Reply-To: <374b6d16-5cb4-9338-ec1d-65ad93ca29dc@FreeBSD.org> References: <8b4ba98d-03d3-f671-33b2-ed12d3b4fb7c@FreeBSD.org> <374b6d16-5cb4-9338-ec1d-65ad93ca29dc@FreeBSD.org> From: George Wilson Date: Wed, 7 Dec 2016 11:49:36 -0500 Message-ID: Subject: Re: 11-STABLE vs 11.0-RELENG test To: Alexander Motin Cc: freebsd-fs@freebsd.org, Alex Tutubalin , Andriy Gapon Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Dec 2016 16:49:38 -0000 Alexander, Nice find! It's true that io_offset is 0 when we sort but the offset ordering should be implied by the way the way that we issue the I/Os from dbuf_sync_list(). The I/Os are issued in order within the file which is what we want. So having the offset comparison is probably not needed but we could use the bookmark's blkid as a new comparator. Let me know if I can help. Thanks, George On Wed, Dec 7, 2016 at 8:34 AM, Alexander Motin wrote: > On 06.12.2016 22:26, Alexander Motin wrote: > > I've reproduced this issue with quick test on my lab system configured > > with 12-disk RAIDZ2 pool. I've measured write and read back (with and > > without prefetch) speeds for pool recreated on different FreeBSD head > > revisions: > > r309625 r305456 r305330 r305322 > > write 702 701 1115 1120 > > read w/ pref 232 228 518 512 > > read w/o pref 128 126 242 240 > > > > I suspect we could obtain the problem here: > > > > r305331 | mav | 2016-09-03 13:04:37 +0300 (=D1=81=D0=B1, 03 =D1=81=D0= =B5=D0=BD=D1=82. 2016) | 45 lines > > > > MFV r304155: 7090 zfs should improve allocation order and throttle > > allocations > > Closer look shown me the cause. This code sorts I/Os on time, offset > and memory address. But time on FreeBSD (to reduce overhead) returned > with 1ms resolution, so it does not provide reliable ordering. Offset > sorting used by this patch is broken by design, since io_offset field is > always zero there, since it is used only for physical I/Os, not for > logical. As result, I/Os are "sorted" on memory address, that in fact > means complete randomization of all allocations within one millisecond, > predictably killing read performance. > > Switching gethrtime() emulation from getnanouptime() to nanouptime() > fixes the read performance, resulting: > nanouptime() > write 702 > read w/ pref 845 > read w/o pref 272 > > It would be good to make offset sorting really work there rather then > just switching to high resolution time source, but that maybe quite > invasive. Will look more. > > -- > Alexander Motin >