Whamcloud - gitweb
LU-8066 misc: replace /proc with "lctl get/set_param"
[doc/manual.git] / DataOnMDT.xml
1 <?xml version='1.0' encoding='UTF-8'?><chapter xmlns="http://docbook.org/ns/docbook" xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US" xml:id="dataonmdt"
2     condition="l2B">
3   <title xml:id="dataonmdt.title">Data on MDT (DoM)</title>
4   <para>This chapter describes Data on MDT (DoM).</para>
5   <section xml:id="dbdoclet.domintro">
6       <title>
7       <indexterm>
8         <primary>dom</primary>
9       </indexterm>
10       <indexterm>
11         <primary>dom</primary>
12         <secondary>intro</secondary>
13       </indexterm>Introduction to Data on MDT (DoM)</title>
14       <para>The Lustre Data on MDT (DoM) feature improves small file IO by
15       placing small files directly on the MDT, and also improves large file IO
16       by avoiding the OST being affected by small random IO that can cause
17       device seeking and hurt the streaming IO performance.  Therefore, users
18       can expect more consistent performance for both small file IO and mixed IO
19       patterns.</para>
20       <para>The layout of a DoM file is stored on disk as a composite layout
21       and is a special case of Progressive File Layout (PFL). Please see
22       <xref linkend="pfl" /> for more information on PFL. For DoM files, the
23       file layout is composed of the component of the file, which is placed on
24       an MDT, and the rest of components are placed on OSTs, if needed. The
25       first component is placed on the MDT in the MDT object data blocks.
26       This component always has one stripe with size equal to the component
27       size. Such a component with an MDT layout can be only the first component
28       in composite layout. The rest of components are placed over OSTs as usual
29       with a RAID0 layout. The OST components are not instantiated until
30       a client writes or truncates the file beyond the size of the MDT
31       component.</para>
32   </section>
33   <section xml:id="dbdoclet.usercommands">
34       <title>
35           <indexterm>
36               <primary>dom</primary>
37           </indexterm>
38           <indexterm>
39               <primary>dom</primary>
40               <secondary>usercommands</secondary>
41           </indexterm>User Commands</title>
42       <para>Lustre provides the <literal>lfs setstripe</literal> command for
43       users to create DoM files. Also, as usual,
44       <literal>lfs getstripe</literal> command can be used to list the
45       striping/component information for a given file, while
46       <literal>lfs find</literal> command can be used to search the directory
47       tree rooted at the given directory or file name for the files that match
48       the given DoM component parameters, e.g. layout type.</para>
49       <section xml:id="dbdoclet.lfssetstripe">
50           <title>
51               <indexterm>
52                   <primary>dom</primary>
53                   <secondary>lfssetstripe</secondary>
54               </indexterm>lfs setstripe for DoM files</title>
55           <para>The <literal>lfs setstripe</literal> command is used to create
56           DoM files.</para>
57           <section><title>Command</title>
58               <para><screen>
59 lfs setstripe --component-end|-E end1 --layout|-L mdt \
60         [--component-end|-E end2 [STRIPE_OPTIONS] ...] &lt;filename&gt;
61               </screen>
62               The command above creates a file with the special composite
63               layout, which defines the first component as an MDT component. The
64               MDT component must start from offset 0 and ends at
65               <replaceable>end1</replaceable>. The
66               <replaceable>end1</replaceable> is also the stripe size of this
67               component, and is limited by the
68               <literal>lod.*.dom_stripesize</literal> of the MDT the file is
69               created on. No other options are required for this component.
70               The rest of the components use the normal syntax for composite
71               files creation.
72               </para>
73               <note><para>If the next component doesn't specify striping, such
74               as:
75               <screen>lfs setstripe -E 1M -L mdt -E EOF &lt;filename&gt;</screen>
76               Then that component get its settings from the default filesystem
77               striping.</para></note>
78           </section>
79           <section><title>Example</title>
80           <para>The command below creates a file with a DoM layout. The first
81           component has an <literal>mdt</literal> layout and is placed on the
82           MDT, covering [0, 1M). The second component covers [1M, EOF) and is
83           striped over all available OSTs.</para>
84           <para><screen>client$ lfs setstripe -E 1M -L mdt -E -1 -S 4M -c -1 \
85           /mnt/lustre/domfile</screen></para>
86           <para>The resulting layout is illustrated by
87           <xref xmlns:xlink="http://www.w3.org/1999/xlink"
88           linkend="dataonmdt.fig.layout1" />.</para>
89           <figure xml:id="dataonmdt.fig.layout1">
90               <title>Resulting file layout</title>
91               <mediaobject>
92                   <imageobject>
93                       <imagedata scalefit="1" width="50%"
94                       fileref="./figures/DoM_Layout1.png" />
95                   </imageobject>
96                   <textobject>
97                       <phrase>Resulting file layout</phrase>
98                   </textobject>
99               </mediaobject>
100           </figure>
101           <para>The resulting can also be checked with
102           <literal>lfs getstripe</literal> as shown below:</para>
103           <screen>client$ lfs getstripe /mnt/lustre/domfile
104 /mnt/lustre/domfile
105   lcm_layout_gen:   2
106   lcm_mirror_count: 1
107   lcm_entry_count:  2
108     lcme_id:             1
109     lcme_flags:          init
110     lcme_extent.e_start: 0
111     lcme_extent.e_end:   1048576
112       lmm_stripe_count:  0
113       lmm_stripe_size:   1048576
114       lmm_pattern:       mdt
115       lmm_layout_gen:    0
116       lmm_stripe_offset: 0
117       lmm_objects:
118       
119     lcme_id:             2
120     lcme_flags:          0
121     lcme_extent.e_start: 1048576
122     lcme_extent.e_end:   EOF
123       lmm_stripe_count:  -1
124       lmm_stripe_size:   4194304
125       lmm_pattern:       raid0
126       lmm_layout_gen:    65535
127       lmm_stripe_offset: -1</screen>
128           <para>The output above shows that the first component has size 1MB and
129           pattern is 'mdt'. The second component is not instantiated yet, which
130           is seen by <literal>lcme_flags: 0</literal>.</para>
131           <para>If more than 1MB of data is written to the file, then
132           <literal>lfs getstripe</literal> output is changed accordingly:</para>
133           <screen>client$ lfs getstripe /mnt/lustre/domfile
134 /mnt/lustre/domfile
135   lcm_layout_gen:   3
136   lcm_mirror_count: 1
137   lcm_entry_count:  2
138     lcme_id:             1
139     lcme_flags:          init
140     lcme_extent.e_start: 0
141     lcme_extent.e_end:   1048576
142       lmm_stripe_count:  0
143       lmm_stripe_size:   1048576
144       lmm_pattern:       mdt
145       lmm_layout_gen:    0
146       lmm_stripe_offset: 2
147       lmm_objects:
148       
149     lcme_id:             2
150     lcme_flags:          init
151     lcme_extent.e_start: 1048576
152     lcme_extent.e_end:   EOF
153       lmm_stripe_count:  2
154       lmm_stripe_size:   4194304
155       lmm_pattern:       raid0
156       lmm_layout_gen:    0
157       lmm_stripe_offset: 0
158       lmm_objects:
159       - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x2:0x0] }
160       - 1: { l_ost_idx: 1, l_fid: [0x100010000:0x2:0x0] }</screen>
161           <para>The output above shows that the second component now has objects
162           on OSTs with a 4MB stripe.</para>
163           </section>
164       </section>
165       <section><title>Setting a default DoM layout to an existing directory
166       </title>
167       <para>A DoM layout can be set on an existing directory as well. When
168           set, all the files created after that will inherit this layout by
169           default.</para>
170           <section><title>Command</title>
171               <screen>lfs setstripe --component-end|-E end1 --layout|-L mdt \
172 [--component-end|-E end2 [STRIPE_OPTIONS] ...] &lt;dirname&gt;</screen>
173           </section>
174           <section><title>Example</title>
175               <screen>client$ mkdir /mnt/lustre/domdir
176 client$ touch /mnt/lustre/domdir/normfile
177 client$ lfs setstripe -E 1M -L mdt -E -1 /mnt/lustre/domdir/
178 client$ lfs getstripe -d /mnt/lustre/domdir
179   lcm_layout_gen:   0
180   lcm_mirror_count: 1
181   lcm_entry_count:  2
182     lcme_id:             N/A
183     lcme_flags:          0
184     lcme_extent.e_start: 0
185     lcme_extent.e_end:   1048576
186       stripe_count:  0    stripe_size:   1048576    \
187       pattern:  mdt    stripe_offset:  -1
188     
189     lcme_id:             N/A
190     lcme_flags:          0
191     lcme_extent.e_start: 1048576
192     lcme_extent.e_end:   EOF
193       stripe_count:  1    stripe_size:   1048576    \
194       pattern:  raid0    stripe_offset:  -1
195               </screen>
196               <para>In the output above, it can be seen that the directory has
197               a default layout with a DoM component.</para>
198               <para>The following example will check layouts of files in that
199               directory:</para>
200               <screen>client$ touch /mnt/lustre/domdir/domfile
201 client$ lfs getstripe /mnt/lustre/domdir/normfile
202 /mnt/lustre/domdir/normfile
203 lmm_stripe_count:  2
204 lmm_stripe_size:   1048576
205 lmm_pattern:       raid0
206 lmm_layout_gen:    0
207 lmm_stripe_offset: 1
208   obdidx   objid   objid   group
209        1              3           0x3              0
210        0              3           0x3              0
211
212 client$ lfs getstripe /mnt/lustre/domdir/domfile
213 /mnt/lustre/domdir/domfile
214   lcm_layout_gen:   2
215   lcm_mirror_count: 1
216   lcm_entry_count:  2
217     lcme_id:             1
218     lcme_flags:          init
219     lcme_extent.e_start: 0
220     lcme_extent.e_end:   1048576
221       lmm_stripe_count:  0
222       lmm_stripe_size:   1048576
223       lmm_pattern:       mdt
224       lmm_layout_gen:    0
225       lmm_stripe_offset: 2
226       lmm_objects:
227       
228     lcme_id:             2
229     lcme_flags:          0
230     lcme_extent.e_start: 1048576
231     lcme_extent.e_end:   EOF
232       lmm_stripe_count:  1
233       lmm_stripe_size:   1048576
234       lmm_pattern:       raid0
235       lmm_layout_gen:    65535
236       lmm_stripe_offset: -1</screen>
237               <para>We can see that first file
238               <emphasis role="bold">normfile</emphasis> in that directory has an
239               ordinary layout, whereas the file <emphasis role="bold">domfile
240               </emphasis> inherits the directory default layout and is a DoM
241               file.</para>
242               <note><para>The directory default layout setting will be inherited
243               by new files even if the server DoM size limit will be set to a
244               lower value.</para></note>
245           </section>
246       </section>
247       <section xml:id="dbdoclet.domstripesize">
248           <title>
249               <indexterm>
250                   <primary>dom</primary>
251               </indexterm>
252               <indexterm>
253                   <primary>dom</primary>
254                   <secondary>domstripesize</secondary>
255               </indexterm>DoM Stripe Size Restrictions</title>
256           <para>The maximum size of a DoM component is restricted in several
257           ways to protect the MDT from being eventually filled with large files.
258           </para>
259           <section><title>LFS limits for DoM component size</title>
260               <para><literal>lfs setstripe</literal> allows for setting the
261               component size for MDT layouts up to 1GB (this is a compile-time
262               limit to avoid improper configuration), however, the size must
263               also be aligned by 64KB due to the minimum stripe size in Lustre
264               (see <xref linkend="settinguplustresystem.tab2"/>
265               <literal>Minimum stripe size</literal>).  There is also a limit
266               imposed on each file by <literal>lfs setstripe -E end</literal>
267               that may be smaller than the MDT-imposed limit if this is better
268               for a particular usage.</para>
269           </section>
270           <section><title>MDT Server Limits</title>
271               <para>The <literal>lod.$fsname-MDTxxxx.dom_stripesize</literal>
272               is used to control the per-MDT maximum size for a DoM component.
273               Larger DoM components specified by the user will be truncated to
274               the MDT-specified limit, and as such may be different on each
275               MDT to balance DoM space usage on each MDT separately, if needed.
276               It is 1MB by default and can be changed with the
277               <literal>lctl</literal> tool.  For more information on setting
278               <literal>dom_stripesize</literal> please see
279               <xref linkend="dbdoclet.dom_stripesize" />.</para>
280           </section>
281       </section>
282       <section xml:id="dbdoclet.domlfsgetstripe">
283           <title>
284               <indexterm>
285                   <primary>dom</primary>
286               </indexterm>
287               <indexterm>
288                   <primary>dom</primary>
289                   <secondary>lfsgetstripe</secondary>
290               </indexterm>lfs getstripe for DoM files</title>
291           <para>The <literal>lfs getstripe</literal> command is used to list
292           the striping/component information for a given file. For DoM files, it
293           can be used to check its layout and size.</para>
294           <section><title>Command</title>
295               <para><screen>lfs getstripe [--component-id|-I [comp_id]] [--layout|-L] \
296               [--stripe-size|-S] &lt;dirname|filename&gt;</screen></para>
297           </section>
298           <section><title>Examples</title>
299               <screen>client$ lfs getstripe -I1 /mnt/lustre/domfile
300 /mnt/lustre/domfile
301   lcm_layout_gen:   3
302   lcm_mirror_count: 1
303   lcm_entry_count:  2
304     lcme_id:             1
305     lcme_flags:          init
306     lcme_extent.e_start: 0
307     lcme_extent.e_end:   1048576
308       lmm_stripe_count:  0
309       lmm_stripe_size:   1048576
310       lmm_pattern:       mdt
311       lmm_layout_gen:    0
312       lmm_stripe_offset: 2
313       lmm_objects:</screen>
314               <para>Short info about the layout and size of DoM component can
315               be obtained with the use of the <literal>-L</literal> option
316               along with <literal>-S</literal> or <literal>-E</literal> options:
317               <screen>client$ lfs getstripe -I1 -L -S /mnt/lustre/domfile
318       lmm_stripe_size:   1048576
319       lmm_pattern:       mdt
320 client$ lfs getstripe -I1 -L -E /mnt/lustre/domfile
321     lcme_extent.e_end:   1048576
322       lmm_pattern:       mdt</screen>
323               Both commands return layout type and its size. The stripe size is
324               equal to the extent size of component in case of DoM files, so
325               both can be used to get size on the MDT.</para>
326           </section>
327       </section>
328       <section xml:id="dbdoclet.domlfsfind">
329           <title>
330               <indexterm>
331                   <primary>dom</primary>
332               </indexterm>
333               <indexterm>
334                   <primary>dom</primary>
335                   <secondary>lfsfind</secondary>
336               </indexterm>lfs find for DoM files</title>
337           <para>The <literal>lfs find</literal> command can be used to search
338           the directory tree rooted at the given directory or file name for the
339           files that match the given parameters. The command below shows the new
340           parameters for DoM files and their usages are similar to the
341           <literal>lfs getstripe</literal> command.</para>
342           <section><title>Command</title>
343               <para><screen>lfs find &lt;directory|filename&gt; [--layout|-L] [...]
344               </screen></para>
345           </section>
346           <section><title>Examples</title>
347               <para>Find all files with DoM layout under directory
348               <literal>/mnt/lustre</literal>:
349               <screen>client$ lfs find -L mdt /mnt/lustre
350 /mnt/lustre/domfile
351 /mnt/lustre/domdir
352 /mnt/lustre/domdir/domfile
353                           
354 client$ lfs find -L mdt -type f /mnt/lustre
355 /mnt/lustre/domfile
356 /mnt/lustre/domdir/domfile
357                           
358 client$ lfs find -L mdt -type d /mnt/lustre
359 /mnt/lustre/domdir</screen>
360               By using this command you can find all DoM objects, only DoM
361               files, or only directories with default DoM layout.</para>
362               <para>Find the DoM files/dirs with a particular stripe size:
363               <screen>client$ lfs find -L mdt -S -1200K -type f /mnt/lustre
364 /mnt/lustre/domfile
365 /mnt/lustre/domdir/domfile
366                           
367 client$ lfs find -L mdt -S +200K -type f /mnt/lustre
368 /mnt/lustre/domfile
369 /mnt/lustre/domdir/domfile</screen>
370               The first command finds all DoM files with stripe size less
371               than 1200KB.  The second command above does the same for files
372               with a stripe size greater than 200KB. In both cases, all DoM
373               files are found because their DoM size is 1MB.</para>
374           </section>
375       </section>
376       <section xml:id="dbdoclet.dom_stripesize">
377           <title>
378               <indexterm>
379                   <primary>dom</primary>
380               </indexterm>
381               <indexterm>
382                   <primary>dom</primary>
383                   <secondary>dom_stripesize</secondary>
384               </indexterm>The dom_stripesize parameter</title>
385           <para>The MDT controls the default maximum DoM size on the server via
386           the parameter <literal>dom_stripesize</literal> in the LOD device.
387           The <literal>dom_stripesize</literal> can be set differently for each
388           MDT, if necessary. The default value of the parameter is 1MB and can
389           be changed with <literal>lctl</literal> tool.</para>
390           <section><title>Get Command</title>
391               <para><screen>lctl get_param lod.*MDT&lt;index&gt;*.dom_stripesize
392               </screen></para>
393           </section>
394           <section><title>Get Examples</title>
395               <para>The commands below get the maximum allowed DoM size on the
396               server. The final command is an attempt to create a file with a
397               larger size than the parameter setting and correctly fails.
398               <screen>mds# lctl get_param lod.*MDT0000*.dom_stripesize
399 lod.lustre-MDT0000-mdtlov.dom_stripesize=1048576
400
401 mds# lctl get_param -n lod.*MDT0000*.dom_stripesize
402 1048576
403
404 client$ lfs setstripe -E 2M -L mdt /mnt/lustre/dom2mb
405 Create composite file /mnt/lustre/dom2mb failed. Invalid argument
406 error: setstripe: create composite file '/mnt/lustre/dom2mb' failed:
407 Invalid argument</screen></para>
408           </section>
409           <section><title>Temporary Set Command</title>
410               <para>To temporarily set the value of the parameter, the
411               <literal>lctl set_param</literal> is used:
412               <screen>lctl set_param lod.*MDT&lt;index&gt;*.dom_stripesize=&lt;value&gt;
413               </screen></para>
414           </section>
415           <section><title>Temporary Set Examples</title>
416               <para>The example below shows a change to the default DoM limit on
417               the server to 64KB and try to create a file with 1MB DoM size
418               after that.
419               <screen>mds# lctl set_param -n lod.*MDT0000*.dom_stripesize=64K
420 mds# lctl get_param -n lod.*MDT0000*.dom_stripesize
421 65536
422
423 client$ lfs setstripe -E 1M -L mdt /mnt/lustre/dom
424 Create composite file /mnt/lustre/dom failed. Invalid argument
425 error: setstripe: create composite file '/mnt/lustre/dom' failed:
426 Invalid argument</screen></para>
427           </section>
428           <section><title>Persistent Set Command</title>
429               <para>To persistently set the value of the parameter, the
430                   <literal>lctl conf_param</literal> command is used:
431                   <screen>lctl conf_param &lt;fsname&gt;-MDT&lt;index&gt;.lod.dom_stripesize=&lt;value&gt;
432                   </screen></para>
433           </section>
434           <section><title>Persistent Set Examples</title>
435               <para>The new value of the parameter is saved in config log
436               permanently:
437                   <screen>mgs# lctl conf_param lustre-MDT0000.lod.dom_stripesize=512K
438 mds# lctl get_param -n lod.*MDT0000*.dom_stripesize
439 524288</screen>
440               New settings are applied in few seconds and saved persistently in
441               server config.
442               </para>
443           </section>
444       </section>
445       <section xml:id="dbdoclet.disabledom">
446           <title>
447               <indexterm>
448                   <primary>dom</primary>
449               </indexterm>
450               <indexterm>
451                   <primary>dom</primary>
452                   <secondary>disabledom</secondary>
453               </indexterm>Disable DoM</title>
454           <para>When <literal>lctl set_param</literal> or
455             <literal>lctl conf_param</literal> sets
456             <literal>dom_stripesize</literal> to <literal>0</literal>, DoM
457             component creation will be disabled on the selected server, and
458             any <emphasis>new</emphasis> layouts with a specified DoM component
459             will have that component removed from the file layout. Existing
460             files and layouts with DoM components on that MDT are not changed.
461           </para>
462           <note><para>DoM files can still be created in existing directories
463           with a default DoM layout.</para></note>
464       </section>
465   </section>
466 </chapter>