Or: How to throttle down one LVM mirror leg lowering its assumed synchronization cpu load?
Is it possible to tweak a LVM mirror configuration so it takes it easy on mirroring files?
Whenever there is some big write, the machine hangs for some seconds (to many).
If LVM could mirror such files in a slower pace, I don't really care having to wait some minutes so the full mirroring completes; LVM could even copy big files little by little.
As an alternative: I am thinking on daemonising unison to backup all small files every minute, and big files I could write a script to copy in a less intensive way.
PS.: I am using KVPM to manage it.
Currently I am trying to use CGroup io throttle, so I can keep LVM mirror active.
I found some info here. I am quite scared of make things stop working also, so I am trying to be sure on what to do...
The lvm mirror leg I want to slow down is at
/dev/mapper/GRP-NM_mimage_1 -> /dev/dm-1 from
/dev/sda4 (the fast one is at /dev/sdb2).
lvdisplay -v /dev/GRP/NM shows a block device without specifying what mirror leg it is related to...
pvdisplay -mv shows
Physical extent 102839 to 117077, Logical volume /dev/GRP/NM_mimage_1, Logical extents 0 to 14238
basically, from this answer, I miss what major:minor to use.
sudo lvdisplay -am let me determine the correct major:minor for the mirror leg I need to throttle writes down, now lets test it!
well, the test did not work.
echo "252:1 $((1*1024*1024))" |sudo tee /sys/fs/cgroup/blkio/blkio.throttle.write_bps_device but even for a 10MB limit, I was still having huge wait times to copy a simple 800MB file from a SATA to a the SSD mirror leg.
For now I just disabled the root OS's SATA mirror leg (one was on the SSD, the other on a SATA). As I also have 5 simple files that I use as swap on the SSD (and were being mirrored to the SATA) my OS was too annoying to be used. I think I need another SSD to consider re-enabling the mirror leg. Unless someone knows how to let the mirror leg on the SATA stop being an IO bottle neck.
I ended letting the LVM mirror stopped for a long time.
Yesterday I re-enabled it finally!
I solved this other problem and LVM mirror seems not that heavy now (but it still seems heavy).
https://askubuntu.com/questions/1047568/why-systemctl-doesnt-list-manage-zeitgeist-daemon-and-what-who-actually-do/1051702#1051702 . I think this from iotop is related to LVM mirror, not sure yet:
be/3 root 0.00 K/s 43111.16 K/s 0.00 % 6.77 % [jbd2/dm-2-8]
This question is still useful I think, and I would like to try cgroup cfg whenever I understand it or someone releases a frontend (gfx or ncurses) with help info to let this great tool be more widely used :)