1 |
On Tuesday, August 09, 2016 01:23:57 PM james wrote: |
2 |
> On 08/09/2016 09:17 AM, Michael Mol wrote: |
3 |
> > On Tuesday, August 09, 2016 09:13:31 AM james wrote: |
4 |
> >> On 08/09/2016 07:42 AM, Michael Mol wrote: |
5 |
> >> > On Monday, August 08, 2016 10:45:09 PM Alan McKinnon wrote: |
6 |
> >> >> On 08/08/2016 19:20, Michael Mol wrote: |
7 |
> >> >>> On Monday, August 08, 2016 06:52:15 PM Alan McKinnon wrote: |
8 |
> >> >>>> On 08/08/2016 17:02, Michael Mol wrote: |
9 |
|
10 |
> > I use Zabbix extensively at work, and have the Zabbix agent on my |
11 |
> > workstation reporting back various supported metrics. There's a great |
12 |
> > deal you can use (and--my favorite--abuse) Zabbix for, especially once |
13 |
> > you understand how it thinks. |
14 |
> |
15 |
> Congradualtions! Of the net-analyzer crowd, you've manage to find one I |
16 |
> have not spent time with........ |
17 |
|
18 |
Oh, man, are you in for a treat. I recently had a conversation with a guy I |
19 |
happened to sit next to while traveling about how, were I in his position, I'd |
20 |
improve his cash crop and hydroponics operations (he periodically tests soil |
21 |
and sunlight properties) continually using a combination of cheap, custom |
22 |
probes and SBCs, feeding the data into Zabbix for monitoring and trend |
23 |
analysis / prediction. Zabbix will do time-series graphing and analysis of |
24 |
arbitrary input data; it may have been designed for watching interface |
25 |
counters, but there's no reason it need be limited to that... |
26 |
|
27 |
> |
28 |
> >> Any specific kernel tweaks? |
29 |
> > |
30 |
> > Most of my tweaks for KDE revolved around tuning mysqld itself. But for |
31 |
> > sysctls improving workstation responsiveness as it relates to memory |
32 |
> > interactions with I/O, these are my go-tos: |
33 |
> > |
34 |
> > |
35 |
> > |
36 |
> > vm.dirty_background_bytes = 1048576 |
37 |
> > vm.dirty_bytes = 10485760 |
38 |
> > vm.swappiness = 0 |
39 |
> |
40 |
> Mine are:: |
41 |
> cat dirty_bytes |
42 |
> 0 |
43 |
> cat dirty_background_bytes |
44 |
> 0 |
45 |
|
46 |
So, that means you have vm.dirty_bytes_ratio and vm.dirty_background_ratio |
47 |
set, instead. I forget what those default to, but I think |
48 |
dirty_bacgkround_ratio defaults to something like 10, which means *10%* of |
49 |
your memory may get used for buffering disk I/O before it starts writing data |
50 |
to disk. dirty_bytes_ratio will necessarily be higher, which means that if |
51 |
you're performing seriously write-intensive activities on a system with 32GiB |
52 |
of RAM, you may find yourself with a system that will halt until it finishes |
53 |
flushing 3+GiB of data to disk. |
54 |
|
55 |
> cat swappiness |
56 |
> 60 |
57 |
|
58 |
Yeah, you want that set to lower than that. |
59 |
|
60 |
> |
61 |
> > vm.dirty_background_bytes ensures that any data (i.e. from mmap or |
62 |
> > fwrite, not from swapping) waiting to be written to disk *starts* |
63 |
> > getting written to disk once you've got at least the configured amount |
64 |
> > (1MB) of data waiting. (If you've got a disk controller with |
65 |
> > battery-backed or flash-backed write cache, you might consider |
66 |
> > increasing this to some significant fraction of your write cache. I.e. |
67 |
> > if you've got a 1GB FBWC with 768MB of that dedicated to write cache, |
68 |
> > you might set this to 512MB or so. Depending on your workload. I/O |
69 |
> > tuning is for those of us who enjoy the dark arts.) |
70 |
> > |
71 |
> > |
72 |
> > |
73 |
> > vm.dirty_bytes says that once you've got the configured amount (10MB) of |
74 |
> > data waiting to be disk, then no more asynchronous I/O is permitted |
75 |
> > until you have no more data waiting; all outstanding writes must be |
76 |
> > finished first. (My rule of thumb is to have this between 2-10 times the |
77 |
> > value of vm.dirty_background_bytes. Though I'm really trying to avoid it |
78 |
> > being high enough that it could take more than 50ms to transfer to disk; |
79 |
> > that way, any stalls that do happen are almost imperceptible.) |
80 |
> > |
81 |
> > |
82 |
> > |
83 |
> > You want vm.dirty_background_bytes to be high enough that your hardware |
84 |
> > doesn't spend its time powered on if it doesn't have to be, and so that |
85 |
> > your hardware can transfer data in large, efficient, streamable chunks. |
86 |
> > |
87 |
> > |
88 |
> > |
89 |
> > You want vm.dirty_bytes enough higher than your first number so that |
90 |
> > your hardware has enough time to spin up and transfer data before you |
91 |
> > put the hammer down and say, "all right, nobody else gets to queue |
92 |
> > writes until all the waiting data has reached disk." |
93 |
> > |
94 |
> > |
95 |
> > |
96 |
> > You want vm.dirty_bytes *low* enough that when you *do* have to put that |
97 |
> > hammer down, it doesn't interfere with your perceptions of a responsive |
98 |
> > system. (And in a server context, you want it low enough that things |
99 |
> > can't time out--or be pushed into timing out--waiting for it. Call your |
100 |
> > user attention a matter of timing out expecting things to respond to |
101 |
> > you, and the same principle applies...) |
102 |
> > |
103 |
> > |
104 |
> > |
105 |
> > Now, vm.swappiness? That's a weighting factor for how quickly the kernel |
106 |
> > should try moving memory to swap to be able to speedily respond to new |
107 |
> > allocations. Me, I prefer the kernel to not preemptively move |
108 |
> > lesser-used data to swap, because that's going to be a few hundred |
109 |
> > megabytes worth of data all associated with one application, and it'll |
110 |
> > be a real drag when I switch back to the application I haven't used for |
111 |
> > half an hour. So I set vm.swappiness to 0, to tell the kernel to only |
112 |
> > move data to swap if it has no other alternative while trying to satisfy |
113 |
> > a new memory allocation request. |
114 |
> |
115 |
> OK, OK, OK. I need to read a bit about these. Any references or docs or |
116 |
> is the result of parsing out what is the least painful for a |
117 |
> workstation? I do not run any heavy databases on my workstation; they |
118 |
> are only there to hack on them. I test db centric stuff on domain |
119 |
> servers, sometimes with limited resources. I run lxde and I'm moving to |
120 |
> lxqt for workstations and humanoid (terminal) IO. |
121 |
|
122 |
https://www.kernel.org/doc/Documentation/sysctl/vm.txt |
123 |
https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/ |
124 |
|
125 |
> |
126 |
> |
127 |
> Do you set these differently for servers? |
128 |
|
129 |
On my servers, I keep these values similar, because I'd rather have a little |
130 |
bit lower throughput than risk a catastrophic cascade failure stemming from an |
131 |
I/O stall. |
132 |
|
133 |
> |
134 |
> Nodes in a cluster? |
135 |
|
136 |
Same story. |
137 |
|
138 |
The exception is my storage cluster, which has dirty_bytes much higher, as |
139 |
it's very solidly battery backed, so I can use its oodles of memory as a write |
140 |
cache, giving its kernel time to reorder writes and flush data to disk |
141 |
efficiently, and letting clients very rapidly return from write requests. |
142 |
|
143 |
> |
144 |
> I use OpenRC, just so you know. I also have a motherboard with IOMMU |
145 |
> that is currently has questionable settings in the kernel config file. I |
146 |
> cannot find consensus if/how IOMMU that affects IO with the Sata HD |
147 |
> devices versus mm mapped peripherals.... in the context of 4.x kernel |
148 |
> options. I'm trying very hard here to avoid a deep dive on these issues, |
149 |
> so trendy strategies are most welcome, as workstation and cluster node |
150 |
> optimizations are all I'm really working on atm. |
151 |
|
152 |
Honestly, I'd suggest you deep dive. An image once, with clarity, will last |
153 |
you a lot longer than ongoing fuzzy and trendy images from people whose |
154 |
hardware and workflow is likely to be different from yours. |
155 |
|
156 |
The settings I provided should be absolutely fine for most use cases. Only |
157 |
exception would be mobile devices with spinning rust, but those are getting |
158 |
rarer and rarer... |
159 |
|
160 |
-- |
161 |
:wq |