> On Dec 3, 2021, at 8:24 PM, Bruce Fields <bfields@xxxxxxxxxxxx> wrote: > > On Sat, Dec 04, 2021 at 12:35:11AM +0000, Chuck Lever III wrote: >> >>> On Dec 3, 2021, at 5:39 PM, Bruce Fields <bfields@xxxxxxxxxxxx> wrote: >>> >>> 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@xxxxxxxxxxxx> wrote: >>>>> >>>>> From: "J. Bruce Fields" <bfields@xxxxxxxxxx> >>>>> >>>>> 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.... >> >> aclocal/libsqlite3.m4 has an SQLITE_VERSION_NUMBER check. > > I looked got stuck trying to figure out why the #%^ it's comparing to > SQLITE_VERSION_NUMBER. OK, I see now, it's just some sanity check. > Here's take 2. > > --b. > > From c22d3a2d8576273934773fefac933d4f8e04776b Mon Sep 17 00:00:00 2001 > From: "J. Bruce Fields" <bfields@xxxxxxxxxx> > Date: Fri, 3 Dec 2021 10:27:53 -0500 > Subject: [PATCH] nfsdcld: use WAL journal for faster commits > > 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.) > > Signed-off-by: J. Bruce Fields <bfields@xxxxxxxxxx> Nice. Reviewed-by: Chuck Lever <chuck.lever@xxxxxxxxxx> > --- > aclocal/libsqlite3.m4 | 2 +- > utils/nfsdcld/sqlite.c | 2 ++ > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/aclocal/libsqlite3.m4 b/aclocal/libsqlite3.m4 > index 8c38993cbba8..c3beb4d56f0c 100644 > --- a/aclocal/libsqlite3.m4 > +++ b/aclocal/libsqlite3.m4 > @@ -22,7 +22,7 @@ AC_DEFUN([AC_SQLITE3_VERS], [ > int vers = sqlite3_libversion_number(); > > return vers != SQLITE_VERSION_NUMBER || > - vers < 3003000; > + vers < 3007000; > } > ], [libsqlite3_cv_is_recent=yes], [libsqlite3_cv_is_recent=no], > [libsqlite3_cv_is_recent=unknown]) > diff --git a/utils/nfsdcld/sqlite.c b/utils/nfsdcld/sqlite.c > index 03016fb95823..eabb0daa95f5 100644 > --- a/utils/nfsdcld/sqlite.c > +++ b/utils/nfsdcld/sqlite.c > @@ -826,6 +826,8 @@ sqlite_prepare_dbh(const char *topdir) > goto out_close; > } > > + sqlite3_exec(dbh, "PRAGMA journal_mode = WAL;", NULL, NULL, NULL); > + > ret = sqlite_query_schema_version(); > switch (ret) { > case CLD_SQLITE_LATEST_SCHEMA_VERSION: > -- > 2.33.1 -- Chuck Lever