- So you might be wondering.
Dirty cache.
Alright, well what are you going to do
in a situation like that?
Well, I would suggest cctl -a | grep dirty.
And look at that.
There we have all the dirty parameters.
These dirty parameters have to deal
with dirty cache.
And dirty cache is an area of memory
where modified blocks are stored
before they are committed to disk.
That's all pretty technical,
but what we need is dirty writeback centisecs.
And we need that to be set to 60 seconds.
But hang on, what's a cenitsec?
Well that's a 100th of a second.
So if we need it to write every 60 seconds,
then the writeback centisecs would be written to 6,000.
How do we do that?
Well simple, echo 6,000 > /proc/sys/vm/dirty
writeback centisecs.
And now we can verify that.
And in order to verify,
let's just do a cat on this fella.
And there we can see that indeed it is set
to 6,000 right now.
So, so far so good.
How are we going to make it persistent?
Well, we are going to make that persistent
by using echo dirty.
Oops, almost wrong echo vm.dirty_writeback_centisecs
is 6,000 > /etc/sysctl.d/dirty.conf.
So vm.dirty writeback centisecs,
what's the logic behind it?
Well, vm, that's the directory
and dirty writeback centisecs,
that's a parameter that we want to set.
So 6,000 and we write it to etc sysctl.d.
Whatever dirty.conf.
The name of that file is not very important.
The only requirement is that it should be ending in .conf.
And right, that is making sure this is working.
But there is just one thing that we need to configure.
We have now configured the kernel
to start a threat every 60 seconds
that will commit dirty cache.
But there is also the dirty expired centisecs
and that is set to a smaller value.
And that effectively is not going to work.
So if you want to set the dirty writeback centisecs
to 6,000, then dirty expired centisecs should least be 6,001
because otherwise you would have the problem
that your dirty caches expired after 30 seconds.
But the dirty writeback centisecs demon
only comes around every 60 seconds.
That doesn't work because then we would have expired cache
for 30 seconds.
And that's why this value needs to be bigger as well.
So let's take care of that also.
Echo vm.dirty expire centisecs is 9,000.
Double redirect to append and not to overwrite,
to etc/sysctl.d/dirty.conf.
And now we check etc/sysctl.d/dirty.conf.
Which has the parameters.
And we can use sysctl -p, on etc/sysctl.d/dirty.conf.
And that's going to make them effective immediately.
And that's all.