From owner-freebsd-fs@FreeBSD.ORG Tue Dec 8 23:11:11 2009 Return-Path: Delivered-To: freebsd-fs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B49CD106568D; Tue, 8 Dec 2009 23:11:11 +0000 (UTC) (envelope-from kevin@your.org) Received: from mail.your.org (chi02.mail.your.org [204.9.55.23]) by mx1.freebsd.org (Postfix) with ESMTP id 793A88FC14; Tue, 8 Dec 2009 23:11:11 +0000 (UTC) Received: from mail.your.org (chi02.mail.your.org [204.9.55.23]) by mail.your.org (Postfix) with ESMTP id D9E8F1808264; Tue, 8 Dec 2009 23:11:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=your.org; h=subject :mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; s=selector1 ; bh=ekEb4ENR61rbDYNQlhMFDqsNf1g=; b=v+3PaCV92/SfJO0Y08KRJzskbpq ntq7Tl+L++CRfjZ6VCB6kKPMC2QAlbd40pCThd1Pd6vSl0hWbt8dfRpWzPFr8mHf mKJLmsttj9DvLrLy5J1WESFNDFVSgMN+eH3iRA6tqMVMR5qyx40j1aUQT47sjru0 qBjZgBGJym38dhzA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=your.org; h=subject:mime-version :content-type:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to; q=dns; s=selector1; b=0n1FldpcKJ269RW TC+f6afLLf4ARbB6Ldgp3LXFkM2X6Q7oZYVUn/jKtTI5vQfqI3UVrg+7RGy3nUbu Z+vwjmVIsi/GOW/WtsWVUUjIElBktOMZEqTXUp+PQ6GUZGSfrcNFLbq5EIXsFZdt sYosrsKxJrW7ZbPDr41MVtSHyTfI= Received: from vpn177.ord02.your.org (vpn177.ord02.your.org [204.9.55.177]) by mail.your.org (Postfix) with ESMTPA id 903531808261; Tue, 8 Dec 2009 23:11:10 +0000 (UTC) Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes From: Kevin In-Reply-To: <20091204202134.GA1716@garage.freebsd.pl> Date: Tue, 8 Dec 2009 17:11:10 -0600 Content-Transfer-Encoding: 7bit Message-Id: References: <30582AF2-B1E8-4C07-A487-C220845963D2@your.org> <20091204202134.GA1716@garage.freebsd.pl> To: Pawel Jakub Dawidek X-Mailer: Apple Mail (2.1076) Cc: freebsd-fs@freebsd.org Subject: Re: "zfs receive" lock time X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 Dec 2009 23:11:11 -0000 On Dec 4, 2009, at 2:21 PM, Pawel Jakub Dawidek wrote: > On Wed, Dec 02, 2009 at 02:55:23PM -0600, Kevin wrote: >> >> If the slave is completely idle, "zfs receive" takes a fraction of a >> second. If the slave has been very busy (lots of read activity, no >> writes - the slave has everything mounted read only), suddenly "zfs >> receive" can take 30 seconds or more to complete, the whole time it >> has the filesystem locked. For example, I'd see: >> > > Read activity is related to the dataset on the slave that is being > received? Is that right? > Correct. > There are two operations that can suspend you file system this way: > rollback and receive. The suspend is done by acquiring write lock for > the given file system where every other operation acquires read lock. > In the end receive to acquire write lock has to wait for all read > operations to finish. > > I'm not sure how your applications use it, but if files are open for > short period of time only and then closed, you could do something like > this: > > master# curtime=`date "+%Y%m%d%H%M%S"` > master# zfs snapshot pool/fs@${curtime} > master# zfs send -i pool/fs@${oldtime} pool/fs@${curtime} | \ > ssh slave zfs recv pool/fs > slave# zfs clone pool/fs@${curtime} pool/fs_${curtime} > slave# ln -fs /pool/fs_${curtime} /pool/usethis > > Then point your application to use directory /pool/usethis/ (clone, > instead of received file system). And clean up clones as you wish. > Read activity on clones shouldn't affect received file system. This worked much much better, thank you! I'm still a little blurry on why "zfs receive" is so so so much slower (going from ms to >20s) if there's any read activity going on at all, but this seems to make it not matter to us. -- Kevin