Thread: Configuring fdatasync for Solaris2

Configuring fdatasync for Solaris2

From
Kenji Sugita
Date:
Attached is a patch to find out fdatasync in libposix4 for Solaris2.

The function fdatasync resides in libposix4 on Solaris2. Configure does not
try to find the function in libposix4 and then misses fdatasync.


Kenji Sugita
sugita@sra.co.jp
Index: configure.in
===================================================================
RCS file: /home/mgr/sugita/jobs/cvs-master/pgsql/src/7.1.3/build/configure.in,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 configure.in
--- configure.in    16 Aug 2001 18:36:31 -0000    1.1.1.1
+++ configure.in    10 Sep 2001 14:53:56 -0000
@@ -656,6 +656,10 @@ if test "$PORTNAME" != "aix" -a "$PORTNA
 then
     AC_CHECK_LIB(bsd,      main)
 fi
+if test "$PORTNAME" = "solaris"
+then
+    AC_CHECK_LIB(posix4,      main)
+fi
 AC_CHECK_LIB(util,     setproctitle)
 AC_CHECK_LIB(m,        main)
 AC_CHECK_LIB(dl,       main)

Re: Configuring fdatasync for Solaris2

From
Peter Eisentraut
Date:
Kenji Sugita writes:

> Attached is a patch to find out fdatasync in libposix4 for Solaris2.

Please use AC_SEARCH_LIBS and do not make the test dependent on solaris.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: Configuring fdatasync for Solaris2

From
Kenji Sugita
Date:
From: Peter Eisentraut <peter_e@gmx.net>
Subject: Re: [PATCHES] Configuring fdatasync for Solaris2
Date: Mon, 10 Sep 2001 19:58:55 +0200 (CEST)

;;; Kenji Sugita writes:
;;;
;;; > Attached is a patch to find out fdatasync in libposix4 for Solaris2.
;;;
;;; Please use AC_SEARCH_LIBS and do not make the test dependent on solaris.
;;;
;;; --
;;; Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter

It already dependents on aix and alpha. Why should solaris use AC_SEARCH_LIBS?

...
if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
then
        AC_CHECK_LIB(bsd,      main)
fi
AC_CHECK_LIB(util,     setproctitle)
...


Kenji Sugita
sugita@sra.co.jp

Re: Configuring fdatasync for Solaris2

From
Peter Eisentraut
Date:
I have installed a patch that should work for you.  I used -lrt instead of
-lposix4.  They should be the same, but the former seems to be preferred.

Kenji Sugita writes:

> It already dependents on aix and alpha. Why should solaris use AC_SEARCH_LIBS?

Better style.  It eliminates the chance of picking up libraries that are
not really needed.  A lot of systems have "compatibility" libraries of all
kinds lying around.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: Configuring fdatasync for Solaris2

From
Kenji Sugita
Date:
From: Peter Eisentraut <peter_e@gmx.net>
Subject: Re: [PATCHES] Configuring fdatasync for Solaris2
Date: Tue, 11 Sep 2001 16:38:37 +0200 (CEST)

;;; I have installed a patch that should work for you.  I used -lrt instead of
;;; -lposix4.  They should be the same, but the former seems to be preferred.

Did you posted? I would like to try to use it.

My understanding is that it should be enabled by configure, since fdatasync
is the best method for Solaris2.

;;; Kenji Sugita writes:
;;;
;;; > It already dependents on aix and alpha. Why should solaris use AC_SEARCH_LIBS?
;;;
;;; Better style.  It eliminates the chance of picking up libraries that are
;;; not really needed.  A lot of systems have "compatibility" libraries of all
;;; kinds lying around.

I agree.

;;; --
;;; Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Kenji Sugita
sugita@sra.co.jp

Re: Configuring fdatasync for Solaris2

From
Bruce Momjian
Date:

I assume he applied it to current CVS.


> From: Peter Eisentraut <peter_e@gmx.net>
> Subject: Re: [PATCHES] Configuring fdatasync for Solaris2
> Date: Tue, 11 Sep 2001 16:38:37 +0200 (CEST)
>
> ;;; I have installed a patch that should work for you.  I used -lrt instead of
> ;;; -lposix4.  They should be the same, but the former seems to be preferred.
>
> Did you posted? I would like to try to use it.
>
> My understanding is that it should be enabled by configure, since fdatasync
> is the best method for Solaris2.
>
> ;;; Kenji Sugita writes:
> ;;;
> ;;; > It already dependents on aix and alpha. Why should solaris use AC_SEARCH_LIBS?
> ;;;
> ;;; Better style.  It eliminates the chance of picking up libraries that are
> ;;; not really needed.  A lot of systems have "compatibility" libraries of all
> ;;; kinds lying around.
>
> I agree.
>
> ;;; --
> ;;; Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter
>
>
> Kenji Sugita
> sugita@sra.co.jp
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Configuring fdatasync for Solaris2

From
Peter Eisentraut
Date:
Kenji Sugita writes:

