1 00:00:07,290 --> 00:00:09,330 - So you might be wondering. 2 00:00:09,330 --> 00:00:10,860 Dirty cache. 3 00:00:10,860 --> 00:00:12,720 Alright, well what are you going to do 4 00:00:12,720 --> 00:00:14,160 in a situation like that? 5 00:00:14,160 --> 00:00:18,843 Well, I would suggest cctl -a | grep dirty. 6 00:00:20,280 --> 00:00:21,660 And look at that. 7 00:00:21,660 --> 00:00:25,530 There we have all the dirty parameters. 8 00:00:25,530 --> 00:00:27,180 These dirty parameters have to deal 9 00:00:27,180 --> 00:00:28,080 with dirty cache. 10 00:00:28,080 --> 00:00:30,750 And dirty cache is an area of memory 11 00:00:30,750 --> 00:00:32,400 where modified blocks are stored 12 00:00:32,400 --> 00:00:34,410 before they are committed to disk. 13 00:00:34,410 --> 00:00:35,940 That's all pretty technical, 14 00:00:35,940 --> 00:00:39,450 but what we need is dirty writeback centisecs. 15 00:00:39,450 --> 00:00:43,230 And we need that to be set to 60 seconds. 16 00:00:43,230 --> 00:00:45,240 But hang on, what's a cenitsec? 17 00:00:45,240 --> 00:00:48,240 Well that's a 100th of a second. 18 00:00:48,240 --> 00:00:51,570 So if we need it to write every 60 seconds, 19 00:00:51,570 --> 00:00:56,570 then the writeback centisecs would be written to 6,000. 20 00:00:57,150 --> 00:00:58,110 How do we do that? 21 00:00:58,110 --> 00:01:03,110 Well simple, echo 6,000 > /proc/sys/vm/dirty 22 00:01:09,690 --> 00:01:11,163 writeback centisecs. 23 00:01:12,420 --> 00:01:14,913 And now we can verify that. 24 00:01:16,980 --> 00:01:18,480 And in order to verify, 25 00:01:18,480 --> 00:01:22,800 let's just do a cat on this fella. 26 00:01:22,800 --> 00:01:24,480 And there we can see that indeed it is set 27 00:01:24,480 --> 00:01:26,640 to 6,000 right now. 28 00:01:26,640 --> 00:01:28,260 So, so far so good. 29 00:01:28,260 --> 00:01:30,360 How are we going to make it persistent? 30 00:01:30,360 --> 00:01:33,390 Well, we are going to make that persistent 31 00:01:33,390 --> 00:01:36,333 by using echo dirty. 32 00:01:38,010 --> 00:01:42,467 Oops, almost wrong echo vm.dirty_writeback_centisecs 33 00:01:49,016 --> 00:01:53,697 is 6,000 > /etc/sysctl.d/dirty.conf. 34 00:02:00,630 --> 00:02:03,540 So vm.dirty writeback centisecs, 35 00:02:03,540 --> 00:02:04,860 what's the logic behind it? 36 00:02:04,860 --> 00:02:06,720 Well, vm, that's the directory 37 00:02:06,720 --> 00:02:08,957 and dirty writeback centisecs, 38 00:02:08,957 --> 00:02:12,330 that's a parameter that we want to set. 39 00:02:12,330 --> 00:02:16,800 So 6,000 and we write it to etc sysctl.d. 40 00:02:16,800 --> 00:02:18,900 Whatever dirty.conf. 41 00:02:18,900 --> 00:02:20,820 The name of that file is not very important. 42 00:02:20,820 --> 00:02:24,393 The only requirement is that it should be ending in .conf. 43 00:02:25,470 --> 00:02:29,250 And right, that is making sure this is working. 44 00:02:29,250 --> 00:02:32,760 But there is just one thing that we need to configure. 45 00:02:32,760 --> 00:02:35,427 We have now configured the kernel 46 00:02:35,427 --> 00:02:39,900 to start a threat every 60 seconds 47 00:02:39,900 --> 00:02:42,750 that will commit dirty cache. 48 00:02:42,750 --> 00:02:46,380 But there is also the dirty expired centisecs 49 00:02:46,380 --> 00:02:47,970 and that is set to a smaller value. 50 00:02:47,970 --> 00:02:50,520 And that effectively is not going to work. 51 00:02:50,520 --> 00:02:54,926 So if you want to set the dirty writeback centisecs 52 00:02:54,926 --> 00:02:59,926 to 6,000, then dirty expired centisecs should least be 6,001 53 00:03:01,740 --> 00:03:03,810 because otherwise you would have the problem 54 00:03:03,810 --> 00:03:07,500 that your dirty caches expired after 30 seconds. 55 00:03:07,500 --> 00:03:09,930 But the dirty writeback centisecs demon 56 00:03:09,930 --> 00:03:12,540 only comes around every 60 seconds. 57 00:03:12,540 --> 00:03:15,930 That doesn't work because then we would have expired cache 58 00:03:15,930 --> 00:03:17,070 for 30 seconds. 59 00:03:17,070 --> 00:03:19,800 And that's why this value needs to be bigger as well. 60 00:03:19,800 --> 00:03:21,810 So let's take care of that also. 61 00:03:21,810 --> 00:03:26,080 Echo vm.dirty expire centisecs is 9,000. 62 00:03:35,880 --> 00:03:39,900 Double redirect to append and not to overwrite, 63 00:03:39,900 --> 00:03:44,900 to etc/sysctl.d/dirty.conf. 64 00:03:45,330 --> 00:03:50,330 And now we check etc/sysctl.d/dirty.conf. 65 00:03:55,680 --> 00:03:57,270 Which has the parameters. 66 00:03:57,270 --> 00:04:02,270 And we can use sysctl -p, on etc/sysctl.d/dirty.conf. 67 00:04:05,910 --> 00:04:08,340 And that's going to make them effective immediately. 68 00:04:08,340 --> 00:04:09,173 And that's all.