Hi all,
          By   mapping  the WAL files by each backend  in to its address
space  using "mmap"  system call , there  will be  big
 improvements  in performance  from the following point of view:
              1.   Each  backend directly writes in to the address
space  which is  obtained by  maping  the WAL files.
                      this  saves  the write system call at the  end of
every transaction  which transfres  8k of
                      data from user space to kernel.
               2.   since every transaction does not modify all the 8k
content of WAL page , so by issuing the
                       fsync , the  kernel  only   transfers only the
kernel pages which are modified , which is  4k for
                        linux so fsync time  is saved by  twice.
Any comments ?.


Regards
jana

Wed, 26 Sep 2001 19:23:27 +0800
Janardhana Reddy <jana-reddy@mediaring.com.sg>
PERFORMANCE IMPROVEMENT by mapping  WAL FILES 
> Hi all,
>           By   mapping  the WAL files by each backend  in to its address
> space  using "mmap"  system call , there  will be  big
>  improvements  in performance  from the following point of view:
>               1.   Each  backend directly writes in to the address
> space  which is  obtained by  maping  the WAL files.
>                       this  saves  the write system call at the  end of
> every transaction  which transfres  8k of
>                       data from user space to kernel.
>                2.   since every transaction does not modify all the 8k
> content of WAL page , so by issuing the
>                        fsync , the  kernel  only   transfers only the
> kernel pages which are modified , which is  4k for
>                         linux so fsync time  is saved by  twice.
> Any comments ?.

This is interesting.  We are concerned about using mmap() for all I/O
because we could eat up quite a bit of address space for big tables, but
WAL seems like an ideal use for mmap().

-- 
  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

Wed, 26 Sep 2001 10:54:37 -0400 (EDT)
Bruce Momjian <pgman@candle.pha.pa.us>
Re: PERFORMANCE IMPROVEMENT by mapping  WAL FILES
Janardhana Reddy <jana-reddy@mediaring.com.sg> writes:
>           By   mapping  the WAL files by each backend  in to its address
> space  using "mmap"  system call ,

There are a lot of problems with trying to use mmap for Postgres.  One
is portability: not all platforms have mmap, so we'd still have to
support the non-mmap case; and it's not at all clear that fsync/msync
semantics are consistent across platforms, either.  A bigger objection
is that mmap'ing a file in one backend does not cause it to become
available to other backends, thus the entire concept of shared buffers
breaks down.

If you think you can make it work, feel free to try it ...

			regards, tom lane

Wed, 26 Sep 2001 11:15:00 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: PERFORMANCE IMPROVEMENT by mapping WAL FILES 