[linux-lvm] how much memory does LVM need? oom-killer comes
Tomasz Chmielewski
mangoo at wpkg.org
Tue Sep 4 09:32:17 UTC 2007
Stuart D. Gathman schrieb:
> On Mon, 3 Sep 2007, Tomasz Chmielewski wrote:
>
>> Again, replying to myself, as no one on this list seem to have a clue
>> about problems with LVM snapshots... I added RAM, and was able to boot
>> again.
>
> I may have an answer after all. I suspect that the chunksize parameter
> to lvcreate -s will affect memory use. A larger chunksize should use
> less memory.
>
>> So, as a rule of thumb, we can say that for each *used* GB of snapshot,
>> ~3 MB of RAM is needed.
>
> On my snapshots on Centos-5, the chunksize defaults to 8k. With your
> observation of 3MB per Gig of snapshot, that comes to 24 bytes per chunk.
> Quite reasonable. If you make your chunksize 512K (the maximum supported),
> memory use should change to 48K per Gig.
>
> lvdisplay will show the chunksize for a snapshot.
Indeed, it was 8 kB.
What is the meaning of the chunksize in snapshots?
With 512 kB chunksize, I guess the snapshot will fill faster than with 8
KB chunksize, given that the same amount of data changes?
Here is a quick test that shows it.
I created two 20 GB snapshots of a 20GB volume, one with 8kB, and the
other with 512 kB chunksize.
Then, I created a 50 MB file on the original volume (out of /dev/zero):
build1 san1 owi-ao 20.00G
build1-512 san1 swi-a- 20.00G build1 0.09
build1-8 san1 swi-a- 20.00G build1 0.08
Copying /bin, /boot and /lib (71 MB in total) into a new directory makes
that difference bigger:
build1 san1 owi-ao 20.00G
build1-512 san1 swi-a- 20.00G build1 0.76
build1-8 san1 swi-a- 20.00G build1 0.62
Copying a 1.2 GB /usr into a new directory shows this:
build1-512 san1 swi-a- 20.00G build1 7.40
build1-8 san1 swi-a- 20.00G build1 7.18
And finally, create 1000000 empty files:
build1 san1 owi-ao 20.00G
build1-512 san1 swi-a- 20.00G build1 8.22
build1-8 san1 swi-a- 20.00G build1 7.91
The difference is not that big, usually it should be below 5%.
--
Tomasz Chmielewski
http://wpkg.org
More information about the linux-lvm
mailing list