Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Force no more than one write/sync to disk in X seconds

I'm worried that I see through the disk LED and iotop quite some write activity every couple of seconds, mostly coming from the chromium's processes, on a completely idle system.

It doesn't make any sense at all to have such a high number of writes to disk, even less with SSD disks. The reads isn't a problem for me, also because I have plenty of disk cache on my 20gb RAM notebook.

The commit option (which is by default 30s) obviously isn't the solution. Tried to increase or even decrease and still see one write every couple of seconds.

So is there a way to force not more than one write per arbitrary interval?

like image 404
brauliobo Avatar asked Dec 28 '16 14:12

brauliobo


1 Answers

At first check your linux is using CFQ scheduler. then you can use ionice to control I/O scheduling class and priority of a program. It supports following three scheduling classes (quoting from the man page):

Idle : 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. This scheduling class does not take a priority argument. Best effort : This is the default scheduling class for any process that hasn't asked for a specific io priority. Programs inherit the CPU nice setting for io priorities. This class takes a priority argument from 0-7, with lower number being higher priority. Programs running at the same best effort priority are served in a round-robin fashion. This is usually recommended for most application. Real time : The RT scheduling class is given first access to the disk, regardless of what else is going on in the system. Thus the RT class needs to be used with some care, as it can starve other processes. As with the best effort class, 8 priority levels are defined denoting how big a time slice a given process will receive on each scheduling window. This is should be avoided for all heavily loaded system.

ionice options PID ionice options -p PID ionice -c1 -n0 PID

for limiting more than this i think you should use of your SAN utilities.

like image 134
mohsen.b Avatar answered Sep 23 '22 07:09

mohsen.b