Whamcloud - gitweb
LUDOC-317 proc: OST reserved size
[doc/manual.git] / LustreProc.xml
1 <?xml version='1.0' encoding='UTF-8'?>
2 <chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0"
3   xml:lang="en-US" xml:id="lustreproc">
4   <title xml:id="lustreproc.title">Lustre Parameters</title>
5   <para>The <literal>/proc</literal> and <literal>/sys</literal> file systems
6   acts as an interface to internal data structures in the kernel. This chapter
7   describes parameters and tunables that are useful for optimizing and
8   monitoring aspects of a Lustre file system. It includes these sections:</para>
9   <itemizedlist>
10     <listitem>
11       <para><xref linkend="dbdoclet.50438271_83523"/></para>
12       <para>.</para>
13     </listitem>
14   </itemizedlist>
15   <section>
16     <title>Introduction to Lustre Parameters</title>
17     <para>Lustre parameters and statistics files provide an interface to
18     internal data structures in the kernel that enables monitoring and
19     tuning of many aspects of Lustre file system and application performance.
20     These data structures include settings and metrics for components such
21     as memory, networking, file systems, and kernel housekeeping routines,
22     which are available throughout the hierarchical file layout.
23     </para>
24     <para>Typically, metrics are accessed via <literal>lctl get_param</literal>
25     files and settings are changed by via <literal>lctl set_param</literal>.
26     Some data is server-only, some data is client-only, and some data is
27     exported from the client to the server and is thus duplicated in both
28     locations.</para>
29     <note>
30       <para>In the examples in this chapter, <literal>#</literal> indicates
31       a command is entered as root.  Lustre servers are named according to the
32       convention <literal><replaceable>fsname</replaceable>-<replaceable>MDT|OSTnumber</replaceable></literal>.
33         The standard UNIX wildcard designation (*) is used.</para>
34     </note>
35     <para>Some examples are shown below:</para>
36     <itemizedlist>
37       <listitem>
38         <para> To obtain data from a Lustre client:</para>
39         <screen># lctl list_param osc.*
40 osc.testfs-OST0000-osc-ffff881071d5cc00
41 osc.testfs-OST0001-osc-ffff881071d5cc00
42 osc.testfs-OST0002-osc-ffff881071d5cc00
43 osc.testfs-OST0003-osc-ffff881071d5cc00
44 osc.testfs-OST0004-osc-ffff881071d5cc00
45 osc.testfs-OST0005-osc-ffff881071d5cc00
46 osc.testfs-OST0006-osc-ffff881071d5cc00
47 osc.testfs-OST0007-osc-ffff881071d5cc00
48 osc.testfs-OST0008-osc-ffff881071d5cc00</screen>
49         <para>In this example, information about OST connections available
50         on a client is displayed (indicated by "osc").</para>
51       </listitem>
52     </itemizedlist>
53     <itemizedlist>
54       <listitem>
55         <para> To see multiple levels of parameters, use multiple
56           wildcards:<screen># lctl list_param osc.*.*
57 osc.testfs-OST0000-osc-ffff881071d5cc00.active
58 osc.testfs-OST0000-osc-ffff881071d5cc00.blocksize
59 osc.testfs-OST0000-osc-ffff881071d5cc00.checksum_type
60 osc.testfs-OST0000-osc-ffff881071d5cc00.checksums
61 osc.testfs-OST0000-osc-ffff881071d5cc00.connect_flags
62 osc.testfs-OST0000-osc-ffff881071d5cc00.contention_seconds
63 osc.testfs-OST0000-osc-ffff881071d5cc00.cur_dirty_bytes
64 ...
65 osc.testfs-OST0000-osc-ffff881071d5cc00.rpc_stats</screen></para>
66       </listitem>
67     </itemizedlist>
68     <itemizedlist>
69       <listitem>
70         <para> To view a specific file, use <literal>lctl get_param</literal>:
71           <screen># lctl get_param osc.lustre-OST0000*.rpc_stats</screen></para>
72       </listitem>
73     </itemizedlist>
74     <para>For more information about using <literal>lctl</literal>, see <xref
75         xmlns:xlink="http://www.w3.org/1999/xlink" linkend="dbdoclet.50438194_51490"/>.</para>
76     <para>Data can also be viewed using the <literal>cat</literal> command
77     with the full path to the file. The form of the <literal>cat</literal>
78     command is similar to that of the <literal>lctl get_param</literal>
79     command with some differences.  Unfortunately, as the Linux kernel has
80     changed over the years, the location of statistics and parameter files
81     has also changed, which means that the Lustre parameter files may be
82     located in either the <literal>/proc</literal> directory, in the
83     <literal>/sys</literal> directory, and/or in the
84     <literal>/sys/kernel/debug</literal> directory, depending on the kernel
85     version and the Lustre version being used.  The <literal>lctl</literal>
86     command insulates scripts from these changes and is preferred over direct
87     file access, unless as part of a high-performance monitoring system.
88     In the <literal>cat</literal> command:</para>
89     <itemizedlist>
90       <listitem>
91         <para>Replace the dots in the path with slashes.</para>
92       </listitem>
93       <listitem>
94         <para>Prepend the path with the following as appropriate:
95           <screen>/{proc,sys}/{fs,sys}/{lustre,lnet}</screen></para>
96       </listitem>
97     </itemizedlist>
98     <para>For example, an <literal>lctl get_param</literal> command may look like
99       this:<screen># lctl get_param osc.*.uuid
100 osc.testfs-OST0000-osc-ffff881071d5cc00.uuid=594db456-0685-bd16-f59b-e72ee90e9819
101 osc.testfs-OST0001-osc-ffff881071d5cc00.uuid=594db456-0685-bd16-f59b-e72ee90e9819
102 ...</screen></para>
103     <para>The equivalent <literal>cat</literal> command may look like this:
104      <screen># cat /proc/fs/lustre/osc/*/uuid
105 594db456-0685-bd16-f59b-e72ee90e9819
106 594db456-0685-bd16-f59b-e72ee90e9819
107 ...</screen></para>
108     <para>or like this:
109      <screen># cat /sys/fs/lustre/osc/*/uuid
110 594db456-0685-bd16-f59b-e72ee90e9819
111 594db456-0685-bd16-f59b-e72ee90e9819
112 ...</screen></para>
113     <para>The <literal>llstat</literal> utility can be used to monitor some
114     Lustre file system I/O activity over a specified time period. For more
115     details, see
116     <xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="dbdoclet.50438219_23232"/></para>
117     <para>Some data is imported from attached clients and is available in a
118     directory called <literal>exports</literal> located in the corresponding
119     per-service directory on a Lustre server. For example:
120     <screen>oss:/root# lctl list_param obdfilter.testfs-OST0000.exports.*
121 # hash ldlm_stats stats uuid</screen></para>
122     <section remap="h3">
123       <title>Identifying Lustre File Systems and Servers</title>
124       <para>Several <literal>/proc</literal> files on the MGS list existing
125       Lustre file systems and file system servers. The examples below are for
126       a Lustre file system called
127           <literal>testfs</literal> with one MDT and three OSTs.</para>
128       <itemizedlist>
129         <listitem>
130           <para> To view all known Lustre file systems, enter:</para>
131           <screen>mgs# lctl get_param mgs.*.filesystems
132 testfs</screen>
133         </listitem>
134         <listitem>
135           <para> To view the names of the servers in a file system in which least one server is
136             running,
137             enter:<screen>lctl get_param mgs.*.live.<replaceable>&lt;filesystem name></replaceable></screen></para>
138           <para>For example:</para>
139           <screen>mgs# lctl get_param mgs.*.live.testfs
140 fsname: testfs
141 flags: 0x20     gen: 45
142 testfs-MDT0000
143 testfs-OST0000
144 testfs-OST0001
145 testfs-OST0002 
146
147 Secure RPC Config Rules: 
148
149 imperative_recovery_state:
150     state: startup
151     nonir_clients: 0
152     nidtbl_version: 6
153     notify_duration_total: 0.001000
154     notify_duation_max:  0.001000
155     notify_count: 4</screen>
156         </listitem>
157         <listitem>
158           <para>To view the names of all live servers in the file system as listed in
159               <literal>/proc/fs/lustre/devices</literal>, enter:</para>
160           <screen># lctl device_list
161 0 UP mgs MGS MGS 11
162 1 UP mgc MGC192.168.10.34@tcp 1f45bb57-d9be-2ddb-c0b0-5431a49226705
163 2 UP mdt MDS MDS_uuid 3
164 3 UP lov testfs-mdtlov testfs-mdtlov_UUID 4
165 4 UP mds testfs-MDT0000 testfs-MDT0000_UUID 7
166 5 UP osc testfs-OST0000-osc testfs-mdtlov_UUID 5
167 6 UP osc testfs-OST0001-osc testfs-mdtlov_UUID 5
168 7 UP lov testfs-clilov-ce63ca00 08ac6584-6c4a-3536-2c6d-b36cf9cbdaa04
169 8 UP mdc testfs-MDT0000-mdc-ce63ca00 08ac6584-6c4a-3536-2c6d-b36cf9cbdaa05
170 9 UP osc testfs-OST0000-osc-ce63ca00 08ac6584-6c4a-3536-2c6d-b36cf9cbdaa05
171 10 UP osc testfs-OST0001-osc-ce63ca00 08ac6584-6c4a-3536-2c6d-b36cf9cbdaa05</screen>
172           <para>The information provided on each line includes:</para>
173           <para> -  Device number</para>
174           <para> - Device status (UP, INactive, or STopping) </para>
175           <para> -  Device name</para>
176           <para> -  Device UUID</para>
177           <para> -  Reference count (how many users this device has)</para>
178         </listitem>
179         <listitem>
180           <para>To display the name of any server, view the device
181             label:<screen>mds# e2label /dev/sda
182 testfs-MDT0000</screen></para>
183         </listitem>
184       </itemizedlist>
185     </section>
186   </section>
187   <section>
188     <title>Tuning Multi-Block Allocation (mballoc)</title>
189     <para>Capabilities supported by <literal>mballoc</literal> include:</para>
190     <itemizedlist>
191       <listitem>
192         <para> Pre-allocation for single files to help to reduce fragmentation.</para>
193       </listitem>
194       <listitem>
195         <para> Pre-allocation for a group of files to enable packing of small files into large,
196           contiguous chunks.</para>
197       </listitem>
198       <listitem>
199         <para> Stream allocation to help decrease the seek rate.</para>
200       </listitem>
201     </itemizedlist>
202     <para>The following <literal>mballoc</literal> tunables are available:</para>
203     <informaltable frame="all">
204       <tgroup cols="2">
205         <colspec colname="c1" colwidth="30*"/>
206         <colspec colname="c2" colwidth="70*"/>
207         <thead>
208           <row>
209             <entry>
210               <para><emphasis role="bold">Field</emphasis></para>
211             </entry>
212             <entry>
213               <para><emphasis role="bold">Description</emphasis></para>
214             </entry>
215           </row>
216         </thead>
217         <tbody>
218           <row>
219             <entry>
220               <para>
221                 <literal>mb_max_to_scan</literal></para>
222             </entry>
223             <entry>
224               <para>Maximum number of free chunks that <literal>mballoc</literal> finds before a
225                 final decision to avoid a livelock situation.</para>
226             </entry>
227           </row>
228           <row>
229             <entry>
230               <para>
231                 <literal>mb_min_to_scan</literal></para>
232             </entry>
233             <entry>
234               <para>Minimum number of free chunks that <literal>mballoc</literal> searches before
235                 picking the best chunk for allocation. This is useful for small requests to reduce
236                 fragmentation of big free chunks.</para>
237             </entry>
238           </row>
239           <row>
240             <entry>
241               <para>
242                 <literal>mb_order2_req</literal></para>
243             </entry>
244             <entry>
245               <para>For requests equal to 2^N, where N &gt;= <literal>mb_order2_req</literal>, a
246                 fast search is done using a base 2 buddy allocation service.</para>
247             </entry>
248           </row>
249           <row>
250             <entry>
251               <para>
252                 <literal>mb_small_req</literal></para>
253             </entry>
254             <entry morerows="1">
255               <para><literal>mb_small_req</literal> - Defines (in MB) the upper bound of "small
256                 requests".</para>
257               <para><literal>mb_large_req</literal> - Defines (in MB) the lower bound of "large
258                 requests".</para>
259               <para>Requests are handled differently based on size:<itemizedlist>
260                   <listitem>
261                     <para>&lt; <literal>mb_small_req</literal> - Requests are packed together to
262                       form large, aggregated requests.</para>
263                   </listitem>
264                   <listitem>
265                     <para>> <literal>mb_small_req</literal> and &lt; <literal>mb_large_req</literal>
266                       - Requests are primarily allocated linearly.</para>
267                   </listitem>
268                   <listitem>
269                     <para>> <literal>mb_large_req</literal> - Requests are allocated since hard disk
270                       seek time is less of a concern in this case.</para>
271                   </listitem>
272                 </itemizedlist></para>
273               <para>In general, small requests are combined to create larger requests, which are
274                 then placed close to one another to minimize the number of seeks required to access
275                 the data.</para>
276             </entry>
277           </row>
278           <row>
279             <entry>
280               <para>
281                 <literal>mb_large_req</literal></para>
282             </entry>
283           </row>
284           <row>
285             <entry>
286               <para>
287                 <literal>mb_prealloc_table</literal></para>
288             </entry>
289             <entry>
290               <para>A table of values used to preallocate space when a new request is received. By
291                 default, the table looks like
292                 this:<screen>prealloc_table
293 4 8 16 32 64 128 256 512 1024 2048 </screen></para>
294               <para>When a new request is received, space is preallocated at the next higher
295                 increment specified in the table. For example, for requests of less than 4 file
296                 system blocks, 4 blocks of space are preallocated; for requests between 4 and 8, 8
297                 blocks are preallocated; and so forth</para>
298               <para>Although customized values can be entered in the table, the performance of
299                 general usage file systems will not typically be improved by modifying the table (in
300                 fact, in ext4 systems, the table values are fixed).  However, for some specialized
301                 workloads, tuning the <literal>prealloc_table</literal> values may result in smarter
302                 preallocation decisions. </para>
303             </entry>
304           </row>
305           <row>
306             <entry>
307               <para>
308                 <literal>mb_group_prealloc</literal></para>
309             </entry>
310             <entry>
311               <para>The amount of space (in kilobytes) preallocated for groups of small
312                 requests.</para>
313             </entry>
314           </row>
315         </tbody>
316       </tgroup>
317     </informaltable>
318     <para>Buddy group cache information found in
319           <literal>/proc/fs/ldiskfs/<replaceable>disk_device</replaceable>/mb_groups</literal> may
320       be useful for assessing on-disk fragmentation. For
321       example:<screen>cat /proc/fs/ldiskfs/loop0/mb_groups 
322 #group: free free frags first pa [ 2^0 2^1 2^2 2^3 2^4 2^5 2^6 2^7 2^8 2^9 
323      2^10 2^11 2^12 2^13] 
324 #0    : 2936 2936 1     42    0  [ 0   0   0   1   1   1   1   2   0   1 
325      2    0    0    0   ]</screen></para>
326     <para>In this example, the columns show:<itemizedlist>
327         <listitem>
328           <para>#group number</para>
329         </listitem>
330         <listitem>
331           <para>Available blocks in the group</para>
332         </listitem>
333         <listitem>
334           <para>Blocks free on a disk</para>
335         </listitem>
336         <listitem>
337           <para>Number of free fragments</para>
338         </listitem>
339         <listitem>
340           <para>First free block in the group</para>
341         </listitem>
342         <listitem>
343           <para>Number of preallocated chunks (not blocks)</para>
344         </listitem>
345         <listitem>
346           <para>A series of available chunks of different sizes</para>
347         </listitem>
348       </itemizedlist></para>
349   </section>
350   <section>
351     <title>Monitoring Lustre File System  I/O</title>
352     <para>A number of system utilities are provided to enable collection of data related to I/O
353       activity in a Lustre file system. In general, the data collected describes:</para>
354     <itemizedlist>
355       <listitem>
356         <para> Data transfer rates and throughput of inputs and outputs external to the Lustre file
357           system, such as network requests or disk I/O operations performed</para>
358       </listitem>
359       <listitem>
360         <para> Data about the throughput or transfer rates of internal Lustre file system data, such
361           as locks or allocations. </para>
362       </listitem>
363     </itemizedlist>
364     <note>
365       <para>It is highly recommended that you complete baseline testing for your Lustre file system
366         to determine normal I/O activity for your hardware, network, and system workloads. Baseline
367         data will allow you to easily determine when performance becomes degraded in your system.
368         Two particularly useful baseline statistics are:</para>
369       <itemizedlist>
370         <listitem>
371           <para><literal>brw_stats</literal> â€“ Histogram data characterizing I/O requests to the
372             OSTs. For more details, see <xref xmlns:xlink="http://www.w3.org/1999/xlink"
373               linkend="dbdoclet.50438271_55057"/>.</para>
374         </listitem>
375         <listitem>
376           <para><literal>rpc_stats</literal> â€“ Histogram data showing information about RPCs made by
377             clients. For more details, see <xref xmlns:xlink="http://www.w3.org/1999/xlink"
378               linkend="MonitoringClientRCPStream"/>.</para>
379         </listitem>
380       </itemizedlist>
381     </note>
382     <section remap="h3" xml:id="MonitoringClientRCPStream">
383       <title><indexterm>
384           <primary>proc</primary>
385           <secondary>watching RPC</secondary>
386         </indexterm>Monitoring the Client RPC Stream</title>
387       <para>The <literal>rpc_stats</literal> file contains histogram data showing information about
388         remote procedure calls (RPCs) that have been made since this file was last cleared. The
389         histogram data can be cleared by writing any value into the <literal>rpc_stats</literal>
390         file.</para>
391       <para><emphasis role="italic"><emphasis role="bold">Example:</emphasis></emphasis></para>
392       <screen># lctl get_param osc.testfs-OST0000-osc-ffff810058d2f800.rpc_stats
393 snapshot_time:            1372786692.389858 (secs.usecs)
394 read RPCs in flight:      0
395 write RPCs in flight:     1
396 dio read RPCs in flight:  0
397 dio write RPCs in flight: 0
398 pending write pages:      256
399 pending read pages:       0
400
401                      read                   write
402 pages per rpc   rpcs   % cum % |       rpcs   % cum %
403 1:                 0   0   0   |          0   0   0
404 2:                 0   0   0   |          1   0   0
405 4:                 0   0   0   |          0   0   0
406 8:                 0   0   0   |          0   0   0
407 16:                0   0   0   |          0   0   0
408 32:                0   0   0   |          2   0   0
409 64:                0   0   0   |          2   0   0
410 128:               0   0   0   |          5   0   0
411 256:             850 100 100   |      18346  99 100
412
413                      read                   write
414 rpcs in flight  rpcs   % cum % |       rpcs   % cum %
415 0:               691  81  81   |       1740   9   9
416 1:                48   5  86   |        938   5  14
417 2:                29   3  90   |       1059   5  20
418 3:                17   2  92   |       1052   5  26
419 4:                13   1  93   |        920   5  31
420 5:                12   1  95   |        425   2  33
421 6:                10   1  96   |        389   2  35
422 7:                30   3 100   |      11373  61  97
423 8:                 0   0 100   |        460   2 100
424
425                      read                   write
426 offset          rpcs   % cum % |       rpcs   % cum %
427 0:               850 100 100   |      18347  99  99
428 1:                 0   0 100   |          0   0  99
429 2:                 0   0 100   |          0   0  99
430 4:                 0   0 100   |          0   0  99
431 8:                 0   0 100   |          0   0  99
432 16:                0   0 100   |          1   0  99
433 32:                0   0 100   |          1   0  99
434 64:                0   0 100   |          3   0  99
435 128:               0   0 100   |          4   0 100
436
437 </screen>
438       <para>The header information includes:</para>
439       <itemizedlist>
440         <listitem>
441           <para><literal>snapshot_time</literal> - UNIX epoch instant the file was read.</para>
442         </listitem>
443         <listitem>
444           <para><literal>read RPCs in flight</literal> - Number of read RPCs issued by the OSC, but
445             not complete at the time of the snapshot. This value should always be less than or equal
446             to <literal>max_rpcs_in_flight</literal>.</para>
447         </listitem>
448         <listitem>
449           <para><literal>write RPCs in flight</literal> - Number of write RPCs issued by the OSC,
450             but not complete at the time of the snapshot. This value should always be less than or
451             equal to <literal>max_rpcs_in_flight</literal>.</para>
452         </listitem>
453         <listitem>
454           <para><literal>dio read RPCs in flight</literal> - Direct I/O (as opposed to block I/O)
455             read RPCs issued but not completed at the time of the snapshot.</para>
456         </listitem>
457         <listitem>
458           <para><literal>dio write RPCs in flight</literal> - Direct I/O (as opposed to block I/O)
459             write RPCs issued but not completed at the time of the snapshot.</para>
460         </listitem>
461         <listitem>
462           <para><literal>pending write pages</literal>  - Number of pending write pages that have
463             been queued for I/O in the OSC.</para>
464         </listitem>
465         <listitem>
466           <para><literal>pending read pages</literal> - Number of pending read pages that have been
467             queued for I/O in the OSC.</para>
468         </listitem>
469       </itemizedlist>
470       <para>The tabular data is described in the table below. Each row in the table shows the number
471         of reads or writes (<literal>ios</literal>) occurring for the statistic, the relative
472         percentage (<literal>%</literal>) of total reads or writes, and the cumulative percentage
473           (<literal>cum %</literal>) to that point in the table for the statistic.</para>
474       <informaltable frame="all">
475         <tgroup cols="2">
476           <colspec colname="c1" colwidth="40*"/>
477           <colspec colname="c2" colwidth="60*"/>
478           <thead>
479             <row>
480               <entry>
481                 <para><emphasis role="bold">Field</emphasis></para>
482               </entry>
483               <entry>
484                 <para><emphasis role="bold">Description</emphasis></para>
485               </entry>
486             </row>
487           </thead>
488           <tbody>
489             <row>
490               <entry>
491                 <para> pages per RPC</para>
492               </entry>
493               <entry>
494                 <para>Shows cumulative RPC reads and writes organized according to the number of
495                   pages in the RPC. A single page RPC increments the <literal>0:</literal>
496                   row.</para>
497               </entry>
498             </row>
499             <row>
500               <entry>
501                 <para> RPCs in flight</para>
502               </entry>
503               <entry>
504                 <para> Shows the number of RPCs that are pending when an RPC is sent. When the first
505                   RPC is sent, the <literal>0:</literal> row is incremented. If the first RPC is
506                   sent while another RPC is pending, the <literal>1:</literal> row is incremented
507                   and so on. </para>
508               </entry>
509             </row>
510             <row>
511               <entry>
512                 <para> offset</para>
513               </entry>
514               <entry>
515                 <para> The page index of the first page read from or written to the object by the
516                   RPC. </para>
517               </entry>
518             </row>
519           </tbody>
520         </tgroup>
521       </informaltable>
522       <para><emphasis role="italic"><emphasis role="bold">Analysis:</emphasis></emphasis></para>
523       <para>This table provides a way to visualize the concurrency of the RPC stream. Ideally, you
524         will see a large clump around the <literal>max_rpcs_in_flight value</literal>, which shows
525         that the network is being kept busy.</para>
526       <para>For information about optimizing the client I/O RPC stream, see <xref
527           xmlns:xlink="http://www.w3.org/1999/xlink" linkend="TuningClientIORPCStream"/>.</para>
528     </section>
529     <section xml:id="lustreproc.clientstats" remap="h3">
530       <title><indexterm>
531           <primary>proc</primary>
532           <secondary>client stats</secondary>
533         </indexterm>Monitoring Client Activity</title>
534       <para>The <literal>stats</literal> file maintains statistics accumulate during typical
535         operation of a client across the VFS interface of the Lustre file system. Only non-zero
536         parameters are displayed in the file. </para>
537       <para>Client statistics are enabled by default.</para>
538       <note>
539         <para>Statistics for all mounted file systems can be discovered by
540           entering:<screen>lctl get_param llite.*.stats</screen></para>
541       </note>
542       <para><emphasis role="italic"><emphasis role="bold">Example:</emphasis></emphasis></para>
543       <screen>client# lctl get_param llite.*.stats
544 snapshot_time          1308343279.169704 secs.usecs
545 dirty_pages_hits       14819716 samples [regs]
546 dirty_pages_misses     81473472 samples [regs]
547 read_bytes             36502963 samples [bytes] 1 26843582 55488794
548 write_bytes            22985001 samples [bytes] 0 125912 3379002
549 brw_read               2279 samples [pages] 1 1 2270
550 ioctl                  186749 samples [regs]
551 open                   3304805 samples [regs]
552 close                  3331323 samples [regs]
553 seek                   48222475 samples [regs]
554 fsync                  963 samples [regs]
555 truncate               9073 samples [regs]
556 setxattr               19059 samples [regs]
557 getxattr               61169 samples [regs]
558 </screen>
559       <para> The statistics can be cleared by echoing an empty string into the
560           <literal>stats</literal> file or by using the command:
561         <screen>lctl set_param llite.*.stats=0</screen></para>
562       <para>The statistics displayed are described in the table below.</para>
563       <informaltable frame="all">
564         <tgroup cols="2">
565           <colspec colname="c1" colwidth="3*"/>
566           <colspec colname="c2" colwidth="7*"/>
567           <thead>
568             <row>
569               <entry>
570                 <para><emphasis role="bold">Entry</emphasis></para>
571               </entry>
572               <entry>
573                 <para><emphasis role="bold">Description</emphasis></para>
574               </entry>
575             </row>
576           </thead>
577           <tbody>
578             <row>
579               <entry>
580                 <para>
581                   <literal>snapshot_time</literal></para>
582               </entry>
583               <entry>
584                 <para>UNIX epoch instant the stats file was read.</para>
585               </entry>
586             </row>
587             <row>
588               <entry>
589                 <para>
590                   <literal>dirty_page_hits</literal></para>
591               </entry>
592               <entry>
593                 <para>The number of write operations that have been satisfied by the dirty page
594                   cache. See <xref xmlns:xlink="http://www.w3.org/1999/xlink"
595                     linkend="TuningClientIORPCStream"/> for more information about dirty cache
596                   behavior in a Lustre file system.</para>
597               </entry>
598             </row>
599             <row>
600               <entry>
601                 <para>
602                   <literal>dirty_page_misses</literal></para>
603               </entry>
604               <entry>
605                 <para>The number of write operations that were not satisfied by the dirty page
606                   cache.</para>
607               </entry>
608             </row>
609             <row>
610               <entry>
611                 <para>
612                   <literal>read_bytes</literal></para>
613               </entry>
614               <entry>
615                 <para>The number of read operations that have occurred. Three additional parameters
616                   are displayed:</para>
617                 <variablelist>
618                   <varlistentry>
619                     <term>min</term>
620                     <listitem>
621                       <para>The minimum number of bytes read in a single request since the counter
622                         was reset.</para>
623                     </listitem>
624                   </varlistentry>
625                   <varlistentry>
626                     <term>max</term>
627                     <listitem>
628                       <para>The maximum number of bytes read in a single request since the counter
629                         was reset.</para>
630                     </listitem>
631                   </varlistentry>
632                   <varlistentry>
633                     <term>sum</term>
634                     <listitem>
635                       <para>The accumulated sum of bytes of all read requests since the counter was
636                         reset.</para>
637                     </listitem>
638                   </varlistentry>
639                 </variablelist>
640               </entry>
641             </row>
642             <row>
643               <entry>
644                 <para>
645                   <literal>write_bytes</literal></para>
646               </entry>
647               <entry>
648                 <para>The number of write operations that have occurred. Three additional parameters
649                   are displayed:</para>
650                 <variablelist>
651                   <varlistentry>
652                     <term>min</term>
653                     <listitem>
654                       <para>The minimum number of bytes written in a single request since the
655                         counter was reset.</para>
656                     </listitem>
657                   </varlistentry>
658                   <varlistentry>
659                     <term>max</term>
660                     <listitem>
661                       <para>The maximum number of bytes written in a single request since the
662                         counter was reset.</para>
663                     </listitem>
664                   </varlistentry>
665                   <varlistentry>
666                     <term>sum</term>
667                     <listitem>
668                       <para>The accumulated sum of bytes of all write requests since the counter was
669                         reset.</para>
670                     </listitem>
671                   </varlistentry>
672                 </variablelist>
673               </entry>
674             </row>
675             <row>
676               <entry>
677                 <para>
678                   <literal>brw_read</literal></para>
679               </entry>
680               <entry>
681                 <para>The number of pages that have been read. Three additional parameters are
682                   displayed:</para>
683                 <variablelist>
684                   <varlistentry>
685                     <term>min</term>
686                     <listitem>
687                       <para>The minimum number of bytes read in a single block read/write
688                           (<literal>brw</literal>) read request since the counter was reset.</para>
689                     </listitem>
690                   </varlistentry>
691                   <varlistentry>
692                     <term>max</term>
693                     <listitem>
694                       <para>The maximum number of bytes read in a single <literal>brw</literal> read
695                         requests since the counter was reset.</para>
696                     </listitem>
697                   </varlistentry>
698                   <varlistentry>
699                     <term>sum</term>
700                     <listitem>
701                       <para>The accumulated sum of bytes of all <literal>brw</literal> read requests
702                         since the counter was reset.</para>
703                     </listitem>
704                   </varlistentry>
705                 </variablelist>
706               </entry>
707             </row>
708             <row>
709               <entry>
710                 <para>
711                   <literal>ioctl</literal></para>
712               </entry>
713               <entry>
714                 <para>The number of combined file and directory <literal>ioctl</literal>
715                   operations.</para>
716               </entry>
717             </row>
718             <row>
719               <entry>
720                 <para>
721                   <literal>open</literal></para>
722               </entry>
723               <entry>
724                 <para>The number of open operations that have succeeded.</para>
725               </entry>
726             </row>
727             <row>
728               <entry>
729                 <para>
730                   <literal>close</literal></para>
731               </entry>
732               <entry>
733                 <para>The number of close operations that have succeeded.</para>
734               </entry>
735             </row>
736             <row>
737               <entry>
738                 <para>
739                   <literal>seek</literal></para>
740               </entry>
741               <entry>
742                 <para>The number of times <literal>seek</literal> has been called.</para>
743               </entry>
744             </row>
745             <row>
746               <entry>
747                 <para>
748                   <literal>fsync</literal></para>
749               </entry>
750               <entry>
751                 <para>The number of times <literal>fsync</literal> has been called.</para>
752               </entry>
753             </row>
754             <row>
755               <entry>
756                 <para>
757                   <literal>truncate</literal></para>
758               </entry>
759               <entry>
760                 <para>The total number of calls to both locked and lockless
761                     <literal>truncate</literal>.</para>
762               </entry>
763             </row>
764             <row>
765               <entry>
766                 <para>
767                   <literal>setxattr</literal></para>
768               </entry>
769               <entry>
770                 <para>The number of times extended attributes have been set. </para>
771               </entry>
772             </row>
773             <row>
774               <entry>
775                 <para>
776                   <literal>getxattr</literal></para>
777               </entry>
778               <entry>
779                 <para>The number of times value(s) of extended attributes have been fetched.</para>
780               </entry>
781             </row>
782           </tbody>
783         </tgroup>
784       </informaltable>
785       <para><emphasis role="italic"><emphasis role="bold">Analysis:</emphasis></emphasis></para>
786       <para>Information is provided about the amount and type of I/O activity is taking place on the
787         client.</para>
788     </section>
789     <section remap="h3">
790       <title><indexterm>
791           <primary>proc</primary>
792           <secondary>read/write survey</secondary>
793         </indexterm>Monitoring Client Read-Write Offset Statistics</title>
794       <para>When the <literal>offset_stats</literal> parameter is set, statistics are maintained for
795         occurrences of a series of read or write calls from a process that did not access the next
796         sequential location. The <literal>OFFSET</literal> field is reset to 0 (zero) whenever a
797         different file is read or written.</para>
798       <note>
799         <para>By default, statistics are not collected in the <literal>offset_stats</literal>,
800             <literal>extents_stats</literal>, and <literal>extents_stats_per_process</literal> files
801           to reduce monitoring overhead when this information is not needed.  The collection of
802           statistics in all three of these files is activated by writing anything into any one of
803           the files.</para>
804       </note>
805       <para><emphasis role="italic"><emphasis role="bold">Example:</emphasis></emphasis></para>
806       <screen># lctl get_param llite.testfs-f57dee0.offset_stats
807 snapshot_time: 1155748884.591028 (secs.usecs)
808              RANGE   RANGE    SMALLEST   LARGEST   
809 R/W   PID    START   END      EXTENT     EXTENT    OFFSET
810 R     8385   0       128      128        128       0
811 R     8385   0       224      224        224       -128
812 W     8385   0       250      50         100       0
813 W     8385   100     1110     10         500       -150
814 W     8384   0       5233     5233       5233      0
815 R     8385   500     600      100        100       -610</screen>
816       <para>In this example, <literal>snapshot_time</literal> is the UNIX epoch instant the file was
817         read. The tabular data is described in the table below.</para>
818       <para>The <literal>offset_stats</literal> file can be cleared by
819         entering:<screen>lctl set_param llite.*.offset_stats=0</screen></para>
820       <informaltable frame="all">
821         <tgroup cols="2">
822           <colspec colname="c1" colwidth="50*"/>
823           <colspec colname="c2" colwidth="50*"/>
824           <thead>
825             <row>
826               <entry>
827                 <para><emphasis role="bold">Field</emphasis></para>
828               </entry>
829               <entry>
830                 <para><emphasis role="bold">Description</emphasis></para>
831               </entry>
832             </row>
833           </thead>
834           <tbody>
835             <row>
836               <entry>
837                 <para>R/W</para>
838               </entry>
839               <entry>
840                 <para>Indicates if the non-sequential call was a read or write</para>
841               </entry>
842             </row>
843             <row>
844               <entry>
845                 <para>PID </para>
846               </entry>
847               <entry>
848                 <para>Process ID of the process that made the read/write call.</para>
849               </entry>
850             </row>
851             <row>
852               <entry>
853                 <para>RANGE START/RANGE END</para>
854               </entry>
855               <entry>
856                 <para>Range in which the read/write calls were sequential.</para>
857               </entry>
858             </row>
859             <row>
860               <entry>
861                 <para>SMALLEST EXTENT </para>
862               </entry>
863               <entry>
864                 <para>Smallest single read/write in the corresponding range (in bytes).</para>
865               </entry>
866             </row>
867             <row>
868               <entry>
869                 <para>LARGEST EXTENT </para>
870               </entry>
871               <entry>
872                 <para>Largest single read/write in the corresponding range (in bytes).</para>
873               </entry>
874             </row>
875             <row>
876               <entry>
877                 <para>OFFSET </para>
878               </entry>
879               <entry>
880                 <para>Difference between the previous range end and the current range start.</para>
881               </entry>
882             </row>
883           </tbody>
884         </tgroup>
885       </informaltable>
886       <para><emphasis role="italic"><emphasis role="bold">Analysis:</emphasis></emphasis></para>
887       <para>This data provides an indication of how contiguous or fragmented the data is. For
888         example, the fourth entry in the example above shows the writes for this RPC were sequential
889         in the range 100 to 1110 with the minimum write 10 bytes and the maximum write 500 bytes.
890         The range started with an offset of -150 from the <literal>RANGE END</literal> of the
891         previous entry in the example.</para>
892     </section>
893     <section remap="h3">
894       <title><indexterm>
895           <primary>proc</primary>
896           <secondary>read/write survey</secondary>
897         </indexterm>Monitoring Client Read-Write Extent Statistics</title>
898       <para>For in-depth troubleshooting, client read-write extent statistics can be accessed to
899         obtain more detail about read/write I/O extents for the file system or for a particular
900         process.</para>
901       <note>
902         <para>By default, statistics are not collected in the <literal>offset_stats</literal>,
903             <literal>extents_stats</literal>, and <literal>extents_stats_per_process</literal> files
904           to reduce monitoring overhead when this information is not needed.  The collection of
905           statistics in all three of these files is activated by writing anything into any one of
906           the files.</para>
907       </note>
908       <section remap="h3">
909         <title>Client-Based I/O Extent Size Survey</title>
910         <para>The <literal>extent_stats</literal> histogram in the <literal>llite</literal>
911           directory shows the statistics for the sizes of the read/write I/O extents. This file does
912           not maintain the per-process statistics.</para>
913         <para><emphasis role="italic"><emphasis role="bold">Example:</emphasis></emphasis></para>
914         <screen># lctl get_param llite.testfs-*.extents_stats
915 snapshot_time:                     1213828728.348516 (secs.usecs)
916                        read           |            write
917 extents          calls  %      cum%   |     calls  %     cum%
918  
919 0K - 4K :        0      0      0      |     2      2     2
920 4K - 8K :        0      0      0      |     0      0     2
921 8K - 16K :       0      0      0      |     0      0     2
922 16K - 32K :      0      0      0      |     20     23    26
923 32K - 64K :      0      0      0      |     0      0     26
924 64K - 128K :     0      0      0      |     51     60    86
925 128K - 256K :    0      0      0      |     0      0     86
926 256K - 512K :    0      0      0      |     0      0     86
927 512K - 1024K :   0      0      0      |     0      0     86
928 1M - 2M :        0      0      0      |     11     13    100</screen>
929         <para>In this example, <literal>snapshot_time</literal> is the UNIX epoch instant the file
930           was read. The table shows cumulative extents organized according to size with statistics
931           provided separately for reads and writes. Each row in the table shows the number of RPCs
932           for reads and writes respectively (<literal>calls</literal>), the relative percentage of
933           total calls (<literal>%</literal>), and the cumulative percentage to that point in the
934           table of calls (<literal>cum %</literal>). </para>
935         <para> The file can be cleared by issuing the following
936           command:<screen># lctl set_param llite.testfs-*.extents_stats=0</screen></para>
937       </section>
938       <section>
939         <title>Per-Process Client I/O Statistics</title>
940         <para>The <literal>extents_stats_per_process</literal> file maintains the I/O extent size
941           statistics on a per-process basis.</para>
942         <para><emphasis role="italic"><emphasis role="bold">Example:</emphasis></emphasis></para>
943         <screen># lctl get_param llite.testfs-*.extents_stats_per_process
944 snapshot_time:                     1213828762.204440 (secs.usecs)
945                           read            |             write
946 extents            calls   %      cum%    |      calls   %       cum%
947  
948 PID: 11488
949    0K - 4K :       0       0       0      |      0       0       0
950    4K - 8K :       0       0       0      |      0       0       0
951    8K - 16K :      0       0       0      |      0       0       0
952    16K - 32K :     0       0       0      |      0       0       0
953    32K - 64K :     0       0       0      |      0       0       0
954    64K - 128K :    0       0       0      |      0       0       0
955    128K - 256K :   0       0       0      |      0       0       0
956    256K - 512K :   0       0       0      |      0       0       0
957    512K - 1024K :  0       0       0      |      0       0       0
958    1M - 2M :       0       0       0      |      10      100     100
959  
960 PID: 11491
961    0K - 4K :       0       0       0      |      0       0       0
962    4K - 8K :       0       0       0      |      0       0       0
963    8K - 16K :      0       0       0      |      0       0       0
964    16K - 32K :     0       0       0      |      20      100     100
965    
966 PID: 11424
967    0K - 4K :       0       0       0      |      0       0       0
968    4K - 8K :       0       0       0      |      0       0       0
969    8K - 16K :      0       0       0      |      0       0       0
970    16K - 32K :     0       0       0      |      0       0       0
971    32K - 64K :     0       0       0      |      0       0       0
972    64K - 128K :    0       0       0      |      16      100     100
973  
974 PID: 11426
975    0K - 4K :       0       0       0      |      1       100     100
976  
977 PID: 11429
978    0K - 4K :       0       0       0      |      1       100     100
979  
980 </screen>
981         <para>This table shows cumulative extents organized according to size for each process ID
982           (PID) with statistics provided separately for reads and writes. Each row in the table
983           shows the number of RPCs for reads and writes respectively (<literal>calls</literal>), the
984           relative percentage of total calls (<literal>%</literal>), and the cumulative percentage
985           to that point in the table of calls (<literal>cum %</literal>). </para>
986       </section>
987     </section>
988     <section xml:id="dbdoclet.50438271_55057">
989       <title><indexterm>
990           <primary>proc</primary>
991           <secondary>block I/O</secondary>
992         </indexterm>Monitoring the OST Block I/O Stream</title>
993       <para>The <literal>brw_stats</literal> file in the <literal>obdfilter</literal> directory
994         contains histogram data showing statistics for number of I/O requests sent to the disk,
995         their size, and whether they are contiguous on the disk or not.</para>
996       <para><emphasis role="italic"><emphasis role="bold">Example:</emphasis></emphasis></para>
997       <para>Enter on the OSS:</para>
998       <screen># lctl get_param obdfilter.testfs-OST0000.brw_stats 
999 snapshot_time:         1372775039.769045 (secs.usecs)
1000                            read      |      write
1001 pages per bulk r/w     rpcs  % cum % |  rpcs   % cum %
1002 1:                     108 100 100   |    39   0   0
1003 2:                       0   0 100   |     6   0   0
1004 4:                       0   0 100   |     1   0   0
1005 8:                       0   0 100   |     0   0   0
1006 16:                      0   0 100   |     4   0   0
1007 32:                      0   0 100   |    17   0   0
1008 64:                      0   0 100   |    12   0   0
1009 128:                     0   0 100   |    24   0   0
1010 256:                     0   0 100   | 23142  99 100
1011
1012                            read      |      write
1013 discontiguous pages    rpcs  % cum % |  rpcs   % cum %
1014 0:                     108 100 100   | 23245 100 100
1015
1016                            read      |      write
1017 discontiguous blocks   rpcs  % cum % |  rpcs   % cum %
1018 0:                     108 100 100   | 23243  99  99
1019 1:                       0   0 100   |     2   0 100
1020
1021                            read      |      write
1022 disk fragmented I/Os   ios   % cum % |   ios   % cum %
1023 0:                      94  87  87   |     0   0   0
1024 1:                      14  12 100   | 23243  99  99
1025 2:                       0   0 100   |     2   0 100
1026
1027                            read      |      write
1028 disk I/Os in flight    ios   % cum % |   ios   % cum %
1029 1:                      14 100 100   | 20896  89  89
1030 2:                       0   0 100   |  1071   4  94
1031 3:                       0   0 100   |   573   2  96
1032 4:                       0   0 100   |   300   1  98
1033 5:                       0   0 100   |   166   0  98
1034 6:                       0   0 100   |   108   0  99
1035 7:                       0   0 100   |    81   0  99
1036 8:                       0   0 100   |    47   0  99
1037 9:                       0   0 100   |     5   0 100
1038
1039                            read      |      write
1040 I/O time (1/1000s)     ios   % cum % |   ios   % cum %
1041 1:                      94  87  87   |     0   0   0
1042 2:                       0   0  87   |     7   0   0
1043 4:                      14  12 100   |    27   0   0
1044 8:                       0   0 100   |    14   0   0
1045 16:                      0   0 100   |    31   0   0
1046 32:                      0   0 100   |    38   0   0
1047 64:                      0   0 100   | 18979  81  82
1048 128:                     0   0 100   |   943   4  86
1049 256:                     0   0 100   |  1233   5  91
1050 512:                     0   0 100   |  1825   7  99
1051 1K:                      0   0 100   |   99   0  99
1052 2K:                      0   0 100   |     0   0  99
1053 4K:                      0   0 100   |     0   0  99
1054 8K:                      0   0 100   |    49   0 100
1055
1056                            read      |      write
1057 disk I/O size          ios   % cum % |   ios   % cum %
1058 4K:                     14 100 100   |    41   0   0
1059 8K:                      0   0 100   |     6   0   0
1060 16K:                     0   0 100   |     1   0   0
1061 32K:                     0   0 100   |     0   0   0
1062 64K:                     0   0 100   |     4   0   0
1063 128K:                    0   0 100   |    17   0   0
1064 256K:                    0   0 100   |    12   0   0
1065 512K:                    0   0 100   |    24   0   0
1066 1M:                      0   0 100   | 23142  99 100
1067 </screen>
1068       <para>The tabular data is described in the table below. Each row in the table shows the number
1069         of reads and writes occurring for the statistic (<literal>ios</literal>), the relative
1070         percentage of total reads or writes (<literal>%</literal>), and the cumulative percentage to
1071         that point in the table for the statistic (<literal>cum %</literal>). </para>
1072       <informaltable frame="all">
1073         <tgroup cols="2">
1074           <colspec colname="c1" colwidth="40*"/>
1075           <colspec colname="c2" colwidth="60*"/>
1076           <thead>
1077             <row>
1078               <entry>
1079                 <para><emphasis role="bold">Field</emphasis></para>
1080               </entry>
1081               <entry>
1082                 <para><emphasis role="bold">Description</emphasis></para>
1083               </entry>
1084             </row>
1085           </thead>
1086           <tbody>
1087             <row>
1088               <entry>
1089                 <para>
1090                   <literal>pages per bulk r/w</literal></para>
1091               </entry>
1092               <entry>
1093                 <para>Number of pages per RPC request, which should match aggregate client
1094                     <literal>rpc_stats</literal> (see <xref
1095                     xmlns:xlink="http://www.w3.org/1999/xlink" linkend="MonitoringClientRCPStream"
1096                   />).</para>
1097               </entry>
1098             </row>
1099             <row>
1100               <entry>
1101                 <para>
1102                   <literal>discontiguous pages</literal></para>
1103               </entry>
1104               <entry>
1105                 <para>Number of discontinuities in the logical file offset of each page in a single
1106                   RPC.</para>
1107               </entry>
1108             </row>
1109             <row>
1110               <entry>
1111                 <para>
1112                   <literal>discontiguous blocks</literal></para>
1113               </entry>
1114               <entry>
1115                 <para>Number of discontinuities in the physical block allocation in the file system
1116                   for a single RPC.</para>
1117               </entry>
1118             </row>
1119             <row>
1120               <entry>
1121                 <para><literal>disk fragmented I/Os</literal></para>
1122               </entry>
1123               <entry>
1124                 <para>Number of I/Os that were not written entirely sequentially.</para>
1125               </entry>
1126             </row>
1127             <row>
1128               <entry>
1129                 <para><literal>disk I/Os in flight</literal></para>
1130               </entry>
1131               <entry>
1132                 <para>Number of disk I/Os currently pending.</para>
1133               </entry>
1134             </row>
1135             <row>
1136               <entry>
1137                 <para><literal>I/O time (1/1000s)</literal></para>
1138               </entry>
1139               <entry>
1140                 <para>Amount of time for each I/O operation to complete.</para>
1141               </entry>
1142             </row>
1143             <row>
1144               <entry>
1145                 <para><literal>disk I/O size</literal></para>
1146               </entry>
1147               <entry>
1148                 <para>Size of each I/O operation.</para>
1149               </entry>
1150             </row>
1151           </tbody>
1152         </tgroup>
1153       </informaltable>
1154       <para><emphasis role="italic"><emphasis role="bold">Analysis:</emphasis></emphasis></para>
1155       <para>This data provides an indication of extent size and distribution in the file
1156         system.</para>
1157     </section>
1158   </section>
1159   <section>
1160     <title>Tuning Lustre File System I/O</title>
1161     <para>Each OSC has its own tree of  tunables. For example:</para>
1162     <screen>$ ls -d /proc/fs/testfs/osc/OSC_client_ost1_MNT_client_2 /localhost
1163 /proc/fs/testfs/osc/OSC_uml0_ost1_MNT_localhost
1164 /proc/fs/testfs/osc/OSC_uml0_ost2_MNT_localhost
1165 /proc/fs/testfs/osc/OSC_uml0_ost3_MNT_localhost
1166
1167 $ ls /proc/fs/testfs/osc/OSC_uml0_ost1_MNT_localhost
1168 blocksizefilesfree max_dirty_mb ost_server_uuid stats
1169
1170 ...</screen>
1171     <para>The following sections describe some of the parameters that can be tuned in a Lustre file
1172       system.</para>
1173     <section remap="h3" xml:id="TuningClientIORPCStream">
1174       <title><indexterm>
1175           <primary>proc</primary>
1176           <secondary>RPC tunables</secondary>
1177         </indexterm>Tuning the Client I/O RPC Stream</title>
1178       <para>Ideally, an optimal amount of data is packed into each I/O RPC and a consistent number
1179         of issued RPCs are in progress at any time. To help optimize the client I/O RPC stream,
1180         several tuning variables are provided to adjust behavior according to network conditions and
1181         cluster size. For information about monitoring the client I/O RPC stream, see <xref
1182           xmlns:xlink="http://www.w3.org/1999/xlink" linkend="MonitoringClientRCPStream"/>.</para>
1183       <para>RPC stream tunables include:</para>
1184       <para>
1185         <itemizedlist>
1186           <listitem>
1187             <para><literal>osc.<replaceable>osc_instance</replaceable>.max_dirty_mb</literal> -
1188               Controls how many MBs of dirty data can be written and queued up in the OSC. POSIX
1189               file writes that are cached contribute to this count. When the limit is reached,
1190               additional writes stall until previously-cached writes are written to the server. This
1191               may be changed by writing a single ASCII integer to the file. Only values between 0
1192               and 2048 or 1/4 of RAM are allowable. If 0 is specified, no writes are cached.
1193               Performance suffers noticeably unless you use large writes (1 MB or more).</para>
1194             <para>To maximize performance, the value for <literal>max_dirty_mb</literal> is
1195               recommended to be 4 * <literal>max_pages_per_rpc </literal>*
1196                 <literal>max_rpcs_in_flight</literal>.</para>
1197           </listitem>
1198           <listitem>
1199             <para><literal>osc.<replaceable>osc_instance</replaceable>.cur_dirty_bytes</literal> - A
1200               read-only value that returns the current number of bytes written and cached on this
1201               OSC.</para>
1202           </listitem>
1203           <listitem>
1204             <para><literal>osc.<replaceable>osc_instance</replaceable>.max_pages_per_rpc</literal> -
1205               The maximum number of pages that will undergo I/O in a single RPC to the OST. The
1206               minimum setting is a single page and the maximum setting is 1024 (for systems with a
1207                 <literal>PAGE_SIZE</literal> of 4 KB), with the default maximum of 1 MB in the RPC.
1208               It is also possible to specify a units suffix (e.g. <literal>4M</literal>), so that
1209               the RPC size can be specified independently of the client
1210               <literal>PAGE_SIZE</literal>.</para>
1211           </listitem>
1212           <listitem>
1213             <para><literal>osc.<replaceable>osc_instance</replaceable>.max_rpcs_in_flight</literal>
1214               - The maximum number of concurrent RPCs in flight from an OSC to its OST. If the OSC
1215               tries to initiate an RPC but finds that it already has the same number of RPCs
1216               outstanding, it will wait to issue further RPCs until some complete. The minimum
1217               setting is 1 and maximum setting is 256. </para>
1218             <para>To improve small file I/O performance, increase the
1219                 <literal>max_rpcs_in_flight</literal> value.</para>
1220           </listitem>
1221           <listitem>
1222             <para><literal>llite.<replaceable>fsname-instance</replaceable>/max_cache_mb</literal> -
1223               Maximum amount of inactive data cached by the client (default is 3/4 of RAM).  For
1224               example:</para>
1225             <screen># lctl get_param llite.testfs-ce63ca00.max_cached_mb
1226 128</screen>
1227           </listitem>
1228         </itemizedlist>
1229       </para>
1230       <note>
1231         <para>The value for <literal><replaceable>osc_instance</replaceable></literal> is typically
1232               <literal><replaceable>fsname</replaceable>-OST<replaceable>ost_index</replaceable>-osc-<replaceable>mountpoint_instance</replaceable></literal>,
1233           where the value for <literal><replaceable>mountpoint_instance</replaceable></literal> is
1234           unique to each mount point to allow associating osc, mdc, lov, lmv, and llite parameters
1235           with the same mount point. For
1236           example:<screen>lctl get_param osc.testfs-OST0000-osc-ffff88107412f400.rpc_stats
1237 osc.testfs-OST0000-osc-ffff88107412f400.rpc_stats=
1238 snapshot_time:         1375743284.337839 (secs.usecs)
1239 read RPCs in flight:  0
1240 write RPCs in flight: 0
1241 </screen></para>
1242       </note>
1243     </section>
1244     <section remap="h3">
1245       <title><indexterm>
1246           <primary>proc</primary>
1247           <secondary>readahead</secondary>
1248         </indexterm>Tuning File Readahead and Directory Statahead</title>
1249       <para>File readahead and directory statahead enable reading of data into memory before a
1250         process requests the data. File readahead reads file content data into memory and directory
1251         statahead reads metadata into memory. When readahead and statahead work well, a process that
1252         accesses data finds that the information it needs is available immediately when requested in
1253         memory without the delay of network I/O.</para>
1254       <para condition="l22">In Lustre software release 2.2.0, the directory statahead feature was
1255         improved to enhance directory traversal performance. The improvements primarily addressed
1256         two issues: <orderedlist>
1257           <listitem>
1258             <para>A race condition existed between the statahead thread and other VFS operations
1259               while processing asynchronous <literal>getattr</literal> RPC replies, causing
1260               duplicate entries in dcache. This issue was resolved by using statahead local dcache.
1261             </para>
1262           </listitem>
1263           <listitem>
1264             <para>File size/block attributes pre-fetching was not supported, so the traversing
1265               thread had to send synchronous glimpse size RPCs to OST(s). This issue was resolved by
1266               using asynchronous glimpse lock (AGL) RPCs to pre-fetch file size/block attributes
1267               from OST(s).</para>
1268           </listitem>
1269         </orderedlist>
1270       </para>
1271       <section remap="h4">
1272         <title>Tuning File Readahead</title>
1273         <para>File readahead is triggered when two or more sequential reads by an application fail
1274           to be satisfied by data in the Linux buffer cache. The size of the initial readahead is 1
1275           MB. Additional readaheads grow linearly and increment until the readahead cache on the
1276           client is full at 40 MB.</para>
1277         <para>Readahead tunables include:</para>
1278         <itemizedlist>
1279           <listitem>
1280             <para><literal>llite.<replaceable>fsname-instance</replaceable>.max_read_ahead_mb</literal>
1281               - Controls the maximum amount of data readahead on a file. Files are read ahead in
1282               RPC-sized chunks (1 MB or the size of the <literal>read()</literal> call, if larger)
1283               after the second sequential read on a file descriptor. Random reads are done at the
1284               size of the <literal>read()</literal> call only (no readahead). Reads to
1285               non-contiguous regions of the file reset the readahead algorithm, and readahead is not
1286               triggered again until sequential reads take place again. </para>
1287             <para>To disable readahead, set this tunable to 0. The default value is 40 MB.</para>
1288           </listitem>
1289           <listitem>
1290             <para><literal>llite.<replaceable>fsname-instance</replaceable>.max_read_ahead_whole_mb</literal>
1291               - Controls the maximum size of a file that is read in its entirety, regardless of the
1292               size of the <literal>read()</literal>.</para>
1293           </listitem>
1294         </itemizedlist>
1295       </section>
1296       <section>
1297         <title>Tuning Directory Statahead and AGL</title>
1298         <para>Many system commands, such as <literal>ls â€“l</literal>, <literal>du</literal>, and
1299             <literal>find</literal>, traverse a directory sequentially. To make these commands run
1300           efficiently, the directory statahead and asynchronous glimpse lock (AGL) can be enabled to
1301           improve the performance of traversing.</para>
1302         <para>The statahead tunables are:</para>
1303         <itemizedlist>
1304           <listitem>
1305             <para><literal>statahead_max</literal> - Controls whether directory statahead is enabled
1306               and the maximum statahead window size (i.e., how many files can be pre-fetched by the
1307               statahead thread). By default, statahead is enabled and the value of
1308                 <literal>statahead_max</literal> is 32.</para>
1309             <para>To disable statahead, run:</para>
1310             <screen>lctl set_param llite.*.statahead_max=0</screen>
1311             <para>To set the maximum statahead window size (<replaceable>n</replaceable>),
1312               run:</para>
1313             <screen>lctl set_param llite.*.statahead_max=<replaceable>n</replaceable></screen>
1314             <para>The maximum value of <replaceable>n</replaceable> is 8192.</para>
1315             <para>The AGL can be controlled by entering:</para>
1316             <screen>lctl set_param llite.*.statahead_agl=<replaceable>n</replaceable></screen>
1317             <para>The default value for <replaceable>n</replaceable> is 1, which enables the AGL. If
1318                 <replaceable>n</replaceable> is 0, the AGL is disabled.</para>
1319           </listitem>
1320           <listitem>
1321             <para><literal>statahead_stats</literal> - A read-only interface that indicates the
1322               current statahead and AGL statistics, such as how many times statahead/AGL has been
1323               triggered since the last mount, how many statahead/AGL failures have occurred due to
1324               an incorrect prediction or other causes.</para>
1325             <note>
1326               <para>The AGL is affected by statahead because the inodes processed by AGL are built
1327                 by the statahead thread, which means the statahead thread is the input of the AGL
1328                 pipeline. So if statahead is disabled, then the AGL is disabled by force.</para>
1329             </note>
1330           </listitem>
1331         </itemizedlist>
1332       </section>
1333     </section>
1334     <section remap="h3">
1335       <title><indexterm>
1336           <primary>proc</primary>
1337           <secondary>read cache</secondary>
1338         </indexterm>Tuning OSS Read Cache</title>
1339       <para>The OSS read cache feature provides read-only caching of data on an OSS. This
1340         functionality uses the Linux page cache to store the data and uses as much physical memory
1341         as is allocated.</para>
1342       <para>OSS read cache improves Lustre file system performance in these situations:</para>
1343       <itemizedlist>
1344         <listitem>
1345           <para>Many clients are accessing the same data set (as in HPC applications or when
1346             diskless clients boot from the Lustre file system).</para>
1347         </listitem>
1348         <listitem>
1349           <para>One client is storing data while another client is reading it (i.e., clients are
1350             exchanging data via the OST).</para>
1351         </listitem>
1352         <listitem>
1353           <para>A client has very limited caching of its own.</para>
1354         </listitem>
1355       </itemizedlist>
1356       <para>OSS read cache offers these benefits:</para>
1357       <itemizedlist>
1358         <listitem>
1359           <para>Allows OSTs to cache read data more frequently.</para>
1360         </listitem>
1361         <listitem>
1362           <para>Improves repeated reads to match network speeds instead of disk speeds.</para>
1363         </listitem>
1364         <listitem>
1365           <para>Provides the building blocks for OST write cache (small-write aggregation).</para>
1366         </listitem>
1367       </itemizedlist>
1368       <section remap="h4">
1369         <title>Using OSS Read Cache</title>
1370         <para>OSS read cache is implemented on the OSS, and does not require any special support on
1371           the client side. Since OSS read cache uses the memory available in the Linux page cache,
1372           the appropriate amount of memory for the cache should be determined based on I/O patterns;
1373           if the data is mostly reads, then more cache is required than would be needed for mostly
1374           writes.</para>
1375         <para>OSS read cache is managed using the following tunables:</para>
1376         <itemizedlist>
1377           <listitem>
1378             <para><literal>read_cache_enable</literal> - Controls whether data read from disk during
1379               a read request is kept in memory and available for later read requests for the same
1380               data, without having to re-read it from disk. By default, read cache is enabled
1381                 (<literal>read_cache_enable=1</literal>).</para>
1382             <para>When the OSS receives a read request from a client, it reads data from disk into
1383               its memory and sends the data as a reply to the request. If read cache is enabled,
1384               this data stays in memory after the request from the client has been fulfilled. When
1385               subsequent read requests for the same data are received, the OSS skips reading data
1386               from disk and the request is fulfilled from the cached data. The read cache is managed
1387               by the Linux kernel globally across all OSTs on that OSS so that the least recently
1388               used cache pages are dropped from memory when the amount of free memory is running
1389               low.</para>
1390             <para>If read cache is disabled (<literal>read_cache_enable=0</literal>), the OSS
1391               discards the data after a read request from the client is serviced and, for subsequent
1392               read requests, the OSS again reads the data from disk.</para>
1393             <para>To disable read cache on all the OSTs of an OSS, run:</para>
1394             <screen>root@oss1# lctl set_param obdfilter.*.read_cache_enable=0</screen>
1395             <para>To re-enable read cache on one OST, run:</para>
1396             <screen>root@oss1# lctl set_param obdfilter.{OST_name}.read_cache_enable=1</screen>
1397             <para>To check if read cache is enabled on all OSTs on an OSS, run:</para>
1398             <screen>root@oss1# lctl get_param obdfilter.*.read_cache_enable</screen>
1399           </listitem>
1400           <listitem>
1401             <para><literal>writethrough_cache_enable</literal> - Controls whether data sent to the
1402               OSS as a write request is kept in the read cache and available for later reads, or if
1403               it is discarded from cache when the write is completed. By default, the writethrough
1404               cache is enabled (<literal>writethrough_cache_enable=1</literal>).</para>
1405             <para>When the OSS receives write requests from a client, it receives data from the
1406               client into its memory and writes the data to disk. If the writethrough cache is
1407               enabled, this data stays in memory after the write request is completed, allowing the
1408               OSS to skip reading this data from disk if a later read request, or partial-page write
1409               request, for the same data is received.</para>
1410             <para>If the writethrough cache is disabled
1411                 (<literal>writethrough_cache_enabled=0</literal>), the OSS discards the data after
1412               the write request from the client is completed. For subsequent read requests, or
1413               partial-page write requests, the OSS must re-read the data from disk.</para>
1414             <para>Enabling writethrough cache is advisable if clients are doing small or unaligned
1415               writes that would cause partial-page updates, or if the files written by one node are
1416               immediately being accessed by other nodes. Some examples where enabling writethrough
1417               cache might be useful include producer-consumer I/O models or shared-file writes with
1418               a different node doing I/O not aligned on 4096-byte boundaries. </para>
1419             <para>Disabling the writethrough cache is advisable when files are mostly written to the
1420               file system but are not re-read within a short time period, or files are only written
1421               and re-read by the same node, regardless of whether the I/O is aligned or not.</para>
1422             <para>To disable the writethrough cache on all OSTs of an OSS, run:</para>
1423             <screen>root@oss1# lctl set_param obdfilter.*.writethrough_cache_enable=0</screen>
1424             <para>To re-enable the writethrough cache on one OST, run:</para>
1425             <screen>root@oss1# lctl set_param obdfilter.{OST_name}.writethrough_cache_enable=1</screen>
1426             <para>To check if the writethrough cache is enabled, run:</para>
1427             <screen>root@oss1# lctl get_param obdfilter.*.writethrough_cache_enable</screen>
1428           </listitem>
1429           <listitem>
1430             <para><literal>readcache_max_filesize</literal> - Controls the maximum size of a file
1431               that both the read cache and writethrough cache will try to keep in memory. Files
1432               larger than <literal>readcache_max_filesize</literal> will not be kept in cache for
1433               either reads or writes.</para>
1434             <para>Setting this tunable can be useful for workloads where relatively small files are
1435               repeatedly accessed by many clients, such as job startup files, executables, log
1436               files, etc., but large files are read or written only once. By not putting the larger
1437               files into the cache, it is much more likely that more of the smaller files will
1438               remain in cache for a longer time.</para>
1439             <para>When setting <literal>readcache_max_filesize</literal>, the input value can be
1440               specified in bytes, or can have a suffix to indicate other binary units such as
1441                 <literal>K</literal> (kilobytes), <literal>M</literal> (megabytes),
1442                 <literal>G</literal> (gigabytes), <literal>T</literal> (terabytes), or
1443                 <literal>P</literal> (petabytes).</para>
1444             <para>To limit the maximum cached file size to 32 MB on all OSTs of an OSS, run:</para>
1445             <screen>root@oss1# lctl set_param obdfilter.*.readcache_max_filesize=32M</screen>
1446             <para>To disable the maximum cached file size on an OST, run:</para>
1447             <screen>root@oss1# lctl set_param obdfilter.{OST_name}.readcache_max_filesize=-1</screen>
1448             <para>To check the current maximum cached file size on all OSTs of an OSS, run:</para>
1449             <screen>root@oss1# lctl get_param obdfilter.*.readcache_max_filesize</screen>
1450           </listitem>
1451         </itemizedlist>
1452       </section>
1453     </section>
1454     <section>
1455       <title><indexterm>
1456           <primary>proc</primary>
1457           <secondary>OSS journal</secondary>
1458         </indexterm>Enabling OSS Asynchronous Journal Commit</title>
1459       <para>The OSS asynchronous journal commit feature asynchronously writes data to disk without
1460         forcing a journal flush. This reduces the number of seeks and significantly improves
1461         performance on some hardware.</para>
1462       <note>
1463         <para>Asynchronous journal commit cannot work with direct I/O-originated writes
1464             (<literal>O_DIRECT</literal> flag set). In this case, a journal flush is forced. </para>
1465       </note>
1466       <para>When the asynchronous journal commit feature is enabled, client nodes keep data in the
1467         page cache (a page reference). Lustre clients monitor the last committed transaction number
1468           (<literal>transno</literal>) in messages sent from the OSS to the clients. When a client
1469         sees that the last committed <literal>transno</literal> reported by the OSS is at least
1470         equal to the bulk write <literal>transno</literal>, it releases the reference on the
1471         corresponding pages. To avoid page references being held for too long on clients after a
1472         bulk write, a 7 second ping request is scheduled (the default OSS file system commit time
1473         interval is 5 seconds) after the bulk write reply is received, so the OSS has an opportunity
1474         to report the last committed <literal>transno</literal>.</para>
1475       <para>If the OSS crashes before the journal commit occurs, then intermediate data is lost.
1476         However, OSS recovery functionality incorporated into the asynchronous journal commit
1477         feature causes clients to replay their write requests and compensate for the missing disk
1478         updates by restoring the state of the file system.</para>
1479       <para>By default, <literal>sync_journal</literal> is enabled
1480           (<literal>sync_journal=1</literal>), so that journal entries are committed synchronously.
1481         To enable asynchronous journal commit, set the <literal>sync_journal</literal> parameter to
1482           <literal>0</literal> by entering: </para>
1483       <screen>$ lctl set_param obdfilter.*.sync_journal=0 
1484 obdfilter.lol-OST0001.sync_journal=0</screen>
1485       <para>An associated <literal>sync-on-lock-cancel</literal> feature (enabled by default)
1486         addresses a data consistency issue that can result if an OSS crashes after multiple clients
1487         have written data into intersecting regions of an object, and then one of the clients also
1488         crashes. A condition is created in which the POSIX requirement for continuous writes is
1489         violated along with a potential for corrupted data. With
1490           <literal>sync-on-lock-cancel</literal> enabled, if a cancelled lock has any volatile
1491         writes attached to it, the OSS synchronously writes the journal to disk on lock
1492         cancellation. Disabling the <literal>sync-on-lock-cancel</literal> feature may enhance
1493         performance for concurrent write workloads, but it is recommended that you not disable this
1494         feature.</para>
1495       <para> The <literal>sync_on_lock_cancel</literal> parameter can be set to the following
1496         values:</para>
1497       <itemizedlist>
1498         <listitem>
1499           <para><literal>always</literal> - Always force a journal flush on lock cancellation
1500             (default when <literal>async_journal</literal> is enabled).</para>
1501         </listitem>
1502         <listitem>
1503           <para><literal>blocking</literal> - Force a journal flush only when the local cancellation
1504             is due to a blocking callback.</para>
1505         </listitem>
1506         <listitem>
1507           <para><literal>never</literal> - Do not force any journal flush (default when
1508               <literal>async_journal</literal> is disabled).</para>
1509         </listitem>
1510       </itemizedlist>
1511       <para>For example, to set <literal>sync_on_lock_cancel</literal> to not to force a journal
1512         flush, use a command similar to:</para>
1513       <screen>$ lctl get_param obdfilter.*.sync_on_lock_cancel
1514 obdfilter.lol-OST0001.sync_on_lock_cancel=never</screen>
1515     </section>
1516     <section xml:id="dbdoclet.TuningModRPCs" condition='l28'>
1517       <title>
1518         <indexterm>
1519           <primary>proc</primary>
1520           <secondary>client metadata performance</secondary>
1521         </indexterm>
1522         Tuning the Client Metadata RPC Stream
1523       </title>
1524       <para>The client metadata RPC stream represents the metadata RPCs issued
1525         in parallel by a client to a MDT target. The metadata RPCs can be split
1526         in two categories: the requests that do not modify the file system
1527         (like getattr operation), and the requests that do modify the file system
1528         (like create, unlink, setattr operations). To help optimize the client
1529         metadata RPC stream, several tuning variables are provided to adjust
1530         behavior according to network conditions and cluster size.</para>
1531       <para>Note that increasing the number of metadata RPCs issued in parallel
1532         might improve the performance metadata intensive parallel applications,
1533         but as a consequence it will consume more memory on the client and on
1534         the MDS.</para>
1535       <section>
1536         <title>Configuring the Client Metadata RPC Stream</title>
1537         <para>The MDC <literal>max_rpcs_in_flight</literal> parameter defines
1538           the maximum number of metadata RPCs, both modifying and
1539           non-modifying RPCs, that can be sent in parallel by a client to a MDT
1540           target. This includes every file system metadata operations, such as
1541           file or directory stat, creation, unlink. The default setting is 8,
1542           minimum setting is 1 and maximum setting is 256.</para>
1543         <para>To set the <literal>max_rpcs_in_flight</literal> parameter, run
1544           the following command on the Lustre client:</para>
1545         <screen>client$ lctl set_param mdc.*.max_rcps_in_flight=16</screen>
1546         <para>The MDC <literal>max_mod_rpcs_in_flight</literal> parameter
1547           defines the maximum number of file system modifying RPCs that can be
1548           sent in parallel by a client to a MDT target. For example, the Lustre
1549           client sends modify RPCs when it performs file or directory creation,
1550           unlink, access permission modification or ownership modification. The
1551           default setting is 7, minimum setting is 1 and maximum setting is
1552           256.</para>
1553         <para>To set the <literal>max_mod_rpcs_in_flight</literal> parameter,
1554           run the following command on the Lustre client:</para>
1555         <screen>client$ lctl set_param mdc.*.max_mod_rcps_in_flight=12</screen>
1556         <para>The <literal>max_mod_rpcs_in_flight</literal> value must be
1557           strictly less than the <literal>max_rpcs_in_flight</literal> value.
1558           It must also be less or equal to the MDT
1559           <literal>max_mod_rpcs_per_client</literal> value. If one of theses
1560           conditions is not enforced, the setting fails and an explicit message
1561           is written in the Lustre log.</para>
1562         <para>The MDT <literal>max_mod_rpcs_per_client</literal> parameter is a
1563           tunable of the kernel module <literal>mdt</literal> that defines the
1564           maximum number of file system modifying RPCs in flight allowed per
1565           client. The parameter can be updated at runtime, but the change is
1566           effective to new client connections only. The default setting is 8.
1567         </para>
1568         <para>To set the <literal>max_mod_rpcs_per_client</literal> parameter,
1569           run the following command on the MDS:</para>
1570         <screen>mds$ echo 12 > /sys/module/mdt/parameters/max_mod_rpcs_per_client</screen>
1571       </section>
1572       <section>
1573         <title>Monitoring the Client Metadata RPC Stream</title>
1574         <para>The <literal>rpc_stats</literal> file contains histogram data
1575           showing information about modify metadata RPCs. It can be helpful to
1576           identify the level of parallelism achieved by an application doing
1577           modify metadata operations.</para>
1578         <para><emphasis role="bold">Example:</emphasis></para>
1579         <screen>client$ lctl get_param mdc.*.rpc_stats
1580 snapshot_time:         1441876896.567070 (secs.usecs)
1581 modify_RPCs_in_flight:  0
1582
1583                         modify
1584 rpcs in flight        rpcs   % cum %
1585 0:                       0   0   0
1586 1:                      56   0   0
1587 2:                      40   0   0
1588 3:                      70   0   0
1589 4                       41   0   0
1590 5:                      51   0   1
1591 6:                      88   0   1
1592 7:                     366   1   2
1593 8:                    1321   5   8
1594 9:                    3624  15  23
1595 10:                   6482  27  50
1596 11:                   7321  30  81
1597 12:                   4540  18 100</screen>
1598         <para>The file information includes:</para>
1599         <itemizedlist>
1600           <listitem>
1601             <para><literal>snapshot_time</literal> - UNIX epoch instant the
1602               file was read.</para>
1603           </listitem>
1604           <listitem>
1605             <para><literal>modify_RPCs_in_flight</literal> - Number of modify
1606               RPCs issued by the MDC, but not completed at the time of the
1607               snapshot. This value should always be less than or equal to
1608               <literal>max_mod_rpcs_in_flight</literal>.</para>
1609           </listitem>
1610           <listitem>
1611             <para><literal>rpcs in flight</literal> - Number of modify RPCs
1612               that are pending when a RPC is sent, the relative percentage
1613               (<literal>%</literal>) of total modify RPCs, and the cumulative
1614               percentage (<literal>cum %</literal>) to that point.</para>
1615           </listitem>
1616         </itemizedlist>
1617         <para>If a large proportion of modify metadata RPCs are issued with a
1618           number of pending metadata RPCs close to the
1619           <literal>max_mod_rpcs_in_flight</literal> value, it means the
1620           <literal>max_mod_rpcs_in_flight</literal> value could be increased to
1621           improve the modify metadata performance.</para>
1622       </section>
1623     </section>
1624   </section>
1625   <section>
1626     <title>Configuring Timeouts in a Lustre File System</title>
1627     <para>In a Lustre file system, RPC timeouts are set using an adaptive timeouts mechanism, which
1628       is enabled by default. Servers track RPC completion times and then report back to clients
1629       estimates for completion times for future RPCs. Clients  use these estimates to set RPC
1630       timeout values. If the processing of server requests slows down for any reason, the server
1631       estimates for RPC completion increase, and clients then revise RPC timeout values to allow
1632       more time for RPC completion.</para>
1633     <para>If the RPCs queued on the server approach the RPC timeout specified by the client, to
1634       avoid RPC timeouts and disconnect/reconnect cycles, the server sends an "early reply" to the
1635       client, telling the client to allow more time. Conversely, as server processing speeds up, RPC
1636       timeout values decrease, resulting in faster detection if the server becomes non-responsive
1637       and quicker connection to the failover partner of the server.</para>
1638     <section>
1639       <title><indexterm>
1640           <primary>proc</primary>
1641           <secondary>configuring adaptive timeouts</secondary>
1642         </indexterm><indexterm>
1643           <primary>configuring</primary>
1644           <secondary>adaptive timeouts</secondary>
1645         </indexterm><indexterm>
1646           <primary>proc</primary>
1647           <secondary>adaptive timeouts</secondary>
1648         </indexterm>Configuring Adaptive Timeouts</title>
1649       <para>The adaptive timeout parameters in the table below can be set persistently system-wide
1650         using <literal>lctl conf_param</literal> on the MGS. For example, the following command sets
1651         the <literal>at_max</literal> value  for all servers and clients associated with the file
1652         system
1653         <literal>testfs</literal>:<screen>lctl conf_param testfs.sys.at_max=1500</screen></para>
1654       <note>
1655         <para>Clients that access multiple Lustre file systems must use the same parameter values
1656           for all file systems.</para>
1657       </note>
1658       <informaltable frame="all">
1659         <tgroup cols="2">
1660           <colspec colname="c1" colwidth="30*"/>
1661           <colspec colname="c2" colwidth="80*"/>
1662           <thead>
1663             <row>
1664               <entry>
1665                 <para><emphasis role="bold">Parameter</emphasis></para>
1666               </entry>
1667               <entry>
1668                 <para><emphasis role="bold">Description</emphasis></para>
1669               </entry>
1670             </row>
1671           </thead>
1672           <tbody>
1673             <row>
1674               <entry>
1675                 <para>
1676                   <literal> at_min </literal></para>
1677               </entry>
1678               <entry>
1679                 <para>Minimum adaptive timeout (in seconds). The default value is 0. The
1680                     <literal>at_min</literal> parameter is the minimum processing time that a server
1681                   will report. Ideally, <literal>at_min</literal> should be set to its default
1682                   value. Clients base their timeouts on this value, but they do not use this value
1683                   directly. </para>
1684                 <para>If, for unknown reasons (usually due to temporary network outages), the
1685                   adaptive timeout value is too short and clients time out their RPCs, you can
1686                   increase the <literal>at_min</literal> value to compensate for this.</para>
1687               </entry>
1688             </row>
1689             <row>
1690               <entry>
1691                 <para>
1692                   <literal> at_max </literal></para>
1693               </entry>
1694               <entry>
1695                 <para>Maximum adaptive timeout (in seconds). The <literal>at_max</literal> parameter
1696                   is an upper-limit on the service time estimate. If <literal>at_max</literal> is
1697                   reached, an RPC request times out.</para>
1698                 <para>Setting <literal>at_max</literal> to 0 causes adaptive timeouts to be disabled
1699                   and a fixed timeout method to be used instead (see <xref
1700                     xmlns:xlink="http://www.w3.org/1999/xlink" linkend="section_c24_nt5_dl"/></para>
1701                 <note>
1702                   <para>If slow hardware causes the service estimate to increase beyond the default
1703                     value of <literal>at_max</literal>, increase <literal>at_max</literal> to the
1704                     maximum time you are willing to wait for an RPC completion.</para>
1705                 </note>
1706               </entry>
1707             </row>
1708             <row>
1709               <entry>
1710                 <para>
1711                   <literal> at_history </literal></para>
1712               </entry>
1713               <entry>
1714                 <para>Time period (in seconds) within which adaptive timeouts remember the slowest
1715                   event that occurred. The default is 600.</para>
1716               </entry>
1717             </row>
1718             <row>
1719               <entry>
1720                 <para>
1721                   <literal> at_early_margin </literal></para>
1722               </entry>
1723               <entry>
1724                 <para>Amount of time before the Lustre server sends an early reply (in seconds).
1725                   Default is 5.</para>
1726               </entry>
1727             </row>
1728             <row>
1729               <entry>
1730                 <para>
1731                   <literal> at_extra </literal></para>
1732               </entry>
1733               <entry>
1734                 <para>Incremental amount of time that a server requests with each early reply (in
1735                   seconds). The server does not know how much time the RPC will take, so it asks for
1736                   a fixed value. The default is 30, which provides a balance between sending too
1737                   many early replies for the same RPC and overestimating the actual completion
1738                   time.</para>
1739                 <para>When a server finds a queued request about to time out and needs to send an
1740                   early reply out, the server adds the <literal>at_extra</literal> value. If the
1741                   time expires, the Lustre server drops the request, and the client enters recovery
1742                   status and reconnects to restore the connection to normal status.</para>
1743                 <para>If you see multiple early replies for the same RPC asking for 30-second
1744                   increases, change the <literal>at_extra</literal> value to a larger number to cut
1745                   down on early replies sent and, therefore, network load.</para>
1746               </entry>
1747             </row>
1748             <row>
1749               <entry>
1750                 <para>
1751                   <literal> ldlm_enqueue_min </literal></para>
1752               </entry>
1753               <entry>
1754                 <para>Minimum lock enqueue time (in seconds). The default is 100. The time it takes
1755                   to enqueue a lock, <literal>ldlm_enqueue</literal>, is the maximum of the measured
1756                   enqueue estimate (influenced by <literal>at_min</literal> and
1757                     <literal>at_max</literal> parameters), multiplied by a weighting factor and the
1758                   value of <literal>ldlm_enqueue_min</literal>. </para>
1759                 <para>Lustre Distributed Lock Manager (LDLM) lock enqueues have a dedicated minimum
1760                   value for <literal>ldlm_enqueue_min</literal>. Lock enqueue timeouts increase as
1761                   the measured enqueue times increase (similar to adaptive timeouts).</para>
1762               </entry>
1763             </row>
1764           </tbody>
1765         </tgroup>
1766       </informaltable>
1767       <section>
1768         <title>Interpreting Adaptive Timeout Information</title>
1769         <para>Adaptive timeout information can be obtained from the <literal>timeouts</literal>
1770           files in <literal>/proc/fs/lustre/*/</literal> on each server and client using the
1771             <literal>lctl</literal> command. To read information from a <literal>timeouts</literal>
1772           file, enter a command similar to:</para>
1773         <screen># lctl get_param -n ost.*.ost_io.timeouts
1774 service : cur 33  worst 34 (at 1193427052, 0d0h26m40s ago) 1 1 33 2</screen>
1775         <para>In this example, the <literal>ost_io</literal> service on this node is currently
1776           reporting an estimated RPC service time of 33 seconds. The worst RPC service time was 34
1777           seconds, which occurred 26 minutes ago.</para>
1778         <para>The output also provides a history of service times. Four &quot;bins&quot; of adaptive
1779           timeout history are shown, with the maximum RPC time in each bin reported. In both the
1780           0-150s bin and the 150-300s bin, the maximum RPC time was 1. The 300-450s bin shows the
1781           worst (maximum) RPC time at 33 seconds, and the 450-600s bin shows a maximum of RPC time
1782           of 2 seconds. The estimated service time is the maximum value across the four bins (33
1783           seconds in this example).</para>
1784         <para>Service times (as reported by the servers) are also tracked in the client OBDs, as
1785           shown in this example:</para>
1786         <screen># lctl get_param osc.*.timeouts
1787 last reply : 1193428639, 0d0h00m00s ago
1788 network    : cur  1 worst  2 (at 1193427053, 0d0h26m26s ago)  1  1  1  1
1789 portal 6   : cur 33 worst 34 (at 1193427052, 0d0h26m27s ago) 33 33 33  2
1790 portal 28  : cur  1 worst  1 (at 1193426141, 0d0h41m38s ago)  1  1  1  1
1791 portal 7   : cur  1 worst  1 (at 1193426141, 0d0h41m38s ago)  1  0  1  1
1792 portal 17  : cur  1 worst  1 (at 1193426177, 0d0h41m02s ago)  1  0  0  1
1793 </screen>
1794         <para>In this example, portal 6, the <literal>ost_io</literal> service portal, shows the
1795           history of service estimates reported by the portal.</para>
1796         <para>Server statistic files also show the range of estimates including min, max, sum, and
1797           sumsq. For example:</para>
1798         <screen># lctl get_param mdt.*.mdt.stats
1799 ...
1800 req_timeout               6 samples [sec] 1 10 15 105
1801 ...
1802 </screen>
1803       </section>
1804     </section>
1805     <section xml:id="section_c24_nt5_dl">
1806       <title>Setting Static Timeouts<indexterm>
1807           <primary>proc</primary>
1808           <secondary>static timeouts</secondary>
1809         </indexterm></title>
1810       <para>The Lustre software provides two sets of static (fixed) timeouts, LND timeouts and
1811         Lustre timeouts, which are used when adaptive timeouts are not enabled.</para>
1812       <para>
1813         <itemizedlist>
1814           <listitem>
1815             <para><emphasis role="italic"><emphasis role="bold">LND timeouts</emphasis></emphasis> -
1816               LND timeouts ensure that point-to-point communications across a network complete in a
1817               finite time in the presence of failures, such as packages lost or broken connections.
1818               LND timeout parameters are set for each individual LND.</para>
1819             <para>LND timeouts are logged with the <literal>S_LND</literal> flag set. They are not
1820               printed as console messages, so check the Lustre log for <literal>D_NETERROR</literal>
1821               messages or enable printing of <literal>D_NETERROR</literal> messages to the console
1822               using:<screen>lctl set_param printk=+neterror</screen></para>
1823             <para>Congested routers can be a source of spurious LND timeouts. To avoid this
1824               situation, increase the number of LNET router buffers to reduce back-pressure and/or
1825               increase LND timeouts on all nodes on all connected networks. Also consider increasing
1826               the total number of LNET router nodes in the system so that the aggregate router
1827               bandwidth matches the aggregate server bandwidth.</para>
1828           </listitem>
1829           <listitem>
1830             <para><emphasis role="italic"><emphasis role="bold">Lustre timeouts
1831                 </emphasis></emphasis>- Lustre timeouts ensure that Lustre RPCs complete in a finite
1832               time in the presence of failures when adaptive timeouts are not enabled. Adaptive
1833               timeouts are enabled by default. To disable adaptive timeouts at run time, set
1834                 <literal>at_max</literal> to 0 by running on the
1835               MGS:<screen># lctl conf_param <replaceable>fsname</replaceable>.sys.at_max=0</screen></para>
1836             <note>
1837               <para>Changing the status of adaptive timeouts at runtime may cause a transient client
1838                 timeout, recovery, and reconnection.</para>
1839             </note>
1840             <para>Lustre timeouts are always printed as console messages. </para>
1841             <para>If Lustre timeouts are not accompanied by LND timeouts, increase the Lustre
1842               timeout on both servers and clients. Lustre timeouts are set using a command such as
1843               the following:<screen># lctl set_param timeout=30</screen></para>
1844             <para>Lustre timeout parameters are described in the table below.</para>
1845           </listitem>
1846         </itemizedlist>
1847         <informaltable frame="all">
1848           <tgroup cols="2">
1849             <colspec colname="c1" colnum="1" colwidth="30*"/>
1850             <colspec colname="c2" colnum="2" colwidth="70*"/>
1851             <thead>
1852               <row>
1853                 <entry>Parameter</entry>
1854                 <entry>Description</entry>
1855               </row>
1856             </thead>
1857             <tbody>
1858               <row>
1859                 <entry><literal>timeout</literal></entry>
1860                 <entry>
1861                   <para>The time that a client waits for a server to complete an RPC (default 100s).
1862                     Servers wait half this time for a normal client RPC to complete and a quarter of
1863                     this time for a single bulk request (read or write of up to 4 MB) to complete.
1864                     The client pings recoverable targets (MDS and OSTs) at one quarter of the
1865                     timeout, and the server waits one and a half times the timeout before evicting a
1866                     client for being &quot;stale.&quot;</para>
1867                   <para>Lustre client sends periodic &apos;ping&apos; messages to servers with which
1868                     it has had no communication for the specified period of time. Any network
1869                     activity between a client and a server in the file system also serves as a
1870                     ping.</para>
1871                 </entry>
1872               </row>
1873               <row>
1874                 <entry><literal>ldlm_timeout</literal></entry>
1875                 <entry>
1876                   <para>The time that a server waits for a client to reply to an initial AST (lock
1877                     cancellation request). The default is 20s for an OST and 6s for an MDS. If the
1878                     client replies to the AST, the server will give it a normal timeout (half the
1879                     client timeout) to flush any dirty data and release the lock.</para>
1880                 </entry>
1881               </row>
1882               <row>
1883                 <entry><literal>fail_loc</literal></entry>
1884                 <entry>
1885                   <para>An internal debugging failure hook. The default value of
1886                       <literal>0</literal> means that no failure will be triggered or
1887                     injected.</para>
1888                 </entry>
1889               </row>
1890               <row>
1891                 <entry><literal>dump_on_timeout</literal></entry>
1892                 <entry>
1893                   <para>Triggers a dump of the Lustre debug log when a timeout occurs. The default
1894                     value of <literal>0</literal> (zero) means a dump of the Lustre debug log will
1895                     not be triggered.</para>
1896                 </entry>
1897               </row>
1898               <row>
1899                 <entry><literal>dump_on_eviction</literal></entry>
1900                 <entry>
1901                   <para>Triggers a dump of the Lustre debug log when an eviction occurs. The default
1902                     value of <literal>0</literal> (zero) means a dump of the Lustre debug log will
1903                     not be triggered. </para>
1904                 </entry>
1905               </row>
1906             </tbody>
1907           </tgroup>
1908         </informaltable>
1909       </para>
1910     </section>
1911   </section>
1912   <section remap="h3">
1913     <title><indexterm>
1914         <primary>proc</primary>
1915         <secondary>LNET</secondary>
1916       </indexterm><indexterm>
1917         <primary>LNET</primary>
1918         <secondary>proc</secondary>
1919       </indexterm>Monitoring LNET</title>
1920     <para>LNET information is located in <literal>/proc/sys/lnet</literal> in these files:<itemizedlist>
1921         <listitem>
1922           <para><literal>peers</literal> - Shows all NIDs known to this node and provides
1923             information on the queue state.</para>
1924           <para>Example:</para>
1925           <screen># lctl get_param peers
1926 nid                refs   state  max  rtr  min   tx    min   queue
1927 0@lo               1      ~rtr   0    0    0     0     0     0
1928 192.168.10.35@tcp  1      ~rtr   8    8    8     8     6     0
1929 192.168.10.36@tcp  1      ~rtr   8    8    8     8     6     0
1930 192.168.10.37@tcp  1      ~rtr   8    8    8     8     6     0</screen>
1931           <para>The fields are explained in the table below:</para>
1932           <informaltable frame="all">
1933             <tgroup cols="2">
1934               <colspec colname="c1" colwidth="30*"/>
1935               <colspec colname="c2" colwidth="80*"/>
1936               <thead>
1937                 <row>
1938                   <entry>
1939                     <para><emphasis role="bold">Field</emphasis></para>
1940                   </entry>
1941                   <entry>
1942                     <para><emphasis role="bold">Description</emphasis></para>
1943                   </entry>
1944                 </row>
1945               </thead>
1946               <tbody>
1947                 <row>
1948                   <entry>
1949                     <para>
1950                       <literal>refs</literal>
1951                     </para>
1952                   </entry>
1953                   <entry>
1954                     <para>A reference count. </para>
1955                   </entry>
1956                 </row>
1957                 <row>
1958                   <entry>
1959                     <para>
1960                       <literal>state</literal>
1961                     </para>
1962                   </entry>
1963                   <entry>
1964                     <para>If the node is a router, indicates the state of the router. Possible
1965                       values are:</para>
1966                     <itemizedlist>
1967                       <listitem>
1968                         <para><literal>NA</literal> - Indicates the node is not a router.</para>
1969                       </listitem>
1970                       <listitem>
1971                         <para><literal>up/down</literal>- Indicates if the node (router) is up or
1972                           down.</para>
1973                       </listitem>
1974                     </itemizedlist>
1975                   </entry>
1976                 </row>
1977                 <row>
1978                   <entry>
1979                     <para>
1980                       <literal>max </literal></para>
1981                   </entry>
1982                   <entry>
1983                     <para>Maximum number of concurrent sends from this peer.</para>
1984                   </entry>
1985                 </row>
1986                 <row>
1987                   <entry>
1988                     <para>
1989                       <literal>rtr </literal></para>
1990                   </entry>
1991                   <entry>
1992                     <para>Number of routing buffer credits.</para>
1993                   </entry>
1994                 </row>
1995                 <row>
1996                   <entry>
1997                     <para>
1998                       <literal>min </literal></para>
1999                   </entry>
2000                   <entry>
2001                     <para>Minimum number of routing buffer credits seen.</para>
2002                   </entry>
2003                 </row>
2004                 <row>
2005                   <entry>
2006                     <para>
2007                       <literal>tx </literal></para>
2008                   </entry>
2009                   <entry>
2010                     <para>Number of send credits.</para>
2011                   </entry>
2012                 </row>
2013                 <row>
2014                   <entry>
2015                     <para>
2016                       <literal>min </literal></para>
2017                   </entry>
2018                   <entry>
2019                     <para>Minimum number of send credits seen.</para>
2020                   </entry>
2021                 </row>
2022                 <row>
2023                   <entry>
2024                     <para>
2025                       <literal>queue </literal></para>
2026                   </entry>
2027                   <entry>
2028                     <para>Total bytes in active/queued sends.</para>
2029                   </entry>
2030                 </row>
2031               </tbody>
2032             </tgroup>
2033           </informaltable>
2034           <para>Credits are initialized to allow a certain number of operations (in the example
2035             above the table, eight as shown in the <literal>max</literal> column. LNET keeps track
2036             of the minimum number of credits ever seen over time showing the peak congestion that
2037             has occurred during the time monitored. Fewer available credits indicates a more
2038             congested resource. </para>
2039           <para>The number of credits currently in flight (number of transmit credits) is shown in
2040             the <literal>tx</literal> column. The maximum number of send credits available is shown
2041             in the <literal>max</literal> column and never changes. The number of router buffers
2042             available for consumption by a peer is shown in the <literal>rtr</literal>
2043             column.</para>
2044           <para>Therefore, <literal>rtr</literal> â€“ <literal>tx</literal> is the number of transmits
2045             in flight. Typically, <literal>rtr == max</literal>, although a configuration can be set
2046             such that <literal>max >= rtr</literal>. The ratio of routing buffer credits to send
2047             credits (<literal>rtr/tx</literal>) that is less than <literal>max</literal> indicates
2048             operations are in progress. If the ratio <literal>rtr/tx</literal> is greater than
2049               <literal>max</literal>, operations are blocking.</para>
2050           <para>LNET also limits concurrent sends and number of router buffers allocated to a single
2051             peer so that no peer can occupy all these resources.</para>
2052         </listitem>
2053         <listitem>
2054           <para><literal>nis</literal> - Shows the current queue health on this node.</para>
2055           <para>Example:</para>
2056           <screen># lctl get_param nis
2057 nid                    refs   peer    max   tx    min
2058 0@lo                   3      0       0     0     0
2059 192.168.10.34@tcp      4      8       256   256   252
2060 </screen>
2061           <para> The fields are explained in the table below.</para>
2062           <informaltable frame="all">
2063             <tgroup cols="2">
2064               <colspec colname="c1" colwidth="30*"/>
2065               <colspec colname="c2" colwidth="80*"/>
2066               <thead>
2067                 <row>
2068                   <entry>
2069                     <para><emphasis role="bold">Field</emphasis></para>
2070                   </entry>
2071                   <entry>
2072                     <para><emphasis role="bold">Description</emphasis></para>
2073                   </entry>
2074                 </row>
2075               </thead>
2076               <tbody>
2077                 <row>
2078                   <entry>
2079                     <para>
2080                       <literal> nid </literal></para>
2081                   </entry>
2082                   <entry>
2083                     <para>Network interface.</para>
2084                   </entry>
2085                 </row>
2086                 <row>
2087                   <entry>
2088                     <para>
2089                       <literal> refs </literal></para>
2090                   </entry>
2091                   <entry>
2092                     <para>Internal reference counter.</para>
2093                   </entry>
2094                 </row>
2095                 <row>
2096                   <entry>
2097                     <para>
2098                       <literal> peer </literal></para>
2099                   </entry>
2100                   <entry>
2101                     <para>Number of peer-to-peer send credits on this NID. Credits are used to size
2102                       buffer pools.</para>
2103                   </entry>
2104                 </row>
2105                 <row>
2106                   <entry>
2107                     <para>
2108                       <literal> max </literal></para>
2109                   </entry>
2110                   <entry>
2111                     <para>Total number of send credits on this NID.</para>
2112                   </entry>
2113                 </row>
2114                 <row>
2115                   <entry>
2116                     <para>
2117                       <literal> tx </literal></para>
2118                   </entry>
2119                   <entry>
2120                     <para>Current number of send credits available on this NID.</para>
2121                   </entry>
2122                 </row>
2123                 <row>
2124                   <entry>
2125                     <para>
2126                       <literal> min </literal></para>
2127                   </entry>
2128                   <entry>
2129                     <para>Lowest number of send credits available on this NID.</para>
2130                   </entry>
2131                 </row>
2132                 <row>
2133                   <entry>
2134                     <para>
2135                       <literal> queue </literal></para>
2136                   </entry>
2137                   <entry>
2138                     <para>Total bytes in active/queued sends.</para>
2139                   </entry>
2140                 </row>
2141               </tbody>
2142             </tgroup>
2143           </informaltable>
2144           <para><emphasis role="bold"><emphasis role="italic">Analysis:</emphasis></emphasis></para>
2145           <para>Subtracting <literal>max</literal> from <literal>tx</literal>
2146               (<literal>max</literal> - <literal>tx</literal>) yields the number of sends currently
2147             active. A large or increasing number of active sends may indicate a problem.</para>
2148         </listitem>
2149       </itemizedlist></para>
2150   </section>
2151   <section remap="h3">
2152     <title><indexterm>
2153         <primary>proc</primary>
2154         <secondary>free space</secondary>
2155       </indexterm>Allocating Free Space on OSTs</title>
2156     <para>Free space is allocated using either a round-robin or a weighted algorithm. The allocation
2157       method is determined by the maximum amount of free-space imbalance between the OSTs. When free
2158       space is relatively balanced across OSTs, the faster round-robin allocator is used, which
2159       maximizes network balancing. The weighted allocator is used when any two OSTs are out of
2160       balance by more than a specified threshold.</para>
2161     <para>Free space distribution can be tuned using these two <literal>/proc</literal>
2162       tunables:</para>
2163     <itemizedlist>
2164       <listitem>
2165         <para><literal>qos_threshold_rr</literal> - The threshold at which the allocation method
2166           switches from round-robin to weighted is set in this file. The default is to switch to the
2167           weighted algorithm when any two OSTs are out of balance by more than 17 percent.</para>
2168       </listitem>
2169       <listitem>
2170         <para><literal>qos_prio_free</literal> - The weighting priority used by the weighted
2171           allocator can be adjusted in this file. Increasing the value of
2172             <literal>qos_prio_free</literal> puts more weighting on the amount of free space
2173           available on each OST and less on how stripes are distributed across OSTs. The default
2174           value is 91 percent. When the free space priority is set to 100, weighting is based
2175           entirely on free space and location is no longer used by the striping algorthm.</para>
2176       </listitem>
2177       <listitem>
2178         <para condition="l29"><literal>reserved_mb_low</literal> - The low watermark used to stop
2179           object allocation if available space is less than it. The default is 0.1 percent of total
2180           OST size.</para>
2181       </listitem>
2182        <listitem>
2183         <para condition="l29"><literal>reserved_mb_high</literal> - The high watermark used to start
2184           object allocation if available space is more than it. The default is 0.2 percent of total
2185           OST size.</para>
2186       </listitem>
2187     </itemizedlist>
2188     <para>For more information about monitoring and managing free space, see <xref
2189         xmlns:xlink="http://www.w3.org/1999/xlink" linkend="dbdoclet.50438209_10424"/>.</para>
2190   </section>
2191   <section remap="h3">
2192     <title><indexterm>
2193         <primary>proc</primary>
2194         <secondary>locking</secondary>
2195       </indexterm>Configuring Locking</title>
2196     <para>The <literal>lru_size</literal> parameter is used to control the number of client-side
2197       locks in an LRU cached locks queue. LRU size is dynamic, based on load to optimize the number
2198       of locks available to nodes that have different workloads (e.g., login/build nodes vs. compute
2199       nodes vs. backup nodes).</para>
2200     <para>The total number of locks available is a function of the server RAM. The default limit is
2201       50 locks/1 MB of RAM. If memory pressure is too high, the LRU size is shrunk. The number of
2202       locks on the server is limited to <emphasis role="italic">the number of OSTs per
2203         server</emphasis> * <emphasis role="italic">the number of clients</emphasis> * <emphasis
2204         role="italic">the value of the</emphasis>
2205       <literal>lru_size</literal>
2206       <emphasis role="italic">setting on the client</emphasis> as follows: </para>
2207     <itemizedlist>
2208       <listitem>
2209         <para>To enable automatic LRU sizing, set the <literal>lru_size</literal> parameter to 0. In
2210           this case, the <literal>lru_size</literal> parameter shows the current number of locks
2211           being used on the export. LRU sizing is enabled by default.</para>
2212       </listitem>
2213       <listitem>
2214         <para>To specify a maximum number of locks, set the <literal>lru_size</literal> parameter to
2215           a value other than zero but, normally, less than 100 * <emphasis role="italic">number of
2216             CPUs in client</emphasis>. It is recommended that you only increase the LRU size on a
2217           few login nodes where users access the file system interactively.</para>
2218       </listitem>
2219     </itemizedlist>
2220     <para>To clear the LRU on a single client, and, as a result, flush client cache without changing
2221       the <literal>lru_size</literal> value, run:</para>
2222     <screen>$ lctl set_param ldlm.namespaces.<replaceable>osc_name|mdc_name</replaceable>.lru_size=clear</screen>
2223     <para>If the LRU size is set to be less than the number of existing unused locks, the unused
2224       locks are canceled immediately. Use <literal>echo clear</literal> to cancel all locks without
2225       changing the value.</para>
2226     <note>
2227       <para>The <literal>lru_size</literal> parameter can only be set temporarily using
2228           <literal>lctl set_param</literal>; it cannot be set permanently.</para>
2229     </note>
2230     <para>To disable LRU sizing, on the Lustre clients, run:</para>
2231     <screen>$ lctl set_param ldlm.namespaces.*osc*.lru_size=$((<replaceable>NR_CPU</replaceable>*100))</screen>
2232     <para>Replace <literal><replaceable>NR_CPU</replaceable></literal> with the number of CPUs on
2233       the node.</para>
2234     <para>To determine the number of locks being granted, run:</para>
2235     <screen>$ lctl get_param ldlm.namespaces.*.pool.limit</screen>
2236   </section>
2237   <section xml:id="dbdoclet.50438271_87260">
2238     <title><indexterm>
2239         <primary>proc</primary>
2240         <secondary>thread counts</secondary>
2241       </indexterm>Setting MDS and OSS Thread Counts</title>
2242     <para>MDS and OSS thread counts tunable can be used to set the minimum and maximum thread counts
2243       or get the current number of running threads for the services listed in the table
2244       below.</para>
2245     <informaltable frame="all">
2246       <tgroup cols="2">
2247         <colspec colname="c1" colwidth="50*"/>
2248         <colspec colname="c2" colwidth="50*"/>
2249         <tbody>
2250           <row>
2251             <entry>
2252               <para>
2253                 <emphasis role="bold">Service</emphasis></para>
2254             </entry>
2255             <entry>
2256               <para>
2257                 <emphasis role="bold">Description</emphasis></para>
2258             </entry>
2259           </row>
2260           <row>
2261             <entry>
2262               <literal> mds.MDS.mdt </literal>
2263             </entry>
2264             <entry>
2265               <para>Main metadata operations service</para>
2266             </entry>
2267           </row>
2268           <row>
2269             <entry>
2270               <literal> mds.MDS.mdt_readpage </literal>
2271             </entry>
2272             <entry>
2273               <para>Metadata <literal>readdir</literal> service</para>
2274             </entry>
2275           </row>
2276           <row>
2277             <entry>
2278               <literal> mds.MDS.mdt_setattr </literal>
2279             </entry>
2280             <entry>
2281               <para>Metadata <literal>setattr/close</literal> operations service </para>
2282             </entry>
2283           </row>
2284           <row>
2285             <entry>
2286               <literal> ost.OSS.ost </literal>
2287             </entry>
2288             <entry>
2289               <para>Main data operations service</para>
2290             </entry>
2291           </row>
2292           <row>
2293             <entry>
2294               <literal> ost.OSS.ost_io </literal>
2295             </entry>
2296             <entry>
2297               <para>Bulk data I/O services</para>
2298             </entry>
2299           </row>
2300           <row>
2301             <entry>
2302               <literal> ost.OSS.ost_create </literal>
2303             </entry>
2304             <entry>
2305               <para>OST object pre-creation service</para>
2306             </entry>
2307           </row>
2308           <row>
2309             <entry>
2310               <literal> ldlm.services.ldlm_canceld </literal>
2311             </entry>
2312             <entry>
2313               <para>DLM lock cancel service</para>
2314             </entry>
2315           </row>
2316           <row>
2317             <entry>
2318               <literal> ldlm.services.ldlm_cbd </literal>
2319             </entry>
2320             <entry>
2321               <para>DLM lock grant service</para>
2322             </entry>
2323           </row>
2324         </tbody>
2325       </tgroup>
2326     </informaltable>
2327     <para>For each service, an entry as shown below is
2328       created:<screen>/proc/fs/lustre/<replaceable>service</replaceable>/*/threads_<replaceable>min|max|started</replaceable></screen></para>
2329     <itemizedlist>
2330       <listitem>
2331         <para>To temporarily set this tunable, run:</para>
2332         <screen># lctl <replaceable>get|set</replaceable>_param <replaceable>service</replaceable>.threads_<replaceable>min|max|started</replaceable> </screen>
2333         </listitem>
2334       <listitem>
2335         <para>To permanently set this tunable, run:</para>
2336         <screen># lctl conf_param <replaceable>obdname|fsname.obdtype</replaceable>.threads_<replaceable>min|max|started</replaceable> </screen>
2337         <para condition='l25'>For version 2.5 or later, run:
2338                 <screen># lctl set_param -P <replaceable>service</replaceable>.threads_<replaceable>min|max|started</replaceable></screen></para>
2339       </listitem>
2340     </itemizedlist>
2341       <para>The following examples show how to set thread counts and get the number of running threads
2342         for the service <literal>ost_io</literal>  using the tunable
2343         <literal><replaceable>service</replaceable>.threads_<replaceable>min|max|started</replaceable></literal>.</para>
2344     <itemizedlist>
2345       <listitem>
2346         <para>To get the number of running threads, run:</para>
2347         <screen># lctl get_param ost.OSS.ost_io.threads_started
2348 ost.OSS.ost_io.threads_started=128</screen>
2349       </listitem>
2350       <listitem>
2351         <para>To set the number of threads to the maximum value (512), run:</para>
2352         <screen># lctl get_param ost.OSS.ost_io.threads_max
2353 ost.OSS.ost_io.threads_max=512</screen>
2354       </listitem>
2355       <listitem>
2356         <para>To set the maximum thread count to 256 instead of 512 (to avoid overloading the
2357           storage or for an array with requests), run:</para>
2358         <screen># lctl set_param ost.OSS.ost_io.threads_max=256
2359 ost.OSS.ost_io.threads_max=256</screen>
2360       </listitem>
2361       <listitem>
2362         <para>To set the maximum thread count to 256 instead of 512 permanently, run:</para>
2363         <screen># lctl conf_param testfs.ost.ost_io.threads_max=256</screen>
2364         <para condition='l25'>For version 2.5 or later, run:
2365         <screen># lctl set_param -P ost.OSS.ost_io.threads_max=256
2366 ost.OSS.ost_io.threads_max=256 </screen> </para>
2367       </listitem>
2368       <listitem>
2369         <para> To check if the <literal>threads_max</literal> setting is active, run:</para>
2370         <screen># lctl get_param ost.OSS.ost_io.threads_max
2371 ost.OSS.ost_io.threads_max=256</screen>
2372       </listitem>
2373     </itemizedlist>
2374     <note>
2375       <para>If the number of service threads is changed while the file system is running, the change
2376         may not take effect until the file system is stopped and rest. If the number of service
2377         threads in use exceeds the new <literal>threads_max</literal> value setting, service threads
2378         that are already running will not be stopped.</para>
2379     </note>
2380     <para>See also <xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="lustretuning"/></para>
2381   </section>
2382   <section xml:id="dbdoclet.50438271_83523">
2383     <title><indexterm>
2384         <primary>proc</primary>
2385         <secondary>debug</secondary>
2386       </indexterm>Enabling and Interpreting Debugging Logs</title>
2387     <para>By default, a detailed log of all operations is generated to aid in debugging. Flags that
2388       control debugging are found in <literal>/proc/sys/lnet/debug</literal>. </para>
2389     <para>The overhead of debugging can affect the performance of Lustre file system. Therefore, to
2390       minimize the impact on performance, the debug level can be lowered, which affects the amount
2391       of debugging information kept in the internal log buffer but does not alter the amount of
2392       information to goes into syslog. You can raise the debug level when you need to collect logs
2393       to debug problems. </para>
2394     <para>The debugging mask can be set using &quot;symbolic names&quot;. The symbolic format is
2395       shown in the examples below.<itemizedlist>
2396         <listitem>
2397           <para>To verify the debug level used, examine the <literal>sysctl</literal> that controls
2398             debugging by running:</para>
2399           <screen># sysctl lnet.debug 
2400 lnet.debug = ioctl neterror warning error emerg ha config console</screen>
2401         </listitem>
2402         <listitem>
2403           <para>To turn off debugging (except for network error debugging), run the following
2404             command on all nodes concerned:</para>
2405           <screen># sysctl -w lnet.debug=&quot;neterror&quot; 
2406 lnet.debug = neterror</screen>
2407         </listitem>
2408       </itemizedlist><itemizedlist>
2409         <listitem>
2410           <para>To turn off debugging completely, run the following command on all nodes
2411             concerned:</para>
2412           <screen># sysctl -w lnet.debug=0 
2413 lnet.debug = 0</screen>
2414         </listitem>
2415         <listitem>
2416           <para>To set an appropriate debug level for a production environment, run:</para>
2417           <screen># sysctl -w lnet.debug=&quot;warning dlmtrace error emerg ha rpctrace vfstrace&quot; 
2418 lnet.debug = warning dlmtrace error emerg ha rpctrace vfstrace</screen>
2419           <para>The flags shown in this example collect enough high-level information to aid
2420             debugging, but they do not cause any serious performance impact.</para>
2421         </listitem>
2422       </itemizedlist><itemizedlist>
2423         <listitem>
2424           <para>To clear all flags and set new flags, run:</para>
2425           <screen># sysctl -w lnet.debug=&quot;warning&quot; 
2426 lnet.debug = warning</screen>
2427         </listitem>
2428       </itemizedlist><itemizedlist>
2429         <listitem>
2430           <para>To add new flags to flags that have already been set, precede each one with a
2431               &quot;<literal>+</literal>&quot;:</para>
2432           <screen># sysctl -w lnet.debug=&quot;+neterror +ha&quot; 
2433 lnet.debug = +neterror +ha
2434 # sysctl lnet.debug 
2435 lnet.debug = neterror warning ha</screen>
2436         </listitem>
2437         <listitem>
2438           <para>To remove individual flags, precede them with a
2439             &quot;<literal>-</literal>&quot;:</para>
2440           <screen># sysctl -w lnet.debug=&quot;-ha&quot; 
2441 lnet.debug = -ha
2442 # sysctl lnet.debug 
2443 lnet.debug = neterror warning</screen>
2444         </listitem>
2445         <listitem>
2446           <para>To verify or change the debug level, run commands such as the following: :</para>
2447           <screen># lctl get_param debug
2448 debug=
2449 neterror warning
2450 # lctl set_param debug=+ha
2451 # lctl get_param debug
2452 debug=
2453 neterror warning ha
2454 # lctl set_param debug=-warning
2455 # lctl get_param debug
2456 debug=
2457 neterror ha</screen>
2458         </listitem>
2459       </itemizedlist></para>
2460     <para>Debugging parameters include:</para>
2461     <itemizedlist>
2462       <listitem>
2463         <para><literal>subsystem_debug</literal> - Controls the debug logs for subsystems.</para>
2464       </listitem>
2465       <listitem>
2466         <para><literal>debug_path</literal> - Indicates the location where the debug log is dumped
2467           when triggered automatically or manually. The default path is
2468             <literal>/tmp/lustre-log</literal>.</para>
2469       </listitem>
2470     </itemizedlist>
2471     <para>These parameters are also set using:<screen>sysctl -w lnet.debug={value}</screen></para>
2472     <para>Additional useful parameters: <itemizedlist>
2473         <listitem>
2474           <para><literal>panic_on_lbug</literal> - Causes &apos;&apos;panic&apos;&apos; to be called
2475             when the Lustre software detects an internal problem (an <literal>LBUG</literal> log
2476             entry); panic crashes the node. This is particularly useful when a kernel crash dump
2477             utility is configured. The crash dump is triggered when the internal inconsistency is
2478             detected by the Lustre software. </para>
2479         </listitem>
2480         <listitem>
2481           <para><literal>upcall</literal> - Allows you to specify the path to the binary which will
2482             be invoked when an <literal>LBUG</literal> log entry is encountered. This binary is
2483             called with four parameters:</para>
2484           <para> - The string &apos;&apos;<literal>LBUG</literal>&apos;&apos;.</para>
2485           <para> - The file where the <literal>LBUG</literal> occurred.</para>
2486           <para> - The function name.</para>
2487           <para> - The line number in the file</para>
2488         </listitem>
2489       </itemizedlist></para>
2490     <section>
2491       <title>Interpreting OST Statistics</title>
2492       <note>
2493         <para>See also <xref linkend="dbdoclet.50438219_84890"/> (<literal>llobdstat</literal>) and
2494             <xref linkend="dbdoclet.50438273_80593"/> (<literal>collectl</literal>).</para>
2495       </note>
2496       <para>OST <literal>stats</literal> files can be used to provide statistics showing activity
2497         for each OST. For example:</para>
2498       <screen># lctl get_param osc.testfs-OST0000-osc.stats 
2499 snapshot_time                      1189732762.835363
2500 ost_create                 1
2501 ost_get_info               1
2502 ost_connect                1
2503 ost_set_info               1
2504 obd_ping                   212</screen>
2505       <para>Use the <literal>llstat</literal> utility to monitor statistics over time.</para>
2506       <para>To clear the statistics, use the <literal>-c</literal> option to
2507           <literal>llstat</literal>. To specify how frequently the statistics should be reported (in
2508         seconds), use the <literal>-i</literal> option. In the example below, the
2509           <literal>-c</literal> option clears the statistics and <literal>-i10</literal> option
2510         reports statistics every 10 seconds:</para>
2511       <screen role="smaller">$ llstat -c -i10 /proc/fs/lustre/ost/OSS/ost_io/stats
2512  
2513 /usr/bin/llstat: STATS on 06/06/07 
2514         /proc/fs/lustre/ost/OSS/ost_io/ stats on 192.168.16.35@tcp
2515 snapshot_time                              1181074093.276072
2516  
2517 /proc/fs/lustre/ost/OSS/ost_io/stats @ 1181074103.284895
2518 Name        Cur.  Cur. #
2519             Count Rate Events Unit  last   min    avg       max    stddev
2520 req_waittime 8    0    8    [usec]  2078   34     259.75    868    317.49
2521 req_qdepth   8    0    8    [reqs]  1      0      0.12      1      0.35
2522 req_active   8    0    8    [reqs]  11     1      1.38      2      0.52
2523 reqbuf_avail 8    0    8    [bufs]  511    63     63.88     64     0.35
2524 ost_write    8    0    8    [bytes] 169767 72914  212209.62 387579 91874.29
2525  
2526 /proc/fs/lustre/ost/OSS/ost_io/stats @ 1181074113.290180
2527 Name        Cur.  Cur. #
2528             Count Rate Events Unit  last    min   avg       max    stddev
2529 req_waittime 31   3    39   [usec]  30011   34    822.79    12245  2047.71
2530 req_qdepth   31   3    39   [reqs]  0       0     0.03      1      0.16
2531 req_active   31   3    39   [reqs]  58      1     1.77      3      0.74
2532 reqbuf_avail 31   3    39   [bufs]  1977    63    63.79     64     0.41
2533 ost_write    30   3    38   [bytes] 1028467 15019 315325.16 910694 197776.51
2534  
2535 /proc/fs/lustre/ost/OSS/ost_io/stats @ 1181074123.325560
2536 Name        Cur.  Cur. #
2537             Count Rate Events Unit  last    min    avg       max    stddev
2538 req_waittime 21   2    60   [usec]  14970   34     784.32    12245  1878.66
2539 req_qdepth   21   2    60   [reqs]  0       0      0.02      1      0.13
2540 req_active   21   2    60   [reqs]  33      1      1.70      3      0.70
2541 reqbuf_avail 21   2    60   [bufs]  1341    63     63.82     64     0.39
2542 ost_write    21   2    59   [bytes] 7648424 15019  332725.08 910694 180397.87
2543 </screen>
2544       <para>The columns in this example are described in the table below.</para>
2545       <informaltable frame="all">
2546         <tgroup cols="2">
2547           <colspec colname="c1" colwidth="50*"/>
2548           <colspec colname="c2" colwidth="50*"/>
2549           <thead>
2550             <row>
2551               <entry>
2552                 <para><emphasis role="bold">Parameter</emphasis></para>
2553               </entry>
2554               <entry>
2555                 <para><emphasis role="bold">Description</emphasis></para>
2556               </entry>
2557             </row>
2558           </thead>
2559           <tbody>
2560             <row>
2561               <entry><literal>Name</literal></entry>
2562               <entry>Name of the service event.  See the tables below for descriptions of service
2563                 events that are tracked.</entry>
2564             </row>
2565             <row>
2566               <entry>
2567                 <para>
2568                   <literal>Cur. Count </literal></para>
2569               </entry>
2570               <entry>
2571                 <para>Number of events of each type sent in the last interval.</para>
2572               </entry>
2573             </row>
2574             <row>
2575               <entry>
2576                 <para>
2577                   <literal>Cur. Rate </literal></para>
2578               </entry>
2579               <entry>
2580                 <para>Number of events per second in the last interval.</para>
2581               </entry>
2582             </row>
2583             <row>
2584               <entry>
2585                 <para>
2586                   <literal> # Events </literal></para>
2587               </entry>
2588               <entry>
2589                 <para>Total number of such events since the events have been cleared.</para>
2590               </entry>
2591             </row>
2592             <row>
2593               <entry>
2594                 <para>
2595                   <literal> Unit </literal></para>
2596               </entry>
2597               <entry>
2598                 <para>Unit of measurement for that statistic (microseconds, requests,
2599                   buffers).</para>
2600               </entry>
2601             </row>
2602             <row>
2603               <entry>
2604                 <para>
2605                   <literal> last </literal></para>
2606               </entry>
2607               <entry>
2608                 <para>Average rate of these events (in units/event) for the last interval during
2609                   which they arrived. For instance, in the above mentioned case of
2610                     <literal>ost_destroy</literal> it took an average of 736 microseconds per
2611                   destroy for the 400 object destroys in the previous 10 seconds.</para>
2612               </entry>
2613             </row>
2614             <row>
2615               <entry>
2616                 <para>
2617                   <literal> min </literal></para>
2618               </entry>
2619               <entry>
2620                 <para>Minimum rate (in units/events) since the service started.</para>
2621               </entry>
2622             </row>
2623             <row>
2624               <entry>
2625                 <para>
2626                   <literal> avg </literal></para>
2627               </entry>
2628               <entry>
2629                 <para>Average rate.</para>
2630               </entry>
2631             </row>
2632             <row>
2633               <entry>
2634                 <para>
2635                   <literal> max </literal></para>
2636               </entry>
2637               <entry>
2638                 <para>Maximum rate.</para>
2639               </entry>
2640             </row>
2641             <row>
2642               <entry>
2643                 <para>
2644                   <literal> stddev </literal></para>
2645               </entry>
2646               <entry>
2647                 <para>Standard deviation (not measured in some cases)</para>
2648               </entry>
2649             </row>
2650           </tbody>
2651         </tgroup>
2652       </informaltable>
2653       <para>Events common to all services are shown in the table below.</para>
2654       <informaltable frame="all">
2655         <tgroup cols="2">
2656           <colspec colname="c1" colwidth="50*"/>
2657           <colspec colname="c2" colwidth="50*"/>
2658           <thead>
2659             <row>
2660               <entry>
2661                 <para><emphasis role="bold">Parameter</emphasis></para>
2662               </entry>
2663               <entry>
2664                 <para><emphasis role="bold">Description</emphasis></para>
2665               </entry>
2666             </row>
2667           </thead>
2668           <tbody>
2669             <row>
2670               <entry>
2671                 <para>
2672                   <literal> req_waittime </literal></para>
2673               </entry>
2674               <entry>
2675                 <para>Amount of time a request waited in the queue before being handled by an
2676                   available server thread.</para>
2677               </entry>
2678             </row>
2679             <row>
2680               <entry>
2681                 <para>
2682                   <literal> req_qdepth </literal></para>
2683               </entry>
2684               <entry>
2685                 <para>Number of requests waiting to be handled in the queue for this service.</para>
2686               </entry>
2687             </row>
2688             <row>
2689               <entry>
2690                 <para>
2691                   <literal> req_active </literal></para>
2692               </entry>
2693               <entry>
2694                 <para>Number of requests currently being handled.</para>
2695               </entry>
2696             </row>
2697             <row>
2698               <entry>
2699                 <para>
2700                   <literal> reqbuf_avail </literal></para>
2701               </entry>
2702               <entry>
2703                 <para>Number of unsolicited lnet request buffers for this service.</para>
2704               </entry>
2705             </row>
2706           </tbody>
2707         </tgroup>
2708       </informaltable>
2709       <para>Some service-specific events of interest are described in the table below.</para>
2710       <informaltable frame="all">
2711         <tgroup cols="2">
2712           <colspec colname="c1" colwidth="50*"/>
2713           <colspec colname="c2" colwidth="50*"/>
2714           <thead>
2715             <row>
2716               <entry>
2717                 <para><emphasis role="bold">Parameter</emphasis></para>
2718               </entry>
2719               <entry>
2720                 <para><emphasis role="bold">Description</emphasis></para>
2721               </entry>
2722             </row>
2723           </thead>
2724           <tbody>
2725             <row>
2726               <entry>
2727                 <para>
2728                   <literal> ldlm_enqueue </literal></para>
2729               </entry>
2730               <entry>
2731                 <para>Time it takes to enqueue a lock (this includes file open on the MDS)</para>
2732               </entry>
2733             </row>
2734             <row>
2735               <entry>
2736                 <para>
2737                   <literal> mds_reint </literal></para>
2738               </entry>
2739               <entry>
2740                 <para>Time it takes to process an MDS modification record (includes
2741                     <literal>create</literal>, <literal>mkdir</literal>, <literal>unlink</literal>,
2742                     <literal>rename</literal> and <literal>setattr</literal>)</para>
2743               </entry>
2744             </row>
2745           </tbody>
2746         </tgroup>
2747       </informaltable>
2748     </section>
2749     <section>
2750       <title>Interpreting MDT Statistics</title>
2751       <note>
2752         <para>See also <xref linkend="dbdoclet.50438219_84890"/> (<literal>llobdstat</literal>) and
2753             <xref linkend="dbdoclet.50438273_80593"/> (<literal>collectl</literal>).</para>
2754       </note>
2755       <para>MDT <literal>stats</literal> files can be used to track MDT
2756       statistics for the MDS. The example below shows sample output from an
2757       MDT <literal>stats</literal> file.</para>
2758       <screen># lctl get_param mds.*-MDT0000.stats
2759 snapshot_time                   1244832003.676892 secs.usecs 
2760 open                            2 samples [reqs]
2761 close                           1 samples [reqs]
2762 getxattr                        3 samples [reqs]
2763 process_config                  1 samples [reqs]
2764 connect                         2 samples [reqs]
2765 disconnect                      2 samples [reqs]
2766 statfs                          3 samples [reqs]
2767 setattr                         1 samples [reqs]
2768 getattr                         3 samples [reqs]
2769 llog_init                       6 samples [reqs] 
2770 notify                          16 samples [reqs]</screen>
2771     </section>
2772   </section>
2773 </chapter>