Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc0b2bbf

Browse files
committed
Add WAL mmap() mention.
1 parent6896663 commitc0b2bbf

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

‎doc/TODO.detail/mmap

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,3 +379,106 @@ TIP 5: Have you checked our extensive FAQ?
379379

380380
http://www.postgresql.org/users-lounge/docs/faq.html
381381

382+
From pgsql-hackers-owner+M13750=candle.pha.pa.us=pgman@postgresql.org Mon Oct 1 05:59:15 2001
383+
Return-path: <pgsql-hackers-owner+M13750=candle.pha.pa.us=pgman@postgresql.org>
384+
Received: from server1.pgsql.org (server1.pgsql.org [64.39.15.238] (may be forged))
385+
by candle.pha.pa.us (8.11.6/8.10.1) with ESMTP id f919xF512590
386+
for <pgman@candle.pha.pa.us>; Mon, 1 Oct 2001 05:59:15 -0400 (EDT)
387+
Received: from postgresql.org (webmail.postgresql.org [216.126.85.28])
388+
by server1.pgsql.org (8.11.6/8.11.6) with ESMTP id f919xA207817
389+
for <pgman@candle.pha.pa.us>; Mon, 1 Oct 2001 04:59:10 -0500 (CDT)
390+
(envelope-from pgsql-hackers-owner+M13750=candle.pha.pa.us=pgman@postgresql.org)
391+
Received: from mrsgntmail01.mediaring.com.sg (mserver.mediaring.com.sg [203.208.141.175])
392+
by postgresql.org (8.11.3/8.11.4) with ESMTP id f919rE320926
393+
for <pgsql-hackers@postgreSQL.org>; Mon, 1 Oct 2001 05:53:15 -0400 (EDT)
394+
(envelope-from jana-reddy@mediaring.com.sg)
395+
Received: by MRSGNTMAIL01 with Internet Mail Service (5.5.2650.21)
396+
id <PMTCM7SJ>; Mon, 1 Oct 2001 18:03:34 +0800
397+
Received: from mediaring.com.sg (10.1.0.131 [10.1.0.131]) by mrsgntmail01.mediaring.com.sg with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21)
398+
id PMTCM7SH; Mon, 1 Oct 2001 18:03:25 +0800
399+
From: Janardhana Reddy <jana-reddy@mediaring.com.sg>
400+
To: Bruce Momjian <pgman@candle.pha.pa.us>, Tom Lane <tgl@sss.pgh.pa.us>
401+
cc: PostgreSQL-development <pgsql-hackers@postgresql.org>,
402+
janareddy
403+
<jana-reddy@mediaring.com.sg>
404+
Message-ID: <3BB83DF0.8946973@mediaring.com.sg>
405+
Date: Mon, 01 Oct 2001 17:57:04 +0800
406+
X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.4.0 i686)
407+
X-Accept-Language: en
408+
MIME-Version: 1.0
409+
Subject: Re: [HACKERS] PERFORMANCE IMPROVEMENT by mapping WAL FILES
410+
References: <200109282137.f8SLbpm01890@candle.pha.pa.us>
411+
Content-Type: text/plain; charset=us-ascii
412+
Content-Transfer-Encoding: 7bit
413+
Precedence: bulk
414+
Sender: pgsql-hackers-owner@postgresql.org
415+
Status: ORr
416+
417+
I have just completed the functional testing the WAL using mmap , it is
418+
419+
working fine, I have tested by commenting out the "CreateCheckPoint "
420+
functionality so that
421+
when i kill the postgres and restart it will redo all the records from the
422+
WAL log file which
423+
is updated using mmap.
424+
Just i need to clean code and to do some stress testing.
425+
By the end of this week i should able to complete the stress test and
426+
generate the patch file .
427+
As Tom Lane mentioned i see the problem in portability to all platforms,
428+
429+
what i propose is to use mmap for only WAL for some platforms like
430+
linux,freebsd etc . For other platforms we can use the existing method by
431+
slightly modifying the
432+
write() routine to write only the modified part of the page.
433+
434+
Regards
435+
jana
436+
437+
>
438+
>
439+
> OK, I have talked to Tom Lane about this on the phone and we have a few
440+
> ideas.
441+
>
442+
> Historically, we have avoided mmap() because of portability problems,
443+
> and because using mmap() to write to large tables could consume lots of
444+
> address space with little benefit. However, I perhaps can see WAL as
445+
> being a good use of mmap.
446+
>
447+
> First, there is the issue of using mmap(). For OS's that have the
448+
> mmap() MAP_SHARED flag, different backends could mmap the same file and
449+
> each see the changes. However, keep in mind we still have to fsync()
450+
> WAL, so we need to use msync().
451+
>
452+
> So, looking at the benefits of using mmap(), we have overhead of
453+
> different backends having to mmap something that now sits quite easily
454+
> in shared memory. Now, I can see mmap reducing the copy from user to
455+
> kernel, but there are other ways to fix that. We could modify the
456+
> write() routines to write() 8k on first WAL page write and later write
457+
> only the modified part of the page to the kernel buffers. The old
458+
> kernel buffer is probably still around so it is unlikely to require a
459+
> read from the file system to read in the rest of the page. This reduces
460+
> the write from 8k to something probably less than 4k which is better
461+
> than we can do with mmap.
462+
>
463+
> I will add a TODO item to this effect.
464+
>
465+
> As far as reducing the write to disk from 8k to 4k, if we have to
466+
> fsync/msync, we have to wait for the disk to spin to the proper location
467+
> and at that point writing 4k or 8k doesn't seem like much of a win.
468+
>
469+
> In summary, I think it would be nice to reduce the 8k transfer from user
470+
> to kernel on secondary page writes to only the modified part of the
471+
> page. I am uncertain if mmap() or anything else will help the physical
472+
> write to the disk.
473+
>
474+
> --
475+
> Bruce Momjian | http://candle.pha.pa.us
476+
> pgman@candle.pha.pa.us | (610) 853-3000
477+
> + If your life is a hard drive, | 830 Blythe Avenue
478+
> + Christ can be your backup. | Drexel Hill, Pennsylvania 19026
479+
480+
---------------------------(end of broadcast)---------------------------
481+
TIP 6: Have you searched our list archives?
482+
483+
http://archives.postgresql.org
484+

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp