Re: [PATCH v12] ovl: improve syncfs efficiency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Vivek Goyal <vgoyal@xxxxxxxxxx> writes:

> On Fri, May 22, 2020 at 11:31:41AM +0200, Miklos Szeredi wrote:
>> On Wed, May 20, 2020 at 9:24 AM Amir Goldstein <amir73il@xxxxxxxxx> wrote:
>> >
>> > On Wed, May 20, 2020 at 4:02 AM cgxu <cgxu519@xxxxxxxxxxxx> wrote:
>> > >
>> > > On 5/6/20 5:53 PM, Chengguang Xu wrote:
>> > > > Current syncfs(2) syscall on overlayfs just calls sync_filesystem()
>> > > > on upper_sb to synchronize whole dirty inodes in upper filesystem
>> > > > regardless of the overlay ownership of the inode. In the use case of
>> > > > container, when multiple containers using the same underlying upper
>> > > > filesystem, it has some shortcomings as below.
>> > > >
>> > > > (1) Performance
>> > > > Synchronization is probably heavy because it actually syncs unnecessary
>> > > > inodes for target overlayfs.
>> > > >
>> > > > (2) Interference
>> > > > Unplanned synchronization will probably impact IO performance of
>> > > > unrelated container processes on the other overlayfs.
>> > > >
>> > > > This patch tries to only sync target dirty upper inodes which are belong
>> > > > to specific overlayfs instance and wait for completion. By doing this,
>> > > > it is able to reduce cost of synchronization and will not seriously impact
>> > > > IO performance of unrelated processes.
>> > > >
>> > > > Signed-off-by: Chengguang Xu <cgxu519@xxxxxxxxxxxx>
>> > >
>> > > Except explicit sycnfs is triggered by user process, there is also implicit
>> > > syncfs during umount process of overlayfs instance. Every syncfs will
>> > > deliver to upper fs and whole dirty data of upper fs syncs to persistent
>> > > device at same time.
>> > >
>> > > In high density container environment, especially for temporary jobs,
>> > > this is quite unwilling  behavior. Should we provide an option to
>> > > mitigate this effect for containers which don't care about dirty data?
>> 
>> If containers don't care about dirty data, why go to great lengths to
>> make sure that syncfs() works?  Can't we just have an option to turn
>> off syncing completely, for fsync, for syncfs, for shutdown, for
>> everything?  That would be orders of magnitude simpler than the patch
>> you posted.
>
> We definitely have this use case where certain class of contaienrs
> don't want to actually sync data back to disk. It slows them down
> significantly. For example, containers used for building images
> and they use "dnf" which issues bunch of sync and hence slowing
> down build process.
>
> These build containers don't care about system crashes. They will
> restart the build process if such an event were to happen.
>
> They are not in a position to modify "dnf" and other applications
> to not issue sync. So they will like to have a mount option say
> "nosync" where sync will be ignored by filesystem instance. This
> expedites their build process. Copying Dan Walsh and Gisueppe who
> were looking for such an option.

yes, it is definitely something we are looking into.  For fuse-overlayfs
(a FUSE implementation of overlay used for unprivileged containers), we
already expose an option to disable sync and we use it for build
containers.

For root containers, we are currently looking at other solutions like a
custom seccomp profile, but the mount flag would be a better solution.

Regards,
Giuseppe




[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux