Whamcloud - gitweb
FIX: added index.
[doc/manual.git] / LustreProc.xml
1 <?xml version='1.0' encoding='UTF-8'?>
2 <!-- This document was created with Syntext Serna Free. --><chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US" xml:id="lustreproc">
3   <title xml:id="lustreproc.title">LustreProc</title>
4   <para>The <literal>/proc</literal> file system acts as an interface to internal data structures in the kernel. The <literal>/proc</literal> variables can be used to control aspects of Lustre performance and provide information.</para>
5   <para>This chapter describes Lustre /proc entries and includes the following sections:</para>
6   <itemizedlist>
7     <listitem>
8       <para><xref linkend="dbdoclet.50438271_90999"/></para>
9     </listitem>
10     <listitem>
11       <para><xref linkend="dbdoclet.50438271_78950"/></para>
12     </listitem>
13     <listitem>
14       <para><xref linkend="dbdoclet.50438271_83523"/></para>
15     </listitem>
16   </itemizedlist>
17   <section xml:id="dbdoclet.50438271_90999">
18     <title><indexterm><primary>proc</primary></indexterm>Proc Entries for Lustre</title>
19     <para>This section describes <literal>/proc</literal> entries for Lustre.</para>
20     <section remap="h3">
21       <title>Locating Lustre File Systems and Servers</title>
22       <para>Use the proc files on the MGS to locate the following:</para>
23       <itemizedlist>
24         <listitem>
25           <para> All known file systems</para>
26           <screen># cat /proc/fs/lustre/mgs/MGS/filesystems
27 spfs
28 lustre</screen>
29         </listitem>
30       </itemizedlist>
31       <itemizedlist>
32         <listitem>
33           <para> The server names participating in a file system (for each file system that has at least one server running)</para>
34           <screen># cat /proc/fs/lustre/mgs/MGS/live/spfs
35 fsname: spfs
36 flags: 0x0         gen: 7
37 spfs-MDT0000
38 spfs-OST0000</screen>
39         </listitem>
40       </itemizedlist>
41       <para>All servers are named according to this convention: <literal>&lt;fsname&gt;-&lt;MDT|OST&gt;&lt;XXXX&gt;</literal>. This can be shown for live servers under <literal>/proc/fs/lustre/devices</literal>:</para>
42       <screen># cat /proc/fs/lustre/devices 
43 0 UP mgs MGS MGS 11
44 1 UP mgc MGC192.168.10.34@tcp 1f45bb57-d9be-2ddb-c0b0-5431a49226705
45 2 UP mdt MDS MDS_uuid 3
46 3 UP lov lustre-mdtlov lustre-mdtlov_UUID 4
47 4 UP mds lustre-MDT0000 lustre-MDT0000_UUID 7
48 5 UP osc lustre-OST0000-osc lustre-mdtlov_UUID 5
49 6 UP osc lustre-OST0001-osc lustre-mdtlov_UUID 5
50 7 UP lov lustre-clilov-ce63ca00 08ac6584-6c4a-3536-2c6d-b36cf9cbdaa04
51 8 UP mdc lustre-MDT0000-mdc-ce63ca00 08ac6584-6c4a-3536-2c6d-b36cf9cbdaa05
52 9 UP osc lustre-OST0000-osc-ce63ca00 08ac6584-6c4a-3536-2c6d-b36cf9cbdaa05
53 10 UP osc lustre-OST0001-osc-ce63ca00 08ac6584-6c4a-3536-2c6d-b36cf9cbdaa05</screen>
54       <para>Or from the device label at any time:</para>
55       <screen># e2label /dev/sda
56 lustre-MDT0000</screen>
57     </section>
58     <section remap="h3">
59       <title><indexterm><primary>proc</primary><secondary>timeouts</secondary></indexterm>Lustre Timeouts</title>
60       <para>Lustre uses two types of timeouts.</para>
61       <itemizedlist>
62         <listitem>
63           <para>LND timeouts that ensure point-to-point communications complete in finite time in the presence of failures. These timeouts are logged with the <literal>S_LND</literal> flag set. They may <emphasis>not</emphasis> be printed as console messages, so you should check the Lustre log for <literal>D_NETERROR</literal> messages, or enable printing of <literal>D_NETERROR</literal> messages to the console (<literal>echo + neterror &gt; /proc/sys/lnet/printk</literal>).</para>
64         </listitem>
65       </itemizedlist>
66       <para>Congested routers can be a source of spurious LND timeouts. To avoid this, increase the number of LNET router buffers to reduce back-pressure and/or increase LND timeouts on all nodes on all connected networks. You should also consider increasing the total number of LNET router nodes in the system so that the aggregate router bandwidth matches the aggregate server bandwidth.</para>
67       <itemizedlist>
68         <listitem>
69           <para>Lustre timeouts that ensure Lustre RPCs complete in finite time in the presence of failures. These timeouts should <emphasis>always</emphasis> be printed as console messages. If Lustre timeouts are not accompanied by LNET timeouts, then you need to increase the lustre timeout on both servers and clients.</para>
70         </listitem>
71       </itemizedlist>
72       <para>Specific Lustre timeouts are described below.</para>
73       <para><literal> /proc/sys/lustre/timeout </literal></para>
74       <para>This is the time period that a client waits for a server to complete an RPC (default is 100s). Servers wait half of this time for a normal client RPC to complete and a quarter of this time for a single bulk request (read or write of up to 1 MB) to complete. The client pings recoverable targets (MDS and OSTs) at one quarter of the timeout, and the server waits one and a half times the timeout before evicting a client for being &quot;stale.&quot;</para>
75       <note>
76         <para>Lustre sends periodic &apos;PING&apos; messages to servers with which it had no communication for a specified period of time. Any network activity on the file system that triggers network traffic toward servers also works as a health check.</para>
77       </note>
78       <para><literal> /proc/sys/lustre/ldlm_timeout </literal></para>
79       <para>This is the time period for which a server will wait for a client to reply to an initial AST (lock cancellation request) where default is 20s for an OST and 6s for an MDS. If the client replies to the AST, the server will give it a normal timeout (half of the client timeout) to flush any dirty data and release the lock.</para>
80       <para><literal> /proc/sys/lustre/fail_loc </literal></para>
81       <para>This is the internal debugging failure hook.</para>
82       <para>See <literal>lustre/include/linux/obd_support.h</literal> for the definitions of individual failure locations. The default value is 0 (zero).</para>
83       <screen>sysctl -w lustre.fail_loc=0x80000122 # drop a single reply</screen>
84       <para><literal> /proc/sys/lustre/dump_on_timeout </literal></para>
85       <para>This triggers dumps of the Lustre debug log when timeouts occur. The default value is 0 (zero).</para>
86       <para><literal> /proc/sys/lustre/dump_on_eviction </literal></para>
87       <para>This triggers dumps of the Lustre debug log when an eviction occurs. The default value is 0 (zero). By default, debug logs are dumped to the /tmp folder; this location can be changed via /proc.</para>
88     </section>
89     <section remap="h3">
90       <title><indexterm><primary>proc</primary><secondary>adaptive timeouts</secondary></indexterm>Adaptive Timeouts</title>
91       <para>Lustre offers an adaptive mechanism to set RPC timeouts. The adaptive timeouts feature (enabled, by default) causes servers to track actual RPC completion times, and to report estimated completion times for future RPCs back to clients. The clients use these estimates to set their future RPC timeout values. If server request processing slows down for any reason, the RPC completion estimates increase, and the clients allow more time for RPC completion.</para>
92       <para>If RPCs queued on the server approach their timeouts, then the server sends an early reply to the client, telling the client to allow more time. In this manner, clients avoid RPC timeouts and disconnect/reconnect cycles. Conversely, as a server speeds up, RPC timeout values decrease, allowing faster detection of non-responsive servers and faster attempts to reconnect to a server&apos;s failover partner.</para>
93       <para>In previous Lustre versions, the static obd_timeout (<literal>/proc/sys/lustre/timeout</literal>) value was used as the maximum completion time for all RPCs; this value also affected the client-server ping interval and initial recovery timer. Now, with adaptive timeouts, obd_timeout is only used for the ping interval and initial recovery estimate. When a client reconnects during recovery, the server uses the client&apos;s timeout value to reset the recovery wait period; i.e., the server learns how long the client had been willing to wait, and takes this into account when adjusting the recovery period.</para>
94       <section remap="h4">
95         <title><indexterm><primary>proc</primary><secondary>configuring adaptive timeouts</secondary></indexterm><indexterm><primary>configuring</primary><secondary>adaptive timeouts</secondary></indexterm>Configuring Adaptive Timeouts</title>
96         <para>One of the goals of adaptive timeouts is to relieve users from having to tune the <literal>obd_timeout</literal> value. In general, <literal>obd_timeout</literal> should no longer need to be changed. However, there are several parameters related to adaptive timeouts that users can set. In most situations, the default values should be used.</para>
97         <para>The following parameters can be set persistently system-wide using <literal>lctl conf_param</literal> on the MGS. For example, <literal>lctl conf_param work1.sys.at_max=1500</literal> sets the at_max value for all servers and clients using the work1 file system.</para>
98         <note>
99           <para>Nodes using multiple Lustre file systems must use the same <literal>at_*</literal> values for all file systems.)</para>
100         </note>
101         <informaltable frame="all">
102           <tgroup cols="2">
103             <colspec colname="c1" colwidth="50*"/>
104             <colspec colname="c2" colwidth="50*"/>
105             <thead>
106               <row>
107                 <entry>
108                   <para><emphasis role="bold">Parameter</emphasis></para>
109                 </entry>
110                 <entry>
111                   <para><emphasis role="bold">Description</emphasis></para>
112                 </entry>
113               </row>
114             </thead>
115             <tbody>
116               <row>
117                 <entry>
118                   <para> <literal> at_min </literal></para>
119                 </entry>
120                 <entry>
121                   <para>Sets the minimum adaptive timeout (in seconds). Default value is 0. The at_min parameter is the minimum processing time that a server will report. Clients base their timeouts on this value, but they do not use this value directly. If you experience cases in which, for unknown reasons, the adaptive timeout value is too short and clients time out their RPCs (usually due to temporary network outages), then you can increase the at_min value to compensate for this. Ideally, users should leave at_min set to its default.</para>
122                 </entry>
123               </row>
124               <row>
125                 <entry>
126                   <para> <literal> at_max </literal></para>
127                 </entry>
128                 <entry>
129                   <para>Sets the maximum adaptive timeout (in seconds). The <literal>at_max</literal> parameter is an upper-limit on the service time estimate, and is used as a &apos;failsafe&apos; in case of rogue/bad/buggy code that would lead to never-ending estimate increases. If at_max is reached, an RPC request is considered &apos;broken&apos; and should time out.</para>
130                   <para>Setting at_max to 0 causes adaptive timeouts to be disabled and the old fixed-timeout method (<literal>obd_timeout</literal>) to be used. This is the default value in Lustre 1.6.5.</para>
131                   <note>
132                     <para>It is possible that slow hardware might validly cause the service estimate to increase beyond the default value of at_max. In this case, you should increase at_max to the maximum time you are willing to wait for an RPC completion.</para>
133                   </note>
134                 </entry>
135               </row>
136               <row>
137                 <entry>
138                   <para> <literal> at_history </literal></para>
139                 </entry>
140                 <entry>
141                   <para>Sets a time period (in seconds) within which adaptive timeouts remember the slowest event that occurred. Default value is 600.</para>
142                 </entry>
143               </row>
144               <row>
145                 <entry>
146                   <para> <literal> at_early_margin </literal></para>
147                 </entry>
148                 <entry>
149                   <para>Sets how far before the deadline Lustre sends an early reply. Default value is 5<footnote>
150                       <para>This default was chosen as a reasonable time in which to send a reply from the point at which it was sent.</para>
151                     </footnote>.</para>
152                 </entry>
153               </row>
154               <row>
155                 <entry>
156                   <para> <literal> at_extra </literal></para>
157                 </entry>
158                 <entry>
159                   <para>Sets the incremental amount of time that a server asks for, with each early reply. The server does not know how much time the RPC will take, so it asks for a fixed value. Default value is 30<footnote>
160                       <para>This default was chosen as a balance between sending too many early replies for the same RPC and overestimating the actual completion time</para>
161                     </footnote>. When a server finds a queued request about to time out (and needs to send an early reply out), the server adds the at_extra value. If the time expires, the Lustre client enters recovery status and reconnects to restore it to normal status.</para>
162                   <para>If you see multiple early replies for the same RPC asking for multiple 30-second increases, change the at_extra value to a larger number to cut down on early replies sent and, therefore, network load.</para>
163                 </entry>
164               </row>
165               <row>
166                 <entry>
167                   <para> <literal> ldlm_enqueue_min </literal></para>
168                 </entry>
169                 <entry>
170                   <para> Sets the minimum lock enqueue time. Default value is 100. The <literal>ldlm_enqueue</literal> time is the maximum of the measured enqueue estimate (influenced by at_min and at_max parameters), multiplied by a weighting factor, and the <literal>ldlm_enqueue_min</literal> setting. LDLM lock enqueues were based on the <literal>obd_timeout</literal> value; now they have a dedicated minimum value. Lock enqueues increase as the measured enqueue times increase (similar to adaptive timeouts).</para>
171                 </entry>
172               </row>
173             </tbody>
174           </tgroup>
175         </informaltable>
176         <para>Adaptive timeouts are enabled, by default. To disable adaptive timeouts, at run time, set <literal>at_max</literal> to 0. On the MGS, run:</para>
177         <screen>$ lctl conf_param &lt;fsname&gt;.sys.at_max=0</screen>
178         <note>
179           <para>Changing adaptive timeouts status at runtime may cause transient timeout, reconnect, recovery, etc.</para>
180         </note>
181       </section>
182       <section remap="h4">
183         <title><indexterm><primary>proc</primary><secondary>interpreting adaptive timeouts</secondary></indexterm>Interpreting Adaptive Timeouts Information</title>
184         <para>Adaptive timeouts information can be read from <literal>/proc/fs/lustre/*/timeouts</literal> files (for each service and client) or with the lctl command.</para>
185         <para>This is an example from the <literal>/proc/fs/lustre/*/timeouts</literal> files:</para>
186         <screen>cfs21:~# cat /proc/fs/lustre/ost/OSS/ost_io/timeouts</screen>
187         <para>This is an example using the <literal>lctl</literal> command:</para>
188         <screen>$ lctl get_param -n ost.*.ost_io.timeouts</screen>
189         <para>This is the sample output:</para>
190         <screen>service : cur 33  worst 34 (at 1193427052, 0d0h26m40s ago) 1 1 33 2</screen>
191         <para>The <literal>ost_io</literal> service on this node is currently reporting an estimate of 33 seconds. The worst RPC service time was 34 seconds, and it happened 26 minutes ago.</para>
192         <para>The output also provides a history of service times. In the example, there are 4 &quot;bins&quot; of <literal>adaptive_timeout_history</literal>, with the maximum RPC time in each bin reported. In 0-150 seconds, the maximum RPC time was 1, with the same result in 150-300 seconds. From 300-450 seconds, the worst (maximum) RPC time was 33 seconds, and from 450-600s the worst time was 2 seconds. The current estimated service time is the maximum value of the 4 bins (33 seconds in this example).</para>
193         <para>Service times (as reported by the servers) are also tracked in the client OBDs:</para>
194         <screen>cfs21:# lctl get_param osc.*.timeouts
195 last reply : 1193428639, 0d0h00m00s ago
196 network    : cur   1  worst   2 (at 1193427053, 0d0h26m26s ago)   1   1   1   1
197 portal 6   : cur  33  worst  34 (at 1193427052, 0d0h26m27s ago)  33  33  33   2
198 portal 28  : cur   1  worst   1 (at 1193426141, 0d0h41m38s ago)   1   1   1   1
199 portal 7   : cur   1  worst   1 (at 1193426141, 0d0h41m38s ago)   1   0   1   1
200 portal 17  : cur   1  worst   1 (at 1193426177, 0d0h41m02s ago)   1   0   0   1
201 </screen>
202         <para>In this case, RPCs to portal 6, the <literal>OST_IO_PORTAL</literal> (see <literal>lustre/include/lustre/lustre_idl.h</literal>), shows the history of what the <literal>ost_io</literal> portal has reported as the service estimate.</para>
203         <para>Server statistic files also show the range of estimates in the normal min/max/sum/sumsq manner.</para>
204         <screen>cfs21:~# lctl get_param mdt.*.mdt.stats
205 ...
206 req_timeout               6 samples [sec] 1 10 15 105
207 ...
208 </screen>
209       </section>
210     </section>
211     <section remap="h3">
212       <title><indexterm><primary>proc</primary><secondary>LNET</secondary></indexterm><indexterm><primary>LNET</primary><secondary>proc</secondary></indexterm>LNET Information</title>
213       <para>This section describes<literal> /proc</literal> entries for LNET information.</para>
214       <para><literal> /proc/sys/lnet/peers </literal></para>
215       <para>Shows all NIDs known to this node and also gives information on the queue state.</para>
216       <screen># cat /proc/sys/lnet/peers
217 nid                        refs            state           max             rtr             min             tx              min             queue
218 0@lo                       1               ~rtr            0               0               0               0               0               0
219 192.168.10.35@tcp  1               ~rtr            8               8               8               8               6               0
220 192.168.10.36@tcp  1               ~rtr            8               8               8               8               6               0
221 192.168.10.37@tcp  1               ~rtr            8               8               8               8               6               0</screen>
222       <para>The fields are explained below:</para>
223       <informaltable frame="all">
224         <tgroup cols="2">
225           <colspec colname="c1" colwidth="50*"/>
226           <colspec colname="c2" colwidth="50*"/>
227           <thead>
228             <row>
229               <entry>
230                 <para><emphasis role="bold">Field</emphasis></para>
231               </entry>
232               <entry>
233                 <para><emphasis role="bold">Description</emphasis></para>
234               </entry>
235             </row>
236           </thead>
237           <tbody>
238             <row>
239               <entry>
240                 <para> 
241                         <literal>
242                     <replaceable>refs</replaceable>
243                   </literal>
244                   </para>
245               </entry>
246               <entry>
247                 <para>A reference count (principally used for debugging)</para>
248               </entry>
249             </row>
250             <row>
251               <entry>
252                 <para> 
253                         <literal>
254                     <replaceable>state</replaceable>
255                   </literal>
256                   </para>
257               </entry>
258               <entry>
259                 <para>Only valid to refer to routers. Possible values:</para>
260                 <itemizedlist>
261                   <listitem>
262                     <para>~ rtr (indicates this node is not a router)</para>
263                   </listitem>
264                   <listitem>
265                     <para>up/down (indicates this node is a router)</para>
266                   </listitem>
267                   <listitem>
268                     <para>auto_fail must be enabled</para>
269                   </listitem>
270                 </itemizedlist>
271               </entry>
272             </row>
273             <row>
274               <entry>
275                 <para> <literal> max </literal></para>
276               </entry>
277               <entry>
278                 <para>Maximum number of concurrent sends from this peer</para>
279               </entry>
280             </row>
281             <row>
282               <entry>
283                 <para> <literal> rtr </literal></para>
284               </entry>
285               <entry>
286                 <para>Routing buffer credits.</para>
287               </entry>
288             </row>
289             <row>
290               <entry>
291                 <para> <literal> min </literal></para>
292               </entry>
293               <entry>
294                 <para>Minimum routing buffer credits seen.</para>
295               </entry>
296             </row>
297             <row>
298               <entry>
299                 <para> <literal> tx </literal></para>
300               </entry>
301               <entry>
302                 <para>Send credits.</para>
303               </entry>
304             </row>
305             <row>
306               <entry>
307                 <para> <literal> min </literal></para>
308               </entry>
309               <entry>
310                 <para>Minimum send credits seen.</para>
311               </entry>
312             </row>
313             <row>
314               <entry>
315                 <para> <literal> queue </literal></para>
316               </entry>
317               <entry>
318                 <para>Total bytes in active/queued sends.</para>
319               </entry>
320             </row>
321           </tbody>
322         </tgroup>
323       </informaltable>
324       <para>Credits work like a semaphore. At start they are initialized to allow a certain number of operations (8 in this example). LNET keeps a track of the minimum value so that you can see how congested a resource was.</para>
325       <para>If <literal>rtr/tx</literal> is less than max, there are operations in progress. The number of operations is equal to <literal>rtr</literal> or <literal>tx</literal> subtracted from max.</para>
326       <para>If <literal>rtr/tx</literal> is greater that max, there are operations blocking.</para>
327       <para>LNET also limits concurrent sends and router buffers allocated to a single peer so that no peer can occupy all these resources.</para>
328       <para><literal> /proc/sys/lnet/nis </literal></para>
329       <screen># cat /proc/sys/lnet/nis
330 nid                                refs            peer            max             tx              min
331 0@lo                               3               0               0               0               0
332 192.168.10.34@tcp          4               8               256             256             252
333 </screen>
334       <para>Shows the current queue health on this node. The fields are explained below:</para>
335       <informaltable frame="all">
336         <tgroup cols="2">
337           <colspec colname="c1" colwidth="50*"/>
338           <colspec colname="c2" colwidth="50*"/>
339           <thead>
340             <row>
341               <entry>
342                 <para><emphasis role="bold">Field</emphasis></para>
343               </entry>
344               <entry>
345                 <para><emphasis role="bold">Description</emphasis></para>
346               </entry>
347             </row>
348           </thead>
349           <tbody>
350             <row>
351               <entry>
352                 <para> <literal> nid </literal></para>
353               </entry>
354               <entry>
355                 <para>Network interface</para>
356               </entry>
357             </row>
358             <row>
359               <entry>
360                 <para> <literal> refs </literal></para>
361               </entry>
362               <entry>
363                 <para>Internal reference counter</para>
364               </entry>
365             </row>
366             <row>
367               <entry>
368                 <para> <literal> peer </literal></para>
369               </entry>
370               <entry>
371                 <para>Number of peer-to-peer send credits on this NID. Credits are used to size buffer pools</para>
372               </entry>
373             </row>
374             <row>
375               <entry>
376                 <para> <literal> max </literal></para>
377               </entry>
378               <entry>
379                 <para>Total number of send credits on this NID.</para>
380               </entry>
381             </row>
382             <row>
383               <entry>
384                 <para> <literal> tx </literal></para>
385               </entry>
386               <entry>
387                 <para>Current number of send credits available on this NID.</para>
388               </entry>
389             </row>
390             <row>
391               <entry>
392                 <para> <literal> min </literal></para>
393               </entry>
394               <entry>
395                 <para>Lowest number of send credits available on this NID.</para>
396               </entry>
397             </row>
398             <row>
399               <entry>
400                 <para> <literal> queue </literal></para>
401               </entry>
402               <entry>
403                 <para>Total bytes in active/queued sends.</para>
404               </entry>
405             </row>
406           </tbody>
407         </tgroup>
408       </informaltable>
409       <para>Subtracting <literal>max</literal> - <literal>tx</literal> yields the number of sends currently active. A large or increasing number of active sends may indicate a problem.</para>
410       <screen># cat /proc/sys/lnet/nis
411 nid                                refs            peer            max             tx              min
412 0@lo                               2               0               0               0               0
413 10.67.73.173@tcp           4               8               256             256             253
414 </screen>
415     </section>
416     <section remap="h3">
417       <title><indexterm><primary>proc</primary><secondary>free space</secondary></indexterm>Free Space Distribution</title>
418       <para>Free-space stripe weighting, as set, gives a priority of &quot;0&quot; to free space (versus trying to place the stripes &quot;widely&quot; -- nicely distributed across OSSs and OSTs to maximize network balancing). To adjust this priority (as a percentage), use the <literal>qos_prio_free</literal> proc tunable:</para>
419       <screen>$ cat /proc/fs/lustre/lov/&lt;fsname&gt;-mdtlov/qos_prio_free</screen>
420       <para>Currently, the default is 90%. You can permanently set this value by running this command on the MGS:</para>
421       <screen>$ lctl conf_param &lt;fsname&gt;-MDT0000.lov.qos_prio_free=90</screen>
422       <para>Setting the priority to 100% means that OSS distribution does not count in the weighting, but the stripe assignment is still done via weighting. If OST 2 has twice as much free space as OST 1, it is twice as likely to be used, but it is NOT guaranteed to be used.</para>
423       <para>Also note that free-space stripe weighting does not activate until two OSTs are imbalanced by more than 20%. Until then, a faster round-robin stripe allocator is used. (The new round-robin order also maximizes network balancing.)</para>
424       <section remap="h4">
425         <title><indexterm><primary>proc</primary><secondary>striping</secondary></indexterm>Managing Stripe Allocation</title>
426         <para>The MDS uses two methods to manage stripe allocation and determine which OSTs to use for file object storage:</para>
427         <itemizedlist>
428           <listitem>
429             <para><emphasis role="bold">QOS</emphasis></para>
430             <para>Quality of Service (QOS) considers an OST&apos;s available blocks, speed, and the number of existing objects, etc. Using these criteria, the MDS selects OSTs with more free space more often than OSTs with less free space.</para>
431           </listitem>
432         </itemizedlist>
433         <itemizedlist>
434           <listitem>
435             <para><emphasis role="bold">RR</emphasis></para>
436             <para>Round-Robin (RR) allocates objects evenly across all OSTs. The RR stripe allocator is faster than QOS, and used often because it distributes space usage/load best in most situations, maximizing network balancing and improving performance.</para>
437           </listitem>
438         </itemizedlist>
439         <para>Whether QOS or RR is used depends on the setting of the <literal>qos_threshold_rr</literal> proc tunable. The <literal>qos_threshold_rr</literal> variable specifies a percentage threshold where the use of QOS or RR becomes more/less likely. The <literal>qos_threshold_rr</literal> tunable can be set as an integer, from 0 to 100, and results in this stripe allocation behavior:</para>
440         <itemizedlist>
441           <listitem>
442             <para> If <literal>qos_threshold_rr</literal> is set to 0, then QOS is always used</para>
443           </listitem>
444           <listitem>
445             <para> If <literal>qos_threshold_rr</literal> is set to 100, then RR is always used</para>
446           </listitem>
447           <listitem>
448             <para> The larger the <literal>qos_threshold_rr</literal> setting, the greater the possibility that RR is used instead of QOS</para>
449           </listitem>
450         </itemizedlist>
451       </section>
452     </section>
453   </section>
454   <section xml:id="dbdoclet.50438271_78950">
455       <title><indexterm><primary>proc</primary><secondary>I/O tunables</secondary></indexterm>Lustre I/O Tunables</title>
456     <para>The section describes I/O tunables.</para>
457     <para><literal> /proc/fs/lustre/llite/&lt;fsname&gt;-&lt;uid&gt;/max_cache_mb </literal></para>
458     <screen># cat /proc/fs/lustre/llite/lustre-ce63ca00/max_cached_mb 128</screen>
459     <para>This tunable is the maximum amount of inactive data cached by the client (default is 3/4 of RAM).</para>
460     <section remap="h3">
461       <title><indexterm><primary>proc</primary><secondary>RPC tunables</secondary></indexterm>Client I/O RPC Stream Tunables</title>
462       <para>The Lustre engine always attempts to pack an optimal amount of data into each I/O RPC and attempts to keep a consistent number of issued RPCs in progress at a time. Lustre exposes several tuning variables to adjust behavior according to network conditions and cluster size. Each OSC has its own tree of these tunables. For example:</para>
463       <screen>$ ls -d /proc/fs/lustre/osc/OSC_client_ost1_MNT_client_2 /localhost
464 /proc/fs/lustre/osc/OSC_uml0_ost1_MNT_localhost
465 /proc/fs/lustre/osc/OSC_uml0_ost2_MNT_localhost
466 /proc/fs/lustre/osc/OSC_uml0_ost3_MNT_localhost
467 $ ls /proc/fs/lustre/osc/OSC_uml0_ost1_MNT_localhost
468 blocksizefilesfree max_dirty_mb ost_server_uuid stats</screen>
469       <para>... and so on.</para>
470       <para>RPC stream tunables are described below.</para>
471       <para><literal> /proc/fs/lustre/osc/&lt;object name&gt;/max_dirty_mb </literal></para>
472       <para>This tunable controls how many MBs of dirty data can be written and queued up in the OSC. POSIX file writes that are cached contribute to this count. When the limit is reached, additional writes stall until previously-cached writes are written to the server. This may be changed by writing a single ASCII integer to the file. Only values between 0 and 512 are allowable. If 0 is given, no writes are cached. Performance suffers noticeably unless you use large writes (1 MB or more).</para>
473       <para><literal> /proc/fs/lustre/osc/&lt;object name&gt;/cur_dirty_bytes </literal></para>
474       <para>This tunable is a read-only value that returns the current amount of bytes written and cached on this OSC.</para>
475       <para><literal> /proc/fs/lustre/osc/&lt;object name&gt;/max_pages_per_rpc </literal></para>
476       <para>This tunable is the maximum number of pages that will undergo I/O in a single RPC to the OST. The minimum is a single page and the maximum for this setting is platform dependent (256 for i386/x86_64, possibly less for ia64/PPC with larger <literal>PAGE_SIZE</literal>), though generally amounts to a total of 1 MB in the RPC.</para>
477       <para><literal> /proc/fs/lustre/osc/&lt;object name&gt;/max_rpcs_in_flight </literal></para>
478       <para>This tunable is the maximum number of concurrent RPCs in flight from an OSC to its OST. If the OSC tries to initiate an RPC but finds that it already has the same number of RPCs outstanding, it will wait to issue further RPCs until some complete. The minimum setting is 1 and maximum setting is 32. If you are looking to improve small file I/O performance, increase the <literal>max_rpcs_in_flight</literal> value.</para>
479       <para>To maximize performance, the value for <literal>max_dirty_mb</literal> is recommended to be 4 * <literal>max_pages_per_rpc</literal> * <literal>max_rpcs_in_flight</literal>.</para>
480       <note>
481         <para>The 
482             <literal>
483             <replaceable>&lt;object name&gt;</replaceable>
484           </literal>
485            varies depending on the specific Lustre configuration. For <literal>&lt;object name&gt;</literal> examples, refer to the sample command output.</para>
486       </note>
487     </section>
488     <section remap="h3">
489       <title><indexterm><primary>proc</primary><secondary>watching RPC</secondary></indexterm>Watching the Client RPC Stream</title>
490       <para>The same directory contains a <literal>rpc_stats</literal> file with a histogram showing the composition of previous RPCs. The histogram can be cleared by writing any value into the <literal>rpc_stats</literal> file.</para>
491       <screen># cat /proc/fs/lustre/osc/spfs-OST0000-osc-c45f9c00/rpc_stats
492 snapshot_time:                                     1174867307.156604 (secs.usecs)
493 read RPCs in flight:                               0
494 write RPCs in flight:                              0
495 pending write pages:                               0
496 pending read pages:                                0
497                    read                                    write
498 pages per rpc              rpcs    %       cum     %       |       rpcs    %       cum     %
499 1:                 0       0       0               |       0               0       0
500  
501                    read                                    write
502 rpcs in flight             rpcs    %       cum     %       |       rpcs    %       cum     %
503 0:                 0       0       0               |       0               0       0
504  
505                    read                                    write
506 offset                     rpcs    %       cum     %       |       rpcs    %       cum     %
507 0:                 0       0       0               |       0               0       0
508 </screen>
509       <para>Where:</para>
510       <informaltable frame="all">
511         <tgroup cols="2">
512           <colspec colname="c1" colwidth="50*"/>
513           <colspec colname="c2" colwidth="50*"/>
514           <thead>
515             <row>
516               <entry>
517                 <para><emphasis role="bold">Field</emphasis></para>
518               </entry>
519               <entry>
520                 <para><emphasis role="bold">Description</emphasis></para>
521               </entry>
522             </row>
523           </thead>
524           <tbody>
525             <row>
526               <entry>
527                 <para> <emphasis role="bold">{read,write} RPCs in flight</emphasis></para>
528               </entry>
529               <entry>
530                 <para>Number of read/write RPCs issued by the OSC, but not complete at the time of the snapshot. This value should always be less than or equal to max_rpcs_in_flight.</para>
531               </entry>
532             </row>
533             <row>
534               <entry>
535                 <para> <emphasis role="bold">pending {read,write} pages</emphasis></para>
536               </entry>
537               <entry>
538                 <para>Number of pending read/write pages that have been queued for I/O in the OSC.</para>
539               </entry>
540             </row>
541             <row>
542               <entry>
543                 <para> <emphasis role="bold">pages per RPC</emphasis></para>
544               </entry>
545               <entry>
546                 <para>When an RPC is sent, the number of pages it consists of is recorded (in order). A single page RPC increments the 0: row.</para>
547               </entry>
548             </row>
549             <row>
550               <entry>
551                 <para> <emphasis role="bold">RPCs in flight</emphasis></para>
552               </entry>
553               <entry>
554                 <para>When an RPC is sent, the number of other RPCs that are pending is recorded. When the first RPC is sent, the 0: row is incremented. If the first RPC is sent while another is pending, the 1: row is incremented and so on. As each RPC *completes*, the number of pending RPCs is not tabulated.</para>
555                 <para>This table is a good way to visualize the concurrency of the RPC stream. Ideally, you will see a large clump around the max_rpcs_in_flight value, which shows that the network is being kept busy.</para>
556               </entry>
557             </row>
558             <row>
559               <entry>
560                 <para> <emphasis role="bold">offset</emphasis></para>
561               </entry>
562               <entry>
563                 <para> </para>
564               </entry>
565             </row>
566           </tbody>
567         </tgroup>
568       </informaltable>
569     </section>
570     <section remap="h3">
571         <title><indexterm><primary>proc</primary><secondary>read/write survey</secondary></indexterm>Client Read-Write Offset Survey</title>
572       <para>The offset_stats parameter maintains statistics for occurrences where a series of read or write calls from a process did not access the next sequential location. The offset field is reset to 0 (zero) whenever a different file is read/written.</para>
573       <para>Read/write offset statistics are off, by default. The statistics can be activated by writing anything into the <literal>offset_stats</literal> file.</para>
574       <para>Example:</para>
575       <screen># cat /proc/fs/lustre/llite/lustre-f57dee00/rw_offset_stats
576 snapshot_time: 1155748884.591028 (secs.usecs)
577 R/W                PID             RANGE START             RANGE END               SMALLEST EXTENT         LARGEST EXTENT                          OFFSET
578 R          8385            0                       128                     128                     128                             0
579 R          8385            0                       224                     224                     224                             -128
580 W          8385            0                       250                     50                      100                             0
581 W          8385            100                     1110                    10                      500                             -150
582 W          8384            0                       5233                    5233                    5233                            0
583 R          8385            500                     600                     100                     100                             -610</screen>
584       <para>Where:</para>
585       <informaltable frame="all">
586         <tgroup cols="2">
587           <colspec colname="c1" colwidth="50*"/>
588           <colspec colname="c2" colwidth="50*"/>
589           <thead>
590             <row>
591               <entry>
592                 <para><emphasis role="bold">Field</emphasis></para>
593               </entry>
594               <entry>
595                 <para><emphasis role="bold">Description</emphasis></para>
596               </entry>
597             </row>
598           </thead>
599           <tbody>
600             <row>
601               <entry>
602                 <para> <literal> R/W </literal></para>
603               </entry>
604               <entry>
605                 <para>Whether the non-sequential call was a read or write</para>
606               </entry>
607             </row>
608             <row>
609               <entry>
610                 <para> <literal> PID </literal></para>
611               </entry>
612               <entry>
613                 <para>Process ID which made the read/write call.</para>
614               </entry>
615             </row>
616             <row>
617               <entry>
618                 <para> <literal> Range Start/Range End </literal></para>
619               </entry>
620               <entry>
621                 <para>Range in which the read/write calls were sequential.</para>
622               </entry>
623             </row>
624             <row>
625               <entry>
626                 <para> <literal> Smallest Extent </literal></para>
627               </entry>
628               <entry>
629                 <para>Smallest extent (single read/write) in the corresponding range.</para>
630               </entry>
631             </row>
632             <row>
633               <entry>
634                 <para> <literal> Largest Extent </literal></para>
635               </entry>
636               <entry>
637                 <para>Largest extent (single read/write) in the corresponding range.</para>
638               </entry>
639             </row>
640             <row>
641               <entry>
642                 <para> <literal> Offset </literal></para>
643               </entry>
644               <entry>
645                 <para>Difference from the previous range end to the current range start.</para>
646                 <para>For example, Smallest-Extent indicates that the writes in the range 100 to 1110 were sequential, with a minimum write of 10 and a maximum write of 500. This range was started with an offset of -150. That means this is the difference between the last entry&apos;s range-end and this entry&apos;s range-start for the same file.</para>
647                 <para>The <literal>rw_offset_stats</literal> file can be cleared by writing to it:</para>
648                 <screen>echo &gt; /proc/fs/lustre/llite/lustre-f57dee00/rw_offset_stats</screen>
649               </entry>
650             </row>
651           </tbody>
652         </tgroup>
653       </informaltable>
654     </section>
655     <section remap="h3">
656         <title><indexterm><primary>proc</primary><secondary>read/write survey</secondary></indexterm>Client Read-Write Extents Survey</title>
657       <para><emphasis role="bold">Client-Based I/O Extent Size Survey</emphasis></para>
658       <para>The <literal>rw_extent_stats</literal> histogram in the <literal>llite</literal> directory shows you the statistics for the sizes of the read-write I/O extents. This file does not maintain the per-process statistics.</para>
659       <para>Example:</para>
660       <screen>$ cat /proc/fs/lustre/llite/lustre-ee5af200/extents_stats
661 snapshot_time:                     1213828728.348516 (secs.usecs)
662                            read            |               write
663 extents                    calls   %       cum%    |       calls   %       cum%
664  
665 0K - 4K :          0       0       0       |       2       2       2
666 4K - 8K :          0       0       0       |       0       0       2
667 8K - 16K :         0       0       0       |       0       0       2
668 16K - 32K :                0       0       0       |       20      23      26
669 32K - 64K :                0       0       0       |       0       0       26
670 64K - 128K :               0       0       0       |       51      60      86
671 128K - 256K :              0       0       0       |       0       0       86
672 256K - 512K :              0       0       0       |       0       0       86
673 512K - 1024K :             0       0       0       |       0       0       86
674 1M - 2M :          0       0       0       |       11      13      100</screen>
675       <para>The file can be cleared by issuing the following command:</para>
676       <screen>$ echo &gt; cat /proc/fs/lustre/llite/lustre-ee5af200/extents_stats</screen>
677       <para><emphasis role="bold">Per-Process Client I/O Statistics</emphasis></para>
678       <para>The <literal>extents_stats_per_process</literal> file maintains the I/O extent size statistics on a per-process basis. So you can track the per-process statistics for the last <literal>MAX_PER_PROCESS_HIST</literal> processes.</para>
679       <para>Example:</para>
680       <screen>$ cat /proc/fs/lustre/llite/lustre-ee5af200/extents_stats_per_process
681 snapshot_time:                     1213828762.204440 (secs.usecs)
682                            read            |               write
683 extents                    calls   %       cum%    |       calls   %       cum%
684  
685 PID: 11488
686    0K - 4K :       0       0        0      |       0       0       0
687    4K - 8K :       0       0        0      |       0       0       0
688    8K - 16K :      0       0        0      |       0       0       0
689    16K - 32K :     0       0        0      |       0       0       0
690    32K - 64K :     0       0        0      |       0       0       0
691    64K - 128K :    0       0        0      |       0       0       0
692    128K - 256K :   0       0        0      |       0       0       0
693    256K - 512K :   0       0        0      |       0       0       0
694    512K - 1024K :  0       0        0      |       0       0       0
695    1M - 2M :       0       0        0      |       10      100     100
696  
697 PID: 11491
698    0K - 4K :       0       0        0      |       0       0       0
699    4K - 8K :       0       0        0      |       0       0       0
700    8K - 16K :      0       0        0      |       0       0       0
701    16K - 32K :     0       0        0      |       20      100     100
702    
703 PID: 11424
704    0K - 4K :       0       0        0      |       0       0       0
705    4K - 8K :       0       0        0      |       0       0       0
706    8K - 16K :      0       0        0      |       0       0       0
707    16K - 32K :     0       0        0      |       0       0       0
708    32K - 64K :     0       0        0      |       0       0       0
709    64K - 128K :    0       0        0      |       16      100     100
710  
711 PID: 11426
712    0K - 4K :       0       0        0      |       1       100     100
713  
714 PID: 11429
715    0K - 4K :       0       0        0      |       1       100     100
716  
717 </screen>
718     </section>
719     <section xml:id="dbdoclet.50438271_55057">
720         <title><indexterm><primary>proc</primary><secondary>block I/O</secondary></indexterm>Watching the OST Block I/O Stream</title>
721       <para>Similarly, there is a <literal>brw_stats</literal> histogram in the obdfilter directory which shows you the statistics for number of I/O requests sent to the disk, their size and whether they are contiguous on the disk or not.</para>
722       <screen>cat /proc/fs/lustre/obdfilter/lustre-OST0000/brw_stats 
723 snapshot_time:                     1174875636.764630 (secs:usecs)
724                            read                            write
725 pages per brw              brws    %       cum %   |       rpcs    %       cum %
726 1:                 0       0       0       |       0       0       0
727                            read                                    write
728 discont pages              rpcs    %       cum %   |       rpcs    %       cum %
729 1:                 0       0       0       |       0       0       0
730                            read                                    write
731 discont blocks             rpcs    %       cum %   |       rpcs    %       cum %
732 1:                 0       0       0       |       0       0       0
733                            read                                    write
734 dio frags          rpcs    %       cum %   |       rpcs    %       cum %
735 1:                 0       0       0       |       0       0       0
736                            read                                    write
737 disk ios in flight rpcs    %       cum %   |       rpcs    %       cum %
738 1:                 0       0       0       |       0       0       0
739                            read                                    write
740 io time (1/1000s)  rpcs    %       cum %   |       rpcs    %       cum %
741 1:                 0       0       0       |       0       0       0
742                            read                                    write
743 disk io size               rpcs    %       cum %   |       rpcs    %       cum %
744 1:                 0       0       0       |       0       0       0
745                            read                                    write
746 </screen>
747       <para>The fields are explained below:</para>
748       <informaltable frame="all">
749         <tgroup cols="2">
750           <colspec colname="c1" colwidth="50*"/>
751           <colspec colname="c2" colwidth="50*"/>
752           <thead>
753             <row>
754               <entry>
755                 <para><emphasis role="bold">Field</emphasis></para>
756               </entry>
757               <entry>
758                 <para><emphasis role="bold">Description</emphasis></para>
759               </entry>
760             </row>
761           </thead>
762           <tbody>
763             <row>
764               <entry>
765                 <para> <literal> pages per brw </literal></para>
766               </entry>
767               <entry>
768                 <para>Number of pages per RPC request, which should match aggregate client <literal>rpc_stats</literal>.</para>
769               </entry>
770             </row>
771             <row>
772               <entry>
773                 <para> <literal> discont pages </literal></para>
774               </entry>
775               <entry>
776                 <para>Number of discontinuities in the logical file offset of each page in a single RPC.</para>
777               </entry>
778             </row>
779             <row>
780               <entry>
781                 <para> <literal> discont blocks </literal></para>
782               </entry>
783               <entry>
784                 <para>Number of discontinuities in the physical block allocation in the file system for a single RPC.</para>
785               </entry>
786             </row>
787           </tbody>
788         </tgroup>
789       </informaltable>
790       <para>For each Lustre service, the following information is provided:</para>
791       <itemizedlist>
792         <listitem>
793           <para>Number of requests</para>
794         </listitem>
795         <listitem>
796           <para>Request wait time (avg, min, max and std dev)</para>
797         </listitem>
798         <listitem>
799           <para>Service idle time (% of elapsed time)</para>
800         </listitem>
801       </itemizedlist>
802       <para>Additionally, data on each Lustre service is provided by service type:</para>
803       <itemizedlist>
804         <listitem>
805           <para>Number of requests of this type</para>
806         </listitem>
807         <listitem>
808           <para>Request service time (avg, min, max and std dev)</para>
809         </listitem>
810       </itemizedlist>
811     </section>
812     <section remap="h3">
813       <title><indexterm><primary>proc</primary><secondary>readahead</secondary></indexterm>Using File Readahead and Directory Statahead</title>
814       <para>Lustre 1.6.5.1 introduced file readahead and directory statahead functionality that read data into memory in anticipation of a process actually requesting the data. File readahead functionality reads file content data into memory. Directory statahead functionality reads metadata into memory. When readahead and/or statahead work well, a data-consuming process finds that the information it needs is available when requested, and it is unnecessary to wait for network I/O.</para>
815       <section remap="h4">
816         <title>Tuning File Readahead</title>
817         <para>File readahead is triggered when two or more sequential reads by an application fail to be satisfied by the Linux buffer cache. The size of the initial readahead is 1 MB. Additional readaheads grow linearly, and increment until the readahead cache on the client is full at 40 MB.</para>
818         <para><literal> /proc/fs/lustre/llite/&lt;fsname&gt;-&lt;uid&gt;/max_read_ahead_mb </literal></para>
819         <para>This tunable controls the maximum amount of data readahead on a file. Files are read ahead in RPC-sized chunks (1 MB or the size of read() call, if larger) after the second sequential read on a file descriptor. Random reads are done at the size of the read() call only (no readahead). Reads to non-contiguous regions of the file reset the readahead algorithm, and readahead is not triggered again until there are sequential reads again. To disable readahead, set this tunable to 0. The default value is 40 MB.</para>
820         <para><literal> /proc/fs/lustre/llite/&lt;fsname&gt;-&lt;uid&gt;/max_read_ahead_whole_mb </literal></para>
821         <para>This tunable controls the maximum size of a file that is read in its entirety, regardless of the size of the <literal>read()</literal>.</para>
822       </section>
823       <section remap="h4">
824         <title>Tuning Directory Statahead</title>
825         <para>When the <literal>ls -l</literal> process opens a directory, its process ID is recorded. When the first directory entry is &apos;&apos;stated&apos;&apos; with this recorded process ID, a statahead thread is triggered which stats ahead all of the directory entries, in order. The <literal>ls -l</literal> process can use the stated directory entries directly, improving performance.</para>
826         <para><literal> /proc/fs/lustre/llite/*/statahead_max </literal></para>
827         <para>This tunable controls whether directory <literal>statahead</literal> is enabled and the maximum statahead count. By default, statahead is active.</para>
828         <para>To disable statahead, set this tunable to:</para>
829         <screen>echo 0 &gt; /proc/fs/lustre/llite/*/statahead_max</screen>
830         <para>To set the maximum statahead count (n), set this tunable to:</para>
831         <screen>echo n &gt; /proc/fs/lustre/llite/*/statahead_max</screen>
832         <para>The maximum value of n is 8192.</para>
833         <para>
834           <literal>
835             <replaceable role="bold"> /proc/fs/lustre/llite/*/statahead_status </replaceable>
836           </literal>
837       </para>
838         <para>This is a read-only interface that indicates the current statahead status.</para>
839       </section>
840     </section>
841     <section remap="h3">
842       <title><indexterm><primary>proc</primary><secondary>read cache</secondary></indexterm>OSS Read Cache</title>
843       <para>The OSS read cache feature provides read-only caching of data on an OSS. This functionality uses the regular Linux page cache to store the data. Just like caching from a regular filesytem in Linux, OSS read cache uses as much physical memory as is allocated.</para>
844       <para>OSS read cache improves Lustre performance in these situations:</para>
845       <itemizedlist>
846         <listitem>
847           <para>Many clients are accessing the same data set (as in HPC applications and when diskless clients boot from Lustre)</para>
848         </listitem>
849         <listitem>
850           <para>One client is storing data while another client is reading it (essentially exchanging data via the OST)</para>
851         </listitem>
852         <listitem>
853           <para>A client has very limited caching of its own</para>
854         </listitem>
855       </itemizedlist>
856       <para>OSS read cache offers these benefits:</para>
857       <itemizedlist>
858         <listitem>
859           <para>Allows OSTs to cache read data more frequently</para>
860         </listitem>
861         <listitem>
862           <para>Improves repeated reads to match network speeds instead of disk speeds</para>
863         </listitem>
864         <listitem>
865           <para>Provides the building blocks for OST write cache (small-write aggregation)</para>
866         </listitem>
867       </itemizedlist>
868       <section remap="h4">
869         <title>Using OSS Read Cache</title>
870         <para>OSS read cache is implemented on the OSS, and does not require any special support on the client side. Since OSS read cache uses the memory available in the Linux page cache, you should use I/O patterns to determine the appropriate amount of memory for the cache; if the data is mostly reads, then more cache is required than for writes.</para>
871         <para>OSS read cache is enabled, by default, and managed by the following tunables:</para>
872         <itemizedlist>
873           <listitem>
874             <para><literal>read_cache_enable</literal>  controls whether data read from disk during a read request is kept in memory and available for later read requests for the same data, without having to re-read it from disk. By default, read cache is enabled (<literal>read_cache_enable = 1</literal>).</para>
875           </listitem>
876         </itemizedlist>
877         <para>When the OSS receives a read request from a client, it reads data from disk into its memory and sends the data as a reply to the requests. If read cache is enabled, this data stays in memory after the client&apos;s request is finished, and the OSS skips reading data from disk when subsequent read requests for the same are received. The read cache is managed by the Linux kernel globally across all OSTs on that OSS, and the least recently used cache pages will be dropped from memory when the amount of free memory is running low.</para>
878         <para>If read cache is disabled (<literal>read_cache_enable = 0</literal>), then the OSS will discard the data after the client&apos;s read requests are serviced and, for subsequent read requests, the OSS must read the data from disk.</para>
879         <para>To disable read cache on all OSTs of an OSS, run:</para>
880         <screen>root@oss1# lctl set_param obdfilter.*.read_cache_enable=0</screen>
881         <para>To re-enable read cache on one OST, run:</para>
882         <screen>root@oss1# lctl set_param obdfilter.{OST_name}.read_cache_enable=1</screen>
883         <para>To check if read cache is enabled on all OSTs on an OSS, run:</para>
884         <screen>root@oss1# lctl get_param obdfilter.*.read_cache_enable</screen>
885         <itemizedlist>
886           <listitem>
887             <para><literal>writethrough_cache_enable</literal>  controls whether data sent to the OSS as a write request is kept in the read cache and available for later reads, or if it is discarded from cache when the write is completed. By default, writethrough cache is enabled (<literal>writethrough_cache_enable = 1</literal>).</para>
888           </listitem>
889         </itemizedlist>
890         <para>When the OSS receives write requests from a client, it receives data from the client into its memory and writes the data to disk. If writethrough cache is enabled, this data stays in memory after the write request is completed, allowing the OSS to skip reading this data from disk if a later read request, or partial-page write request, for the same data is received.</para>
891         <para>If writethrough cache is disabled (<literal>writethrough_cache_enabled = 0</literal>), then the OSS discards the data after the client&apos;s write request is completed, and for subsequent read request, or partial-page write request, the OSS must re-read the data from disk.</para>
892         <para>Enabling writethrough cache is advisable if clients are doing small or unaligned writes that would cause partial-page updates, or if the files written by one node are immediately being accessed by other nodes. Some examples where this might be useful include producer-consumer I/O models or shared-file writes with a different node doing I/O not aligned on 4096-byte boundaries. Disabling writethrough cache is advisable in the case where files are mostly written to the file system but are not re-read within a short time period, or files are only written and re-read by the same node, regardless of whether the I/O is aligned or not.</para>
893         <para>To disable writethrough cache on all OSTs of an OSS, run:</para>
894         <screen>root@oss1# lctl set_param obdfilter.*.writethrough_cache_enable=0</screen>
895         <para>To re-enable writethrough cache on one OST, run:</para>
896         <screen>root@oss1# lctl set_param \
897 obdfilter.{OST_name}.writethrough_cache_enable=1</screen>
898         <para>To check if writethrough cache is</para>
899         <screen>root@oss1# lctl set_param obdfilter.*.writethrough_cache_enable=1</screen>
900         <itemizedlist>
901           <listitem>
902             <para><literal>readcache_max_filesize</literal>  controls the maximum size of a file that both the read cache and writethrough cache will try to keep in memory. Files larger than <literal>readcache_max_filesize</literal> will not be kept in cache for either reads or writes.</para>
903           </listitem>
904         </itemizedlist>
905         <para>This can be very useful for workloads where relatively small files are repeatedly accessed by many clients, such as job startup files, executables, log files, etc., but large files are read or written only once. By not putting the larger files into the cache, it is much more likely that more of the smaller files will remain in cache for a longer time.</para>
906         <para>When setting <literal>readcache_max_filesize</literal>, the input value can be specified in bytes, or can have a suffix to indicate other binary units such as <emphasis role="bold">K</emphasis>ilobytes, <emphasis role="bold">M</emphasis>egabytes, <emphasis role="bold">G</emphasis>igabytes, <emphasis role="bold">T</emphasis>erabytes, or <emphasis role="bold">P</emphasis>etabytes.</para>
907         <para>To limit the maximum cached file size to 32MB on all OSTs of an OSS, run:</para>
908         <screen>root@oss1# lctl set_param obdfilter.*.readcache_max_filesize=32M</screen>
909         <para>To disable the maximum cached file size on an OST, run:</para>
910         <screen>root@oss1# lctl set_param \
911 obdfilter.{OST_name}.readcache_max_filesize=-1</screen>
912         <para>To check the current maximum cached file size on all OSTs of an OSS, run:</para>
913         <screen>root@oss1# lctl get_param obdfilter.*.readcache_max_filesize</screen>
914       </section>
915     </section>
916     <section remap="h3">
917       <title><indexterm><primary>proc</primary><secondary>OSS journal</secondary></indexterm>OSS Asynchronous Journal Commit</title>
918       <para>The OSS asynchronous journal commit feature synchronously writes data to disk without forcing a journal flush. This reduces the number of seeks and significantly improves performance on some hardware.</para>
919       <note>
920         <para>Asynchronous journal commit cannot work with O_DIRECT writes, a journal flush is still forced.</para>
921       </note>
922       <para>When asynchronous journal commit is enabled, client nodes keep data in the page cache (a page reference). Lustre clients monitor the last committed transaction number (transno) in messages sent from the OSS to the clients. When a client sees that the last committed transno reported by the OSS is &gt;=bulk write transno, it releases the reference on the corresponding pages. To avoid page references being held for too long on clients after a bulk write, a 7 second ping request is scheduled (jbd commit time is 5 seconds) after the bulk write reply is received, so the OSS has an opportunity to report the last committed transno.</para>
923       <para>If the OSS crashes before the journal commit occurs, then the intermediate data is lost. However, new OSS recovery functionality (introduced in the asynchronous journal commit feature), causes clients to replay their write requests and compensate for the missing disk updates by restoring the state of the file system.</para>
924       <para>To enable asynchronous journal commit, set the <literal>sync_journal parameter</literal> to zero (<literal>sync_journal=0</literal>):</para>
925       <screen>$ lctl set_param obdfilter.*.sync_journal=0 
926 obdfilter.lol-OST0001.sync_journal=0</screen>
927       <para>By default, <literal>sync_journal</literal> is disabled (<literal>sync_journal=1</literal>), which forces a journal flush after every bulk write.</para>
928       <para>When asynchronous journal commit is used, clients keep a page reference until the journal transaction commits. This can cause problems when a client receives a blocking callback, because pages need to be removed from the page cache, but they cannot be removed because of the extra page reference.</para>
929       <para>This problem is solved by forcing a journal flush on lock cancellation. When this happens, the client is granted the metadata blocks that have hit the disk, and it can safely release the page reference before processing the blocking callback. The parameter which controls this action is <literal>sync_on_lock_cancel</literal>, which can be set to the following values:</para>
930       <itemizedlist>
931         <listitem>
932           <para><literal>always</literal>: Always force a journal flush on lock cancellation</para>
933         </listitem>
934         <listitem>
935           <para><literal>blocking</literal>: Force a journal flush only when the local cancellation is due to a blocking callback</para>
936         </listitem>
937         <listitem>
938           <para><literal>never</literal>: Do not force any journal flush</para>
939         </listitem>
940       </itemizedlist>
941       <para>Here is an example of <literal>sync_on_lock_cancel</literal> being set not to force a journal flush:</para>
942       <screen>$ lctl get_param obdfilter.*.sync_on_lock_cancel
943 obdfilter.lol-OST0001.sync_on_lock_cancel=never</screen>
944       <para>By default, <literal>sync_on_lock_cancel</literal> is set to never, because asynchronous journal commit is disabled by default.</para>
945       <para>When asynchronous journal commit is enabled (<literal>sync_journal=0</literal>), <literal>sync_on_lock_cancel</literal> is automatically set to always, if it was previously set to never.</para>
946       <para>Similarly, when asynchronous journal commit is disabled, (<literal>sync_journal=1</literal>), <literal>sync_on_lock_cancel</literal> is enforced to never.</para>
947     </section>
948     <section remap="h3">
949       <title><indexterm><primary>proc</primary><secondary>mballoc history</secondary></indexterm><literal>mballoc</literal> History</title>
950       <para><literal> /proc/fs/ldiskfs/sda/mb_history </literal></para>
951       <para>Multi-Block-Allocate (<literal>mballoc</literal>), enables Lustre to ask <literal>ldiskfs</literal> to allocate multiple blocks with a single request to the block allocator. Typically, an <literal>ldiskfs</literal> file system allocates only one block per time. Each <literal>mballoc</literal>-enabled partition has this file. This is sample output:</para>
952       <screen>pid  inode   goal            result          found   grps    cr      \   merge   tail    broken
953 2838       139267  17/12288/1      17/12288/1      1       0       0       \   M       1       8192
954 2838       139267  17/12289/1      17/12289/1      1       0       0       \   M       0       0
955 2838       139267  17/12290/1      17/12290/1      1       0       0       \   M       1       2
956 2838       24577   3/12288/1       3/12288/1       1       0       0       \   M       1       8192
957 2838       24578   3/12288/1       3/771/1         1       1       1       \           0       0
958 2838       32769   4/12288/1       4/12288/1       1       0       0       \   M       1       8192
959 2838       32770   4/12288/1       4/12289/1       13      1       1       \           0       0
960 2838       32771   4/12288/1       5/771/1         26      2       1       \           0       0
961 2838       32772   4/12288/1       5/896/1         31      2       1       \           1       128
962 2838       32773   4/12288/1       5/897/1         31      2       1       \           0       0
963 2828       32774   4/12288/1       5/898/1         31      2       1       \           1       2
964 2838       32775   4/12288/1       5/899/1         31      2       1       \           0       0
965 2838       32776   4/12288/1       5/900/1         31      2       1       \           1       4
966 2838       32777   4/12288/1       5/901/1         31      2       1       \           0       0
967 2838       32778   4/12288/1       5/902/1         31      2       1       \           1       2</screen>
968       <para>The parameters are described below:</para>
969       <informaltable frame="all">
970         <tgroup cols="2">
971           <colspec colname="c1" colwidth="50*"/>
972           <colspec colname="c2" colwidth="50*"/>
973           <thead>
974             <row>
975               <entry>
976                 <para><emphasis role="bold">Parameter</emphasis></para>
977               </entry>
978               <entry>
979                 <para><emphasis role="bold">Description</emphasis></para>
980               </entry>
981             </row>
982           </thead>
983           <tbody>
984             <row>
985               <entry>
986                 <para> <emphasis role="bold">
987                     <literal>pid</literal>
988                   </emphasis></para>
989               </entry>
990               <entry>
991                 <para>Process that made the allocation.</para>
992               </entry>
993             </row>
994             <row>
995               <entry>
996                 <para> <emphasis role="bold">
997                     <literal>inode</literal>
998                   </emphasis></para>
999               </entry>
1000               <entry>
1001                 <para>inode number allocated blocks</para>
1002               </entry>
1003             </row>
1004             <row>
1005               <entry>
1006                 <para> <emphasis role="bold">
1007                     <literal>goal</literal>
1008                   </emphasis></para>
1009               </entry>
1010               <entry>
1011                 <para>Initial request that came to <literal>mballoc</literal> (group/block-in-group/number-of-blocks)</para>
1012               </entry>
1013             </row>
1014             <row>
1015               <entry>
1016                 <para> <emphasis role="bold">
1017                     <literal>result</literal>
1018                   </emphasis></para>
1019               </entry>
1020               <entry>
1021                 <para>What <literal>mballoc</literal> actually found for this request.</para>
1022               </entry>
1023             </row>
1024             <row>
1025               <entry>
1026                 <para> <emphasis role="bold">
1027                     <literal>found</literal>
1028                   </emphasis></para>
1029               </entry>
1030               <entry>
1031                 <para>Number of free chunks <literal>mballoc</literal> found and measured before the final decision.</para>
1032               </entry>
1033             </row>
1034             <row>
1035               <entry>
1036                 <para> <emphasis role="bold">
1037                     <literal>grps</literal>
1038                   </emphasis></para>
1039               </entry>
1040               <entry>
1041                 <para>Number of groups <literal>mballoc</literal> scanned to satisfy the request.</para>
1042               </entry>
1043             </row>
1044             <row>
1045               <entry>
1046                 <para> <emphasis role="bold">
1047                     <literal>cr</literal>
1048                   </emphasis></para>
1049               </entry>
1050               <entry>
1051                 <para>Stage at which <literal>mballoc</literal> found the result:</para>
1052                 <para><emphasis role="bold">0</emphasis> - best in terms of resource allocation. The request was 1MB or larger and was satisfied directly via the kernel buddy allocator.</para>
1053                 <para><emphasis role="bold">1</emphasis> - regular stage (good at resource consumption)</para>
1054                 <para><emphasis role="bold">2</emphasis> - fs is quite fragmented (not that bad at resource consumption)</para>
1055                 <para><emphasis role="bold">3</emphasis> - fs is very fragmented (worst at resource consumption)</para>
1056               </entry>
1057             </row>
1058             <row>
1059               <entry>
1060                 <para> <emphasis role="bold">
1061                     <literal>queue</literal>
1062                   </emphasis></para>
1063               </entry>
1064               <entry>
1065                 <para>Total bytes in active/queued sends.</para>
1066               </entry>
1067             </row>
1068             <row>
1069               <entry>
1070                 <para> <emphasis role="bold">
1071                     <literal>merge</literal>
1072                   </emphasis></para>
1073               </entry>
1074               <entry>
1075                 <para>Whether the request hit the goal. This is good as extents code can now merge new blocks to existing extent, eliminating the need for extents tree growth.</para>
1076               </entry>
1077             </row>
1078             <row>
1079               <entry>
1080                 <para> <emphasis role="bold">
1081                     <literal>tail</literal>
1082                   </emphasis></para>
1083               </entry>
1084               <entry>
1085                 <para>Number of blocks left free after the allocation breaks large free chunks.</para>
1086               </entry>
1087             </row>
1088             <row>
1089               <entry>
1090                 <para> <emphasis role="bold">
1091                     <literal>broken</literal>
1092                   </emphasis></para>
1093               </entry>
1094               <entry>
1095                 <para>How large the broken chunk was.</para>
1096               </entry>
1097             </row>
1098           </tbody>
1099         </tgroup>
1100       </informaltable>
1101       <para>Most customers are probably interested in found/cr. If cr is 0 1 and found is less than 100, then <literal>mballoc</literal> is doing quite well.</para>
1102       <para>Also, number-of-blocks-in-request (third number in the goal triple) can tell the number of blocks requested by the <literal>obdfilter</literal>. If the <literal>obdfilter</literal> is doing a lot of small requests (just few blocks), then either the client is processing input/output to a lot of small files, or something may be wrong with the client (because it is better if client sends large input/output requests). This can be investigated with the OSC <literal>rpc_stats</literal> or OST <literal>brw_stats</literal> mentioned above.</para>
1103       <para>Number of groups scanned (<literal>grps</literal> column) should be small. If it reaches a few dozen often, then either your disk file system is pretty fragmented or <literal>mballoc</literal> is doing something wrong in the group selection part.</para>
1104     </section>
1105     <section remap="h3">
1106       <title><indexterm><primary>proc</primary><secondary>mballoc3 tunables</secondary></indexterm><literal>mballoc3</literal> Tunables</title>
1107       <para>Lustre version 1.6.1 and later includes <literal>mballoc3</literal>, which was built on top of <literal>mballoc2</literal>. By default, mballoc3 is enabled, and adds these features:</para>
1108       <itemizedlist>
1109         <listitem>
1110           <para> Pre-allocation for single files (helps to resist fragmentation)</para>
1111         </listitem>
1112         <listitem>
1113           <para> Pre-allocation for a group of files (helps to pack small files into large, contiguous chunks)</para>
1114         </listitem>
1115         <listitem>
1116           <para> Stream allocation (helps to decrease the seek rate)</para>
1117         </listitem>
1118       </itemizedlist>
1119       <para>The following <literal>mballoc3</literal> tunables are available:</para>
1120       <informaltable frame="all">
1121         <tgroup cols="2">
1122           <colspec colname="c1" colwidth="50*"/>
1123           <colspec colname="c2" colwidth="50*"/>
1124           <thead>
1125             <row>
1126               <entry>
1127                 <para><emphasis role="bold">Field</emphasis></para>
1128               </entry>
1129               <entry>
1130                 <para><emphasis role="bold">Description</emphasis></para>
1131               </entry>
1132             </row>
1133           </thead>
1134           <tbody>
1135             <row>
1136               <entry>
1137                 <para> <emphasis role="bold">
1138                     <literal>stats</literal>
1139                   </emphasis></para>
1140               </entry>
1141               <entry>
1142                 <para>Enables/disables the collection of statistics. Collected statistics can be found</para>
1143                 <para>in <literal>/proc/fs/ldiskfs2/&lt;dev&gt;/mb_history</literal>.</para>
1144               </entry>
1145             </row>
1146             <row>
1147               <entry>
1148                 <para> <literal> max_to_scan </literal></para>
1149               </entry>
1150               <entry>
1151                 <para>Maximum number of free chunks that <literal>mballoc</literal> finds before a final decision to avoid livelock.</para>
1152               </entry>
1153             </row>
1154             <row>
1155               <entry>
1156                 <para> <literal> min_to_scan </literal></para>
1157               </entry>
1158               <entry>
1159                 <para>Minimum number of free chunks that <literal>mballoc</literal> finds before a final decision. This is useful for a very small request, to resist fragmentation of big free chunks.</para>
1160               </entry>
1161             </row>
1162             <row>
1163               <entry>
1164                 <para> <literal> order2_req </literal></para>
1165               </entry>
1166               <entry>
1167                 <para>For requests equal to 2^N (where N &gt;= <literal>order2_req</literal>), a very fast search via buddy structures is used.</para>
1168               </entry>
1169             </row>
1170             <row>
1171               <entry>
1172                 <para> <literal> stream_req </literal></para>
1173               </entry>
1174               <entry>
1175                 <para>Requests smaller or equal to this value are packed together to form large write I/Os.</para>
1176               </entry>
1177             </row>
1178           </tbody>
1179         </tgroup>
1180       </informaltable>
1181       <para>The following tunables, providing more control over allocation policy, will be available in the next version:</para>
1182       <informaltable frame="all">
1183         <tgroup cols="2">
1184           <colspec colname="c1" colwidth="50*"/>
1185           <colspec colname="c2" colwidth="50*"/>
1186           <thead>
1187             <row>
1188               <entry>
1189                 <para><emphasis role="bold">Field</emphasis></para>
1190               </entry>
1191               <entry>
1192                 <para><emphasis role="bold">Description</emphasis></para>
1193               </entry>
1194             </row>
1195           </thead>
1196           <tbody>
1197             <row>
1198               <entry>
1199                 <para> <literal> stats </literal></para>
1200               </entry>
1201               <entry>
1202                 <para>Enables/disables the collection of statistics. Collected statistics can be found in <literal>/proc/fs/ldiskfs2/&lt;dev&gt;/mb_history</literal>.</para>
1203               </entry>
1204             </row>
1205             <row>
1206               <entry>
1207                 <para> <literal> max_to_scan </literal></para>
1208               </entry>
1209               <entry>
1210                 <para>Maximum number of free chunks that <literal>mballoc</literal> finds before a final decision to avoid livelock.</para>
1211               </entry>
1212             </row>
1213             <row>
1214               <entry>
1215                 <para> <literal> min_to_scan </literal></para>
1216               </entry>
1217               <entry>
1218                 <para>Minimum number of free chunks that <literal>mballoc</literal> finds before a final decision. This is useful for a very small request, to resist fragmentation of big free chunks.</para>
1219               </entry>
1220             </row>
1221             <row>
1222               <entry>
1223                 <para> <literal> order2_req </literal></para>
1224               </entry>
1225               <entry>
1226                 <para>For requests equal to 2^N (where N &gt;= <literal>order2_req</literal>), a very fast search via buddy structures is used.</para>
1227               </entry>
1228             </row>
1229             <row>
1230               <entry>
1231                 <para> <literal> small_req </literal></para>
1232               </entry>
1233               <entry morerows="1">
1234                 <para>All requests are divided into 3 categories:</para>
1235                 <para>&lt; small_req (packed together to form large, aggregated requests)</para>
1236                 <para>&lt; large_req (allocated mostly in linearly)</para>
1237                 <para>&gt; large_req (very large requests so the arm seek does not matter)</para>
1238                 <para>The idea is that we try to pack small requests to form large requests, and then place all large requests (including compound from the small ones) close to one another, causing as few arm seeks as possible.</para>
1239               </entry>
1240             </row>
1241             <row>
1242               <entry>
1243                 <para> <literal> large_req </literal></para>
1244               </entry>
1245             </row>
1246             <row>
1247               <entry>
1248                 <para> <literal> prealloc_table </literal></para>
1249               </entry>
1250               <entry>
1251                 <para>The amount of space to preallocate depends on the current file size. The idea is that for small files we do not need 1 MB preallocations and for large files, 1 MB preallocations are not large enough; it is better to preallocate 4 MB.</para>
1252               </entry>
1253             </row>
1254             <row>
1255               <entry>
1256                 <para> <literal> group_prealloc </literal></para>
1257               </entry>
1258               <entry>
1259                 <para>The amount of space preallocated for small requests to be grouped.</para>
1260               </entry>
1261             </row>
1262           </tbody>
1263         </tgroup>
1264       </informaltable>
1265     </section>
1266     <section remap="h3">
1267       <title><indexterm><primary>proc</primary><secondary>locking</secondary></indexterm>Locking</title>
1268       <para><literal> /proc/fs/lustre/ldlm/ldlm/namespaces/&lt;OSC name|MDC name&gt;/lru_size </literal></para>
1269       <para>The <literal>lru_size</literal> parameter is used to control the number of client-side locks in an LRU queue. LRU size is dynamic, based on load. This optimizes the number of locks available to nodes that have different workloads (e.g., login/build nodes vs. compute nodes vs. backup nodes).</para>
1270       <para>The total number of locks available is a function of the server&apos;s RAM. The default limit is 50 locks/1 MB of RAM. If there is too much memory pressure, then the LRU size is shrunk. The number of locks on the server is limited to {number of OST/MDT on node} * {number of clients} * {client lru_size}.</para>
1271       <itemizedlist>
1272         <listitem>
1273           <para>To enable automatic LRU sizing, set the <literal>lru_size</literal> parameter to 0. In this case, the <literal>lru_size</literal> parameter shows the current number of locks being used on the export. (In Lustre 1.6.5.1 and later, LRU sizing is enabled, by default.)</para>
1274         </listitem>
1275         <listitem>
1276           <para>To specify a maximum number of locks, set the lru_size parameter to a value &gt; 0 (former numbers are okay, 100 * CPU_NR). We recommend that you only increase the LRU size on a few login nodes where users access the file system interactively.</para>
1277         </listitem>
1278       </itemizedlist>
1279       <para>To clear the LRU on a single client, and as a result flush client cache, without changing the <literal>lru_size</literal> value:</para>
1280       <screen>$ lctl set_param ldlm.namespaces.&lt;osc_name|mdc_name&gt;.lru_size=clear</screen>
1281       <para>If you shrink the LRU size below the number of existing unused locks, then the unused locks are canceled immediately. Use echo clear to cancel all locks without changing the value.</para>
1282       <note>
1283         <para>Currently, the lru_size parameter can only be set temporarily with <literal>lctl set_param</literal>; it cannot be set permanently.</para>
1284       </note>
1285       <para>To disable LRU sizing, run this command on the Lustre clients:</para>
1286       <screen>$ lctl set_param ldlm.namespaces.*osc*.lru_size=$((NR_CPU*100))</screen>
1287       <para>Replace <literal>NR_CPU</literal> value with the number of CPUs on the node.</para>
1288       <para>To determine the number of locks being granted:</para>
1289       <screen>$ lctl get_param ldlm.namespaces.*.pool.limit</screen>
1290     </section>
1291     <section xml:id="dbdoclet.50438271_87260">
1292       <title><indexterm><primary>proc</primary><secondary>thread counts</secondary></indexterm>Setting MDS and OSS Thread Counts</title>
1293       <para>MDS and OSS thread counts (minimum and maximum) can be set via the <literal>{min,max}_thread_count tunable</literal>. For each service, a new <literal>/proc/fs/lustre/{service}/*/thread_{min,max,started}</literal> entry is created. The tunable, <literal>{service}.thread_{min,max,started}</literal>, can be used to set the minimum and maximum thread counts or get the current number of running threads for the following services.</para>
1294       <informaltable frame="all">
1295         <tgroup cols="2">
1296           <colspec colname="c1" colwidth="50*"/>
1297           <colspec colname="c2" colwidth="50*"/>
1298           <tbody>
1299             <row>
1300               <entry>
1301                 <para> <emphasis role="bold">Service</emphasis></para>
1302               </entry>
1303               <entry>
1304                 <para> <emphasis role="bold">Description</emphasis></para>
1305               </entry>
1306             </row>
1307             <row>
1308               <entry>
1309                 <literal> mdt.MDS.mds </literal>
1310               </entry>
1311               <entry>
1312                 <para>normal metadata ops</para>
1313               </entry>
1314             </row>
1315             <row>
1316               <entry>
1317                 <literal> mdt.MDS.mds_readpage </literal>
1318               </entry>
1319               <entry>
1320                 <para>metadata readdir</para>
1321               </entry>
1322             </row>
1323             <row>
1324               <entry>
1325                 <literal> mdt.MDS.mds_setattr </literal>
1326               </entry>
1327               <entry>
1328                 <para>metadata setattr</para>
1329               </entry>
1330             </row>
1331             <row>
1332               <entry>
1333                 <literal> ost.OSS.ost </literal>
1334               </entry>
1335               <entry>
1336                 <para>normal data</para>
1337               </entry>
1338             </row>
1339             <row>
1340               <entry>
1341                 <literal> ost.OSS.ost_io </literal>
1342               </entry>
1343               <entry>
1344                 <para>bulk data IO</para>
1345               </entry>
1346             </row>
1347             <row>
1348               <entry>
1349                 <literal> ost.OSS.ost_create </literal>
1350               </entry>
1351               <entry>
1352                 <para>OST object pre-creation service</para>
1353               </entry>
1354             </row>
1355             <row>
1356               <entry>
1357                 <literal> ldlm.services.ldlm_canceld </literal>
1358               </entry>
1359               <entry>
1360                 <para>DLM lock cancel</para>
1361               </entry>
1362             </row>
1363             <row>
1364               <entry>
1365                 <literal> ldlm.services.ldlm_cbd </literal>
1366               </entry>
1367               <entry>
1368                 <para>DLM lock grant</para>
1369               </entry>
1370             </row>
1371           </tbody>
1372         </tgroup>
1373       </informaltable>
1374       <itemizedlist>
1375         <listitem>
1376           <para>To temporarily set this tunable, run:</para>
1377           <screen># lctl {get,set}_param {service}.thread_{min,max,started} </screen>
1378         </listitem>
1379       </itemizedlist>
1380       <itemizedlist>
1381         <listitem>
1382           <para>To permanently set this tunable, run:</para>
1383           <screen># lctl conf_param {service}.thread_{min,max,started} </screen>
1384           <para>The following examples show how to set thread counts and get the number of running threads for the ost_io service.</para>
1385         </listitem>
1386       </itemizedlist>
1387       <itemizedlist>
1388         <listitem>
1389           <para>To get the number of running threads, run:</para>
1390           <screen># lctl get_param ost.OSS.ost_io.threads_started</screen>
1391           <para>The command output will be similar to this:</para>
1392           <screen>ost.OSS.ost_io.threads_started=128</screen>
1393         </listitem>
1394       </itemizedlist>
1395       <itemizedlist>
1396         <listitem>
1397           <para>To set the maximum number of threads (512), run:</para>
1398           <screen># lctl get_param ost.OSS.ost_io.threads_max</screen>
1399           <para>The command output will be:</para>
1400           <screen>ost.OSS.ost_io.threads_max=512</screen>
1401         </listitem>
1402       </itemizedlist>
1403       <itemizedlist>
1404         <listitem>
1405           <para> To set the maximum thread count to 256 instead of 512 (to avoid overloading the storage or for an array with requests), run:</para>
1406           <screen># lctl set_param ost.OSS.ost_io.threads_max=256</screen>
1407           <para>The command output will be:</para>
1408           <screen>ost.OSS.ost_io.threads_max=256</screen>
1409         </listitem>
1410       </itemizedlist>
1411       <itemizedlist>
1412         <listitem>
1413           <para> To check if the new <literal>threads_max</literal> setting is active, run:</para>
1414           <screen># lctl get_param ost.OSS.ost_io.threads_max</screen>
1415           <para>The command output will be similar to this:</para>
1416           <screen>ost.OSS.ost_io.threads_max=256</screen>
1417         </listitem>
1418       </itemizedlist>
1419       <note>
1420         <para>Currently, the maximum thread count setting is advisory because Lustre does not reduce the number of service threads in use, even if that number exceeds the <literal>threads_max</literal> value. Lustre does not stop service threads once they are started.</para>
1421       </note>
1422     </section>
1423   </section>
1424   <section xml:id="dbdoclet.50438271_83523">
1425     <title><indexterm><primary>proc</primary><secondary>debug</secondary></indexterm>Debug</title>
1426     <para><literal> /proc/sys/lnet/debug </literal></para>
1427     <para>By default, Lustre generates a detailed log of all operations to aid in debugging. The level of debugging can affect the performance or speed you achieve with Lustre. Therefore, it is useful to reduce this overhead by turning down the debug level<footnote>
1428         <para>This controls the level of Lustre debugging kept in the internal log buffer. It does not alter the level of debugging that goes to syslog.</para>
1429       </footnote> to improve performance. Raise the debug level when you need to collect the logs for debugging problems. The debugging mask can be set with &quot;symbolic names&quot; instead of the numerical values that were used in prior releases. The new symbolic format is shown in the examples below.</para>
1430     <note>
1431       <para>All of the commands below must be run as root; note the <literal>#</literal> nomenclature.</para>
1432     </note>
1433     <para>To verify the debug level used by examining the <literal>sysctl</literal> that controls debugging, run:</para>
1434     <screen># sysctl lnet.debug 
1435 lnet.debug = ioctl neterror warning error emerg ha config console</screen>
1436     <para>To turn off debugging (except for network error debugging), run this command on all concerned nodes:</para>
1437     <screen># sysctl -w lnet.debug=&quot;neterror&quot; 
1438 lnet.debug = neterror</screen>
1439     <para>To turn off debugging completely, run this command on all concerned nodes:</para>
1440     <screen># sysctl -w lnet.debug=0 
1441 lnet.debug = 0</screen>
1442     <para>To set an appropriate debug level for a production environment, run:</para>
1443     <screen># sysctl -w lnet.debug=&quot;warning dlmtrace error emerg ha rpctrace vfstrace&quot; 
1444 lnet.debug = warning dlmtrace error emerg ha rpctrace vfstrace</screen>
1445     <para>The flags above collect enough high-level information to aid debugging, but they do not cause any serious performance impact.</para>
1446     <para>To clear all flags and set new ones, run:</para>
1447     <screen># sysctl -w lnet.debug=&quot;warning&quot; 
1448 lnet.debug = warning</screen>
1449     <para>To add new flags to existing ones, prefix them with a &quot;<literal>+</literal>&quot;:</para>
1450     <screen># sysctl -w lnet.debug=&quot;+neterror +ha&quot; 
1451 lnet.debug = +neterror +ha
1452 # sysctl lnet.debug 
1453 lnet.debug = neterror warning ha</screen>
1454     <para>To remove flags, prefix them with a &quot;<literal>-</literal>&quot;:</para>
1455     <screen># sysctl -w lnet.debug=&quot;-ha&quot; 
1456 lnet.debug = -ha
1457 # sysctl lnet.debug 
1458 lnet.debug = neterror warning</screen>
1459     <para>You can verify and change the debug level using the <literal>/proc</literal> interface in Lustre. To use the flags with <literal>/proc</literal>, run:</para>
1460     <screen># cat /proc/sys/lnet/debug 
1461 neterror warning
1462 # echo &quot;+ha&quot; &gt; /proc/sys/lnet/debug 
1463 # cat /proc/sys/lnet/debug 
1464 neterror warning ha
1465 # echo &quot;-warning&quot; &gt; /proc/sys/lnet/debug
1466 # cat /proc/sys/lnet/debug 
1467 neterror ha</screen>
1468     <para><literal> /proc/sys/lnet/subsystem_debug </literal></para>
1469     <para>This controls the debug logs for subsystems (see <literal>S_*</literal> definitions).</para>
1470     <para><literal> /proc/sys/lnet/debug_path </literal></para>
1471     <para>This indicates the location where debugging symbols should be stored for <literal>gdb</literal>. The default is set to <literal>/r/tmp/lustre-log-localhost.localdomain</literal>.</para>
1472     <para>These values can also be set via <literal>sysctl -w lnet.debug={value}</literal></para>
1473     <note>
1474       <para>The above entries only exist when Lustre has already been loaded.</para>
1475     </note>
1476     <para><literal> /proc/sys/lnet/panic_on_lbug </literal></para>
1477     <para>This causes Lustre to call &apos;&apos;panic&apos;&apos; when it detects an internal problem (an <literal>LBUG</literal>); panic crashes the node. This is particularly useful when a kernel crash dump utility is configured. The crash dump is triggered when the internal inconsistency is detected by Lustre.</para>
1478     <para><literal> /proc/sys/lnet/upcall </literal></para>
1479     <para>This allows you to specify the path to the binary which will be invoked when an <literal>LBUG</literal> is encountered. This binary is called with four parameters. The first one is the string &apos;&apos;<literal>LBUG</literal>&apos;&apos;. The second one is the file where the <literal>LBUG</literal> occurred. The third one is the function name. The fourth one is the line number in the file.</para>
1480     <section remap="h3">
1481       <title>RPC Information for Other OBD Devices</title>
1482       <para>Some OBD devices maintain a count of the number of RPC events that they process. Sometimes these events are more specific to operations of the device, like llite, than actual raw RPC counts.</para>
1483       <screen>$ find /proc/fs/lustre/ -name stats
1484 /proc/fs/lustre/osc/lustre-OST0001-osc-ce63ca00/stats
1485 /proc/fs/lustre/osc/lustre-OST0000-osc-ce63ca00/stats
1486 /proc/fs/lustre/osc/lustre-OST0001-osc/stats
1487 /proc/fs/lustre/osc/lustre-OST0000-osc/stats
1488 /proc/fs/lustre/mdt/MDS/mds_readpage/stats
1489 /proc/fs/lustre/mdt/MDS/mds_setattr/stats
1490 /proc/fs/lustre/mdt/MDS/mds/stats
1491 /proc/fs/lustre/mds/lustre-MDT0000/exports/ab206805-0630-6647-8543-d24265c91a3d/stats
1492 /proc/fs/lustre/mds/lustre-MDT0000/exports/08ac6584-6c4a-3536-2c6d-b36cf9cbdaa0/stats
1493 /proc/fs/lustre/mds/lustre-MDT0000/stats
1494 /proc/fs/lustre/ldlm/services/ldlm_canceld/stats
1495 /proc/fs/lustre/ldlm/services/ldlm_cbd/stats
1496 /proc/fs/lustre/llite/lustre-ce63ca00/stats
1497 </screen>
1498       <section remap="h4">
1499         <title><indexterm><primary>proc</primary><secondary>statistics</secondary></indexterm>Interpreting OST Statistics</title>
1500         <note>
1501           <para>See also <xref linkend="dbdoclet.50438219_84890"/> (llobdstat) and <xref linkend="dbdoclet.50438273_80593"/> (CollectL).</para>
1502         </note>
1503         <para>The OST .../stats files can be used to track client statistics (client activity) for each OST. It is possible to get a periodic dump of values from these file (for example, every 10 seconds), that show the RPC rates (similar to iostat) by using the <literal>llstat.pl</literal> tool:</para>
1504         <screen># llstat /proc/fs/lustre/osc/lustre-OST0000-osc/stats 
1505 /usr/bin/llstat: STATS on 09/14/07 /proc/fs/lustre/osc/lustre-OST0000-osc/stats on 192.168.10.34@tcp
1506 snapshot_time                      1189732762.835363
1507 ost_create                 1
1508 ost_get_info                       1
1509 ost_connect                        1
1510 ost_set_info                       1
1511 obd_ping                   212</screen>
1512         <para>To clear the statistics, give the <literal>-c</literal> option to <literal>llstat.pl</literal>. To specify how frequently the statistics should be cleared (in seconds), use an integer for the <literal>-i</literal> option. This is sample output with <literal>-c</literal> and <literal>-i10</literal> options used, providing statistics every 10s):</para>
1513         <screen>$ llstat -c -i10 /proc/fs/lustre/ost/OSS/ost_io/stats
1514  
1515 /usr/bin/llstat: STATS on 06/06/07 /proc/fs/lustre/ost/OSS/ost_io/ stats on 192.168.16.35@tcp
1516 snapshot_time                              1181074093.276072
1517  
1518 /proc/fs/lustre/ost/OSS/ost_io/stats @ 1181074103.284895
1519 Name               Cur.Count       Cur.Rate        #Events Unit            \last               min             avg             max             stddev
1520 req_waittime       8               0               8       [usec]          2078\               34              259.75          868             317.49
1521 req_qdepth 8               0               8       [reqs]          1\          0               0.12            1               0.35
1522 req_active 8               0               8       [reqs]          11\                 1               1.38            2               0.52
1523 reqbuf_avail       8               0               8       [bufs]          511\                63              63.88           64              0.35
1524 ost_write  8               0               8       [bytes]         1697677\    72914           212209.62       387579          91874.29
1525  
1526 /proc/fs/lustre/ost/OSS/ost_io/stats @ 1181074113.290180
1527 Name               Cur.Count       Cur.Rate        #Events Unit            \last               min             avg             max             stddev
1528 req_waittime       31              3               39      [usec]          30011\              34              822.79          12245           2047.71
1529 req_qdepth 31              3               39      [reqs]          0\          0               0.03            1               0.16
1530 req_active 31              3               39      [reqs]          58\         1               1.77            3               0.74
1531 reqbuf_avail       31              3               39      [bufs]          1977\               63              63.79           64              0.41
1532 ost_write  30              3               38      [bytes]         10284679\   15019           315325.16       910694          197776.51
1533  
1534 /proc/fs/lustre/ost/OSS/ost_io/stats @ 1181074123.325560
1535 Name               Cur.Count       Cur.Rate        #Events Unit            \last               min             avg             max             stddev
1536 req_waittime       21              2               60      [usec]          14970\              34              784.32          12245           1878.66
1537 req_qdepth 21              2               60      [reqs]          0\          0               0.02            1               0.13
1538 req_active 21              2               60      [reqs]          33\                 1               1.70            3               0.70
1539 reqbuf_avail       21              2               60      [bufs]          1341\               63              63.82           64              0.39
1540 ost_write  21              2               59      [bytes]         7648424\    15019           332725.08       910694          180397.87
1541 </screen>
1542         <para>Where:</para>
1543         <informaltable frame="all">
1544           <tgroup cols="2">
1545             <colspec colname="c1" colwidth="50*"/>
1546             <colspec colname="c2" colwidth="50*"/>
1547             <thead>
1548               <row>
1549                 <entry>
1550                   <para><emphasis role="bold">Parameter</emphasis></para>
1551                 </entry>
1552                 <entry>
1553                   <para><emphasis role="bold">Description</emphasis></para>
1554                 </entry>
1555               </row>
1556             </thead>
1557             <tbody>
1558               <row>
1559                 <entry>
1560                   <para> <literal> Cur. Count </literal></para>
1561                 </entry>
1562                 <entry>
1563                   <para>Number of events of each type sent in the last interval (in this example, 10s)</para>
1564                 </entry>
1565               </row>
1566               <row>
1567                 <entry>
1568                   <para> <literal> Cur. Rate </literal></para>
1569                 </entry>
1570                 <entry>
1571                   <para>Number of events per second in the last interval</para>
1572                 </entry>
1573               </row>
1574               <row>
1575                 <entry>
1576                   <para> <literal> #Events </literal></para>
1577                 </entry>
1578                 <entry>
1579                   <para>Total number of such events since the system started</para>
1580                 </entry>
1581               </row>
1582               <row>
1583                 <entry>
1584                   <para> <literal> Unit </literal></para>
1585                 </entry>
1586                 <entry>
1587                   <para>Unit of measurement for that statistic (microseconds, requests, buffers)</para>
1588                 </entry>
1589               </row>
1590               <row>
1591                 <entry>
1592                   <para> <literal> last </literal></para>
1593                 </entry>
1594                 <entry>
1595                   <para>Average rate of these events (in units/event) for the last interval during which they arrived. For instance, in the above mentioned case of <literal>ost_destroy</literal> it took an average of 736 microseconds per destroy for the 400 object destroys in the previous 10 seconds.</para>
1596                 </entry>
1597               </row>
1598               <row>
1599                 <entry>
1600                   <para> <literal> min </literal></para>
1601                 </entry>
1602                 <entry>
1603                   <para>Minimum rate (in units/events) since the service started</para>
1604                 </entry>
1605               </row>
1606               <row>
1607                 <entry>
1608                   <para> <literal> avg </literal></para>
1609                 </entry>
1610                 <entry>
1611                   <para>Average rate</para>
1612                 </entry>
1613               </row>
1614               <row>
1615                 <entry>
1616                   <para> <literal> max </literal></para>
1617                 </entry>
1618                 <entry>
1619                   <para>Maximum rate</para>
1620                 </entry>
1621               </row>
1622               <row>
1623                 <entry>
1624                   <para> <literal> stddev </literal></para>
1625                 </entry>
1626                 <entry>
1627                   <para>Standard deviation (not measured in all cases)</para>
1628                 </entry>
1629               </row>
1630             </tbody>
1631           </tgroup>
1632         </informaltable>
1633         <para>The events common to all services are:</para>
1634         <informaltable frame="all">
1635           <tgroup cols="2">
1636             <colspec colname="c1" colwidth="50*"/>
1637             <colspec colname="c2" colwidth="50*"/>
1638             <thead>
1639               <row>
1640                 <entry>
1641                   <para><emphasis role="bold">Parameter</emphasis></para>
1642                 </entry>
1643                 <entry>
1644                   <para><emphasis role="bold">Description</emphasis></para>
1645                 </entry>
1646               </row>
1647             </thead>
1648             <tbody>
1649               <row>
1650                 <entry>
1651                   <para> <literal> req_waittime </literal></para>
1652                 </entry>
1653                 <entry>
1654                   <para>Amount of time a request waited in the queue before being handled by an available server thread.</para>
1655                 </entry>
1656               </row>
1657               <row>
1658                 <entry>
1659                   <para> <literal> req_qdepth </literal></para>
1660                 </entry>
1661                 <entry>
1662                   <para>Number of requests waiting to be handled in the queue for this service.</para>
1663                 </entry>
1664               </row>
1665               <row>
1666                 <entry>
1667                   <para> <literal> req_active </literal></para>
1668                 </entry>
1669                 <entry>
1670                   <para>Number of requests currently being handled.</para>
1671                 </entry>
1672               </row>
1673               <row>
1674                 <entry>
1675                   <para> <literal> reqbuf_avail </literal></para>
1676                 </entry>
1677                 <entry>
1678                   <para>Number of unsolicited lnet request buffers for this service.</para>
1679                 </entry>
1680               </row>
1681             </tbody>
1682           </tgroup>
1683         </informaltable>
1684         <para>Some service-specific events of interest are:</para>
1685         <informaltable frame="all">
1686           <tgroup cols="2">
1687             <colspec colname="c1" colwidth="50*"/>
1688             <colspec colname="c2" colwidth="50*"/>
1689             <thead>
1690               <row>
1691                 <entry>
1692                   <para><emphasis role="bold">Parameter</emphasis></para>
1693                 </entry>
1694                 <entry>
1695                   <para><emphasis role="bold">Description</emphasis></para>
1696                 </entry>
1697               </row>
1698             </thead>
1699             <tbody>
1700               <row>
1701                 <entry>
1702                   <para> <literal> ldlm_enqueue </literal></para>
1703                 </entry>
1704                 <entry>
1705                   <para>Time it takes to enqueue a lock (this includes file open on the MDS)</para>
1706                 </entry>
1707               </row>
1708               <row>
1709                 <entry>
1710                   <para> <literal> mds_reint </literal></para>
1711                 </entry>
1712                 <entry>
1713                   <para>Time it takes to process an MDS modification record (includes create, <literal>mkdir</literal>, <literal>unlink</literal>, <literal>rename</literal> and <literal>setattr</literal>)</para>
1714                 </entry>
1715               </row>
1716             </tbody>
1717           </tgroup>
1718         </informaltable>
1719       </section>
1720       <section remap="h4">
1721         <title><indexterm><primary>proc</primary><secondary>statistics</secondary></indexterm>Interpreting MDT Statistics</title>
1722         <note>
1723           <para>See also <xref linkend="dbdoclet.50438219_84890"/> (llobdstat) and <xref linkend="dbdoclet.50438273_80593"/> (CollectL).</para>
1724         </note>
1725         <para>The MDT .../stats files can be used to track MDT statistics for the MDS. Here is sample output for an MDT stats file:</para>
1726         <screen># cat /proc/fs/lustre/mds/*-MDT0000/stats 
1727 snapshot_time                              1244832003.676892 secs.usecs 
1728 open                                       2 samples [reqs] 
1729 close                                      1 samples [reqs] 
1730 getxattr                           3 samples [reqs] 
1731 process_config                             1 samples [reqs] 
1732 connect                                    2 samples [reqs] 
1733 disconnect                         2 samples [reqs] 
1734 statfs                                     3 samples [reqs] 
1735 setattr                                    1 samples [reqs] 
1736 getattr                                    3 samples [reqs] 
1737 llog_init                          6 samples [reqs] 
1738 notify                                     16 samples [reqs]</screen>
1739       </section>
1740     </section>
1741   </section>
1742 </chapter>