Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How to avoid hd performance read/write hit with lxc/lxd ?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How to avoid hd performance read/write hit with lxc/lxd ?

I am experimenting with running some websites in linux containers. There is a noticeable degradation of around 20-30% in disk performance inside containers using btrf. Can you plz guide me a way around this ?

I am mainly using the containers with the hope of easily backing up and migrating the websites.

Comments

  • ShakibShakib Member, Patron Provider

    It might be related to SWAP.

    Small LXC won't be able to utilize full speed of a NVMe drive but should utilize HDD I/O fully.

    Maybe try ext4 instead of btrf? Ext4 should be faster than btrf.

    The actual performance loss on LXC compared to KVM is about 10 to 15%.

    Thanked by 1raza19
  • raza19raza19 Veteran
    edited December 2022

    @Shakib said:
    It might be related to SWAP.

    Small LXC won't be able to utilize full speed of a NVMe drive but should utilize HDD I/O fully.

    Maybe try ext4 instead of btrf? Ext4 should be faster than btrf.

    The actual performance loss on LXC compared to KVM is about 10 to 15%.

    I am actually running the lxc inside a kvm :) could that be a cause? from the performance inside kvm to the performance inside lxc within kvm there is a 20% performance hit on the disk. Also, the only options i see in lxd are Dir, lvm, btrfs, ceph.

  • This typically isn't anything to do with lxc but with btrfs. You need to find the bottleneck.
    Look at what file is being accessed to cause the I/O or whether it is a btrfs process (like cleaner). Disabling btrfs CoW sometimes helps. Disabling compression might/might not help. I do not put write-heavy databases on btrfs. I put them on an ext4 partition and bind-mount it into lxc, since backup of that should be done at application layer anyway.

    Thanked by 2raza19 bdl
  • PulsedMediaPulsedMedia Member, Patron Provider

    This topic is what we ultimately spend the most effort in ... It's always changing goal how to drive the most I/O performance out of the system, and what is the relation (%) to raw performance to end user performance.

    The full stack needs to be considered. It also wildly depends on the usage pattern

    Then again, we don't run LXC nor Btrfs ... No idea how that compares, we've so far never considered Btrfs to be production ready so can't say anything about it sorry 🤷🤷

    Thanked by 1raza19
  • rm_rm_ IPv6 Advocate, Veteran

    @raza19 said: Also, the only options i see in lxd are Dir, lvm, btrfs, ceph.

    Btrfs is not the fastest filesystem by far. However it has many useful features to make up for that. If your main concern is speed, try the first two options instead. But I believe with "Dir" there won't be any snapshot support.

    Thanked by 3raza19 bdl AK_KWH
  • @rm_ said:

    @raza19 said: Also, the only options i see in lxd are Dir, lvm, btrfs, ceph.

    Btrfs is not the fastest filesystem by far. However it has many useful features to make up for that. If your main concern is speed, try the first two options instead. But I believe with "Dir" there won't be any snapshot support.

    Thank u thank u :) I tried lvm & believe me the lxc container is showing even marginally better disk stats than the host :D I don't know how this is even possible but I am deploying it.

  • Drop hdd entirely. Insert 1024 GiB of DDR4 ram and operate from it. Never reboot. YOLO box.

  • NeoonNeoon Community Contributor, Veteran

    @rm_ said:

    @raza19 said: Also, the only options i see in lxd are Dir, lvm, btrfs, ceph.

    Btrfs is not the fastest filesystem by far. However it has many useful features to make up for that. If your main concern is speed, try the first two options instead. But I believe with "Dir" there won't be any snapshot support.

    dir is the last resort, pretty sure someone benchmark them somewhere too.

Sign In or Register to comment.