> ;;; I have installed a patch that should work for you.  I used -lrt instead of
> ;;; -lposix4.  They should be the same, but the former seems to be preferred.
>
> Did you posted? I would like to try to use it.

I added

    AC_SEARCH_LIBS(fdatasync, rt)

near the location where your patch went.

> My understanding is that it should be enabled by configure, since fdatasync
> is the best method for Solaris2.

Correct.  fdatasync() is (when not simply aliased to fsync) more efficient
than fsync(), which is it's reason of existence.  I find it interesting
that it's associated with "real-time" computing.

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: Configuring fdatasync for Solaris2

From
Kenji Sugita
Date:
From: Peter Eisentraut <peter_e@gmx.net>
Subject: Re: [PATCHES] Configuring fdatasync for Solaris2
Date: Tue, 11 Sep 2001 21:25:31 +0200 (CEST)

;;; I added
;;;
;;;     AC_SEARCH_LIBS(fdatasync, rt)
;;;
;;; near the location where your patch went.

I applied your modification in the current to 7.1.3. Configure says as
follows:

    $ uname -a
    SunOS ext274 5.6 Generic_105181-23 sun4u sparc SUNW,UltraSPARC-IIi-cEngine
    $ cvs di configure.in
    Index: configure.in
    ===================================================================
    RCS file: /home/mgr/sugita/jobs/cvs-master/pgsql/src/7.1.3/build/configure.in,v
    retrieving revision 1.1.1.1
    diff -u -3 -p -r1.1.1.1 configure.in
    --- configure.in        16 Aug 2001 18:36:31 -0000      1.1.1.1
    +++ configure.in        12 Sep 2001 01:44:13 -0000
    @@ -681,6 +681,7 @@ dnl it seems unwise to encourage people
     AC_EGREP_HEADER(z_streamp, zlib.h, [
     AC_CHECK_LIB(z,        inflate)
     ])
=>  +AC_SEARCH_LIBS(fdatasync, rt)


     if test "$with_krb4" = yes ; then
    $ autoconf
    $ ./configure 2>&1 | tee configure.out
    ...
    checking for inflate in -lz... yes
=>  checking for library containing fdatasync... no
    checking for crypt.h... yes
    ...
    $

I also cannot find out the rt library on Solaris2. The library posix4 hits
fdatasync.

    $ make distclean
    $ cvs di -u configure.in
    Index: configure.in
    ===================================================================
    RCS file: /home/mgr/sugita/jobs/cvs-master/pgsql/src/7.1.3/build/configure.in,v
    retrieving revision 1.1.1.1
    diff -u -3 -p -u -r1.1.1.1 configure.in
    --- configure.in        16 Aug 2001 18:36:31 -0000      1.1.1.1
    +++ configure.in        12 Sep 2001 01:58:39 -0000
    @@ -681,6 +681,7 @@ dnl it seems unwise to encourage people
     AC_EGREP_HEADER(z_streamp, zlib.h, [
     AC_CHECK_LIB(z,        inflate)
     ])
=>  +AC_SEARCH_LIBS(fdatasync, posix4)


     if test "$with_krb4" = yes ; then
    $ autoconf
    $ ./configure 2>&1 | tee configure.out
    ...
    checking for inflate in -lz... yes
=>  checking for library containing fdatasync... -lposix4
    checking for crypt.h... yes
    ...
    $ make install
    $ initdb
    $ pg_ctl -o '-c wal_sync_method=fdatasync -S' start
    postmaster successfully started
    $ psql template1
    Welcome to psql, the PostgreSQL interactive terminal.

    Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

    template1=# show wal_sync_method;
    NOTICE:  wal_sync_method is fdatasync
    SHOW VARIABLE
    template1=#


Kenji Sugita
sugita@sra.co.jp

Re: Configuring fdatasync for Solaris2

From
Peter Eisentraut
Date:
Kenji Sugita writes:

> I also cannot find out the rt library on Solaris2. The library posix4 hits
> fdatasync.

I rechecked the manuals, apparently -lrt was added in a later version
(after the POSIX.4 group was renamed?).  I've changed the test to check
both libraries.

Do you have any performance data of the fdatasync method versus the
default open_datasync method?

--
Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Re: Configuring fdatasync for Solaris2

From
Kenji Sugita
Date:
> Date: Wed, 12 Sep 2001 14:19:09 +0200 (CEST)
> From: Peter Eisentraut <peter_e@gmx.net>
> To: Kenji Sugita <sugita@sra.co.jp>
> Subject: Re: [PATCHES] Configuring fdatasync for Solaris2
>
> > I also cannot find out the rt library on Solaris2. The library posix4 hits
> > fdatasync.
>
> I rechecked the manuals, apparently -lrt was added in a later version
> (after the POSIX.4 group was renamed?).  I've changed the test to check
> both libraries.

Thanks a lot.

> Do you have any performance data of the fdatasync method versus the
> default open_datasync method?

