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