From: | Stefan Keller <sfkeller(at)gmail(dot)com> |
---|---|
To: | Wales Wang <wormwang(at)yahoo(dot)com> |
Cc: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net> |
Subject: | Re: 回复: [PERFORM] PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory? |
Date: | 2012-02-28 08:30:44 |
Message-ID: | CAFcOn2-cdt2=ikUHs-o0aH9tYkVhLD-DnXfo_EmZpFzVrQXEog@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Hi Wales
2012/2/27 Wales Wang <wormwang(at)yahoo(dot)com> wrote:
> There are many approach for PostgreSQL in-memory.
> The quick and easy way is making slave pgsql run on persistent RAM
> filesystem, the slave is part of master/slave replication cluster.
>
> The fstab and script make RAM file system persistent is below:
> Setup:
> First, create a mountpoint for the disk :
> mkdir /mnt/ramdisk
> Secondly, add this line to /etc/fstab in to mount the drive at boot-time.
> tmpfs /mnt/ramdisk tmpfs defaults,size=65536M 0 0
> #! /bin/sh
> # /etc/init.d/ramdisk.sh
> #
>
> case "$1" in
> start)
> echo "Copying files to ramdisk"
> rsync -av /data/ramdisk-backup/ /mnt/ramdisk/
> echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk Synched from HD >>
> /var/log/ramdisk_sync.log
> ;;
> sync)
> echo "Synching files from ramdisk to Harddisk"
> echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk Synched to HD >>
> /var/log/ramdisk_sync.log
> rsync -av --delete --recursive --force /mnt/ramdisk/
> /data/ramdisk-backup/
> ;;
> stop)
> echo "Synching logfiles from ramdisk to Harddisk"
> echo [`date +"%Y-%m-%d %H:%M"`] Ramdisk Synched to HD >>
> /var/log/ramdisk_sync.log
> rsync -av --delete --recursive --force /mnt/ramdisk/
> /data/ramdisk-backup/
> ;;
> *)
> echo "Usage: /etc/init.d/ramdisk {start|stop|sync}"
> exit 1
> ;;
> esac
> exit 0
>
> you can run it when startup and shutdown and crontabe hoursly.
>
> Wales Wang
Thank you for the tipp.
Making slave pgsql run on persistent RAM filesystem is surely at least
a possibility which I'll try out.
But what I'm finally after is a solution, where records don't get
pushed back to disk a.s.a.p. but rather got hold in memory as long as
possible assuming that there is enough memory.
I suspect that currently there is quite some overhead because of that
(besides disk-oriented structures).
-Stefan
From | Date | Subject | |
---|---|---|---|
Next Message | Claudio Freire | 2012-02-28 13:08:25 | Re: [PERFORM] Re: 回复: [PERFORM] PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory? |
Previous Message | Tom Lane | 2012-02-28 00:16:56 | Re: Index condition in a Nested Loop |