I need to remove millions of directories recursively on a NFS share and to avoid any performance issues, I ran the command with:
ionice -c 3 -t find /dir -type f -exec rm {};
which will delete all the files and the leftover empty directories, I can remove with rm -rf.
But I am unable to say if ionice has any effect on the above command.
From man, ionice class 3:
A program running with idle io priority will only get disk time when no other program has asked for disk io for a defined grace period. The impact of idle io processes on normal system activity should be zero.
From source code, I see that ionice sets ioprio_set
.
So, what is ioprio_set?
The ioprio_get() and ioprio_set() system calls respectively get and set the I/O scheduling class and priority of one or more threads.
Does it mean that the process thread carries additional properties for I/O scheduler to use them to schedule the I/O for the process?
It begs me the following questions:
- Does I/O scheduler in general knows I/O load on a disk or it just schedules I/O to disk?
- If it's the case i.e. I/O scheduler knows about load on a disk and takes decisions based on that, I think the IO scheduling classes and priorities will not have any effect on IO scheduling to a remote disk. Thus ionice can not have any effect.
- And if it's not, I think the IO scheduling classes and prioities can have effect on IO scheduling to a remote disk also like NFS. Thus ionice will work if multiple users/processes are using the same NFS disk, where the I/O scheduler schedules IO for a given thread based on if other user/procesess are using the same NFS disk.
Please correct me if I am utterly wrong.
There can be a way to perform the operation from server end also, but I want to first try from the client end.