I have the data for SPARC 500MHz Solaris2.6 running PostgreSQL 7.1.3.

    #clients  open_datasync  fdatasync (TPC-B, TPS)
    ========  =============  =========
    1             34.867522  47.188265
    2             41.457329  57.119142
    4             41.854741  62.250403
    8             43.103382  63.909396
    16            35.890254  62.757908
    32            41.421592  52.132258
    64            37.325511  51.805046
    128           28.906521  37.942672

This table is made by following commands:

    pgbench -i -s 10
    pgbench -c #clients -t 100

> Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Kenji Sugita
sugita@sra.co.jp

Re: Configuring fdatasync for Solaris2

From
Bruce Momjian
Date:
Wow!  That is a huge difference.  I wish we could make
fdatasync/datasync use automatic.  We can't now because sometimes
fdatasync is just a stub for fsync, and in those cases open_fsync may be
a better option.  I would really like some ideas on automatic
configuration.


> > Date: Wed, 12 Sep 2001 14:19:09 +0200 (CEST)
> > From: Peter Eisentraut <peter_e@gmx.net>
> > To: Kenji Sugita <sugita@sra.co.jp>
> > Subject: Re: [PATCHES] Configuring fdatasync for Solaris2
> >
> > > I also cannot find out the rt library on Solaris2. The library posix4 hits
> > > fdatasync.
> >
> > I rechecked the manuals, apparently -lrt was added in a later version
> > (after the POSIX.4 group was renamed?).  I've changed the test to check
> > both libraries.
>
> Thanks a lot.
>
> > Do you have any performance data of the fdatasync method versus the
> > default open_datasync method?
>
> I have the data for SPARC 500MHz Solaris2.6 running PostgreSQL 7.1.3.
>
>     #clients  open_datasync  fdatasync (TPC-B, TPS)
>     ========  =============  =========
>     1             34.867522  47.188265
>     2             41.457329  57.119142
>     4             41.854741  62.250403
>     8             43.103382  63.909396
>     16            35.890254  62.757908
>     32            41.421592  52.132258
>     64            37.325511  51.805046
>     128           28.906521  37.942672
>
> This table is made by following commands:
>
>     pgbench -i -s 10
>     pgbench -c #clients -t 100
>
> > Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter
>
>
> Kenji Sugita
> sugita@sra.co.jp
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: Configuring fdatasync for Solaris2

From
Kenji Sugita
Date:
> Date: Wed, 12 Sep 2001 14:19:09 +0200 (CEST)
> From: Peter Eisentraut <peter_e@gmx.net>
> To: Kenji Sugita <sugita@sra.co.jp>
> Subject: Re: [PATCHES] Configuring fdatasync for Solaris2
>
> > I also cannot find out the rt library on Solaris2. The library posix4 hits
> > fdatasync.
>
> I rechecked the manuals, apparently -lrt was added in a later version
> (after the POSIX.4 group was renamed?).  I've changed the test to check
> both libraries.

Thanks a lot.

> Do you have any performance data of the fdatasync method versus the
> default open_datasync method?

I have the data for SPARC 500MHz Solaris2.6 running PostgreSQL 7.1.3.

    #clients  open_datasync  fdatasync (TPC-B, TPS)
    ========  =============  =========
    1             34.867522  47.188265
    2             41.457329  57.119142
    4             41.854741  62.250403
    8             43.103382  63.909396
    16            35.890254  62.757908
    32            41.421592  52.132258
    64            37.325511  51.805046
    128           28.906521  37.942672

This table is made by following commands:

    pgbench -i -s 10
    pgbench -c #clients -t 100

> Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Kenji Sugita
sugita@sra.co.jp

Re: Configuring fdatasync for Solaris2

From
sugita@srapc1267.sra.co.jp
Date:
Date: Thu, 13 Sep 2001 01:37:31 +0900
From: Kenji Sugita <sugita@sranhm.sra.co.jp>

> Date: Wed, 12 Sep 2001 14:19:09 +0200 (CEST)
> From: Peter Eisentraut <peter_e@gmx.net>
> To: Kenji Sugita <sugita@sra.co.jp>
> Subject: Re: [PATCHES] Configuring fdatasync for Solaris2
>
> > I also cannot find out the rt library on Solaris2. The library posix4 hits
> > fdatasync.
>
> I rechecked the manuals, apparently -lrt was added in a later version
> (after the POSIX.4 group was renamed?).  I've changed the test to check
> both libraries.

Thanks a lot.

> Do you have any performance data of the fdatasync method versus the
> default open_datasync method?

I have the data for SPARC 500MHz Solaris2.6 running PostgreSQL 7.1.3.

    #clients  open_datasync  fdatasync (TPC-B, TPS)
    ========  =============  =========
    1             34.867522  47.188265
    2             41.457329  57.119142
    4             41.854741  62.250403
    8             43.103382  63.909396
    16            35.890254  62.757908
    32            41.421592  52.132258
    64            37.325511  51.805046
    128           28.906521  37.942672

This table is made by following commands:

    pgbench -i -s 10
    pgbench -c #clients -t 100

> Peter Eisentraut   peter_e@gmx.net   http://funkturm.homeip.net/~peter


Kenji Sugita
sugita@sra.co.jp