All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Fields <bfields@fieldses.org>
To: Chuck Lever III <chuck.lever@oracle.com>
Cc: Steve Dickson <steved@redhat.com>, Dai Ngo <dai.ngo@oracle.com>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH] nfsdcld: use WAL journal for faster commits
Date: Fri, 3 Dec 2021 17:39:21 -0500	[thread overview]
Message-ID: <20211203223921.GA6151@fieldses.org> (raw)
In-Reply-To: <469DF1ED-C2AB-43CE-AB70-BFD2AFC2A68D@oracle.com>

On Fri, Dec 03, 2021 at 10:07:19PM +0000, Chuck Lever III wrote:
> 
> 
> > On Dec 3, 2021, at 4:55 PM, Bruce Fields <bfields@fieldses.org> wrote:
> > 
> > From: "J. Bruce Fields" <bfields@redhat.com>
> > 
> > Currently nfsdcld is doing three fdatasyncs for each upcall.  Based on
> > SQLite documentation, WAL mode should also be safe, and I can confirm
> > from an strace that it results in only one fdatasync each.
> > 
> > This may be a bottleneck e.g. when lots of clients are being created or
> > expired at once (e.g. on reboot).
> > 
> > Not bothering with error checking, as this is just an optimization and
> > nfsdcld will still function without.  (Might be better to log something
> > on failure, though.)
> 
> I'm in full philosophical agreement for performance improvements
> in this area. There are some caveats for WAL:
> 
>  - It requires SQLite v3.7.0 (2010). configure.ac may need to be
>    updated.

Makes sense.  But I dug around a bit, and how to do this is a total
mystery to me....

>  - All processes using the DB file have to be on the same system.
>    Not sure if this matters for some DR scenarios that nfs-utils
>    is supposed to support.

I don't think we support that.

>  - WAL mode is persistent; you could set this at database creation
>    time and it should be sti cky.

I wanted to upgrade existing databases too, and figured there's no harm
in calling it on each startup.

>  - Documentation says "synchronous = FULL is the most commonly
>    used synchronous setting when not in WAL mode." Why are both
>    PRAGMAs necessary here?

Maybe they're not; I think I did see that FULL is actually the default
but I can't find that in the documentation right now.

--b.

> 
> I agree that nfsdcld functionality is not affected if the first
> PRAGMA fails.
> 
> 
> > Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> > ---
> > utils/nfsdcld/sqlite.c | 3 +++
> > 1 file changed, 3 insertions(+)
> > 
> > diff --git a/utils/nfsdcld/sqlite.c b/utils/nfsdcld/sqlite.c
> > index 03016fb95823..b248eeffa204 100644
> > --- a/utils/nfsdcld/sqlite.c
> > +++ b/utils/nfsdcld/sqlite.c
> > @@ -826,6 +826,9 @@ sqlite_prepare_dbh(const char *topdir)
> > 		goto out_close;
> > 	}
> > 
> > +	sqlite3_exec(dbh, "PRAGMA journal_mode = WAL;", NULL, NULL, NULL);
> > +	sqlite3_exec(dbh, "PRAGMA synchronous = FULL;", NULL, NULL, NULL);
> > +
> > 	ret = sqlite_query_schema_version();
> > 	switch (ret) {
> > 	case CLD_SQLITE_LATEST_SCHEMA_VERSION:
> > -- 
> > 2.33.1
> > 
> 
> --
> Chuck Lever
> 
> 

  reply	other threads:[~2021-12-03 22:39 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-29  0:56 [PATCH RFC v5 0/2] nfsd: Initial implementation of NFSv4 Courteous Server Dai Ngo
2021-09-29  0:56 ` [PATCH RFC v5 1/2] fs/lock: add new callback, lm_expire_lock, to lock_manager_operations Dai Ngo
2021-09-29  0:56 ` [PATCH RFC v5 2/2] nfsd: Initial implementation of NFSv4 Courteous Server Dai Ngo
2021-10-01 20:53 ` [PATCH RFC v5 0/2] " J. Bruce Fields
2021-10-01 21:41   ` dai.ngo
2021-10-01 23:03     ` J. Bruce Fields
2021-11-16 23:06     ` dai.ngo
2021-11-17 14:14       ` J. Bruce Fields
2021-11-17 17:59         ` dai.ngo
2021-11-17 21:46           ` dai.ngo
2021-11-18  0:34             ` J. Bruce Fields
2021-11-22  3:04               ` dai.ngo
2021-11-29 17:13                 ` dai.ngo
2021-11-29 17:30                   ` J. Bruce Fields
2021-11-29 18:32                     ` dai.ngo
2021-11-29 19:03                       ` Chuck Lever III
2021-11-29 19:13                         ` Bruce Fields
2021-11-29 19:39                           ` dai.ngo
2021-11-29 19:36                         ` dai.ngo
2021-11-29 21:01                           ` dai.ngo
2021-11-29 21:10                           ` Chuck Lever III
2021-11-30  0:11                             ` dai.ngo
2021-11-30  1:42                               ` Chuck Lever III
2021-11-30  4:08                                 ` Trond Myklebust
2021-11-30  4:47                                   ` Chuck Lever III
2021-11-30  4:57                                     ` Trond Myklebust
2021-11-30  7:22                                       ` dai.ngo
2021-11-30 13:37                                         ` Trond Myklebust
2021-12-01  3:52                                           ` dai.ngo
2021-12-01 14:19                                             ` bfields
2021-11-30 15:36                                         ` Chuck Lever III
2021-11-30 16:05                                           ` Bruce Fields
2021-11-30 16:14                                             ` Trond Myklebust
2021-11-30 19:01                                               ` bfields
2021-11-30  7:13                                 ` dai.ngo
2021-11-30 15:32                                   ` Bruce Fields
2021-12-01  3:50                                     ` dai.ngo
2021-12-01 14:36                                       ` Bruce Fields
2021-12-01 14:51                                         ` Bruce Fields
2021-12-01 18:47                                           ` dai.ngo
2021-12-01 19:25                                             ` Bruce Fields
2021-12-02 17:53                                           ` Chuck Lever III
2021-12-01 17:42                                         ` Bruce Fields
2021-12-01 18:03                                           ` Bruce Fields
2021-12-01 19:50                                             ` Bruce Fields
2021-12-03 21:22                                               ` Bruce Fields
2021-12-03 21:55                                                 ` [PATCH] nfsdcld: use WAL journal for faster commits Bruce Fields
2021-12-03 22:07                                                   ` Chuck Lever III
2021-12-03 22:39                                                     ` Bruce Fields [this message]
2021-12-04  0:35                                                       ` Chuck Lever III
2021-12-04  1:24                                                         ` Bruce Fields
2021-12-06 15:46                                                           ` Chuck Lever III
2022-01-04 22:24                                                             ` Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211203223921.GA6151@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.com \
    --cc=dai.ngo@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.