1 |
On 21/03/2017 22:16, Kai Krakow wrote: |
2 |
> Test one by one... Either disable all, then enable one by one, or |
3 |
> vice-versa. |
4 |
> |
5 |
> Chances are that your FS may be blocking on sync. Do you maybe have a |
6 |
> very high value in /proc/sys/vm/dirty_background_{ratio,bytes}? |
7 |
> |
8 |
> If ratio is 0, then bytes is used. Ratio is a percent of your physical |
9 |
> RAM. With the default kernel value in modern systems, this is |
10 |
> ridiculously high for desktop systems. Maybe put a fixed value, like |
11 |
> 128MB. The dirty background value is the amount of outstanding writes |
12 |
> before a foreground process blocks on further writes. If this value is |
13 |
> high, a sync may cause processes to freeze for a long time. Setting |
14 |
> this to a lower value forces single processes to block early and give |
15 |
> the kernel a chance to write back dirty data. |
16 |
> |
17 |
> The next value to check is dirty_{ratio,bytes}. That is the combined |
18 |
> maximum of outstanding data before the cache must be flushed. If this |
19 |
> is hit, all writing processes freeze. So, having the background value |
20 |
> high gives a greater chance of hitting this early. |
21 |
> |
22 |
> The default values are 10% and 20% (ratio). I've made the 20% ratio |
23 |
> into 10% and put 128MB for background which works quite well: |
24 |
> Foreground processes are blocked for shorter times (because writing |
25 |
> 128MB can be a few seconds or less, where 1.6GB can be minutes in a |
26 |
> worse case, so if overall limit is hit, I'm screwed). The overall |
27 |
> dirty buffer is still big enough to let the system buffer writes of |
28 |
> multiple processes. My system has 16GB RAM, you may want to adjust it |
29 |
> or try different values. |
30 |
> |
31 |
> $ cat /etc/sysctl.d/98-caching.conf |
32 |
> vm.dirty_background_bytes = 134217728 |
33 |
> vm.dirty_ratio = 10 |
34 |
> |
35 |
> Maybe point your Firefox cache to a tmpfs. If you're using tmpfs, don't |
36 |
> put swappiness to low, otherwise data sitting in tmpfs cannot be |
37 |
> swapped out and will cause filesystem caches to be discarded to early. |
38 |
> I'm working with a 32GB tmpfs and standard swappiness for emerge, and I |
39 |
> see no problems although multiple gigabytes of emerge build data may be |
40 |
> swapped out. Still, emerge is so much faster now. But then, my swaps |
41 |
> are on different disks (and I have multiple for getting some RAID-like |
42 |
> striping of swap space). |
43 |
> |
44 |
> Also, depending on which FS you're using, trying deadline instead of |
45 |
> CFQ may greatly improve your desktop experience (browsers should |
46 |
> benefit most from this). |
47 |
|
48 |
|
49 |
You may be onto something here: |
50 |
|
51 |
This is an 8-core i7 latop, 16G RAM |
52 |
|
53 |
$ sudo cat /proc/sys/vm/dirty_background_bytes |
54 |
0 |
55 |
$ sudo cat /proc/sys/vm/dirty_background_ratio |
56 |
5 |
57 |
$ sudo cat /proc/sys/vm/dirty_bytes |
58 |
0 |
59 |
$ sudo cat /proc/sys/vm/dirty_ratio |
60 |
10 |
61 |
|
62 |
browser cache is on a regular laptop spinning-rust 500G disk |
63 |
|
64 |
IO scheduler is BFQ, I use it for ages now. |
65 |
I did tests some years back and found it overall the best for an |
66 |
interactive desktop with a DE. I haven't repeated those tests since, has |
67 |
there been significant changes in this are last year or three? |
68 |
|
69 |
|
70 |
-- |
71 |
Alan McKinnon |
72 |
alan.mckinnon@×××××.com |