Whamcloud - gitweb
LUDOC-304 tuning: support multiple modify RPCs in parallel
[doc/manual.git] / ManagingStripingFreeSpace.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="managingstripingfreespace">
2   <title xml:id="managingstripingfreespace.title">Managing File Layout (Striping) and Free
3     Space</title>
4   <para>This chapter describes file layout (striping) and I/O options, and includes the following
5     sections:</para>
6   <itemizedlist>
7     <listitem>
8       <para><xref linkend="dbdoclet.50438209_79324"/></para>
9     </listitem>
10     <listitem>
11       <para><xref linkend="dbdoclet.50438209_48033"/></para>
12     </listitem>
13     <listitem>
14       <para><xref linkend="dbdoclet.50438209_78664"/></para>
15     </listitem>
16     <listitem>
17       <para><xref linkend="dbdoclet.50438209_44776"/></para>
18     </listitem>
19     <listitem>
20       <para><xref linkend="dbdoclet.50438209_10424"/></para>
21     </listitem>
22     <listitem>
23       <para><xref xmlns:xlink="http://www.w3.org/1999/xlink" linkend="section_syy_gcl_qk"/></para>
24     </listitem>
25   </itemizedlist>
26   <section xml:id="dbdoclet.50438209_79324">
27       <title>
28       <indexterm>
29         <primary>space</primary>
30       </indexterm>
31       <indexterm>
32         <primary>striping</primary>
33         <secondary>how it works</secondary>
34       </indexterm>
35       <indexterm>
36         <primary>striping</primary>
37         <see>space</see>
38       </indexterm>
39       <indexterm>
40         <primary>space</primary>
41         <secondary>striping</secondary>
42       </indexterm>How Lustre File System Striping Works</title>
43     <para>In a Lustre file system, the MDS allocates objects to OSTs using either a round-robin
44       algorithm or a weighted algorithm. When the amount of free space is well balanced (i.e., by
45       default, when the free space across OSTs differs by less than 17%), the round-robin algorithm
46       is used to select the next OST to which a stripe is to be written. Periodically, the MDS
47       adjusts the striping layout to eliminate some degenerated cases in which applications that
48       create very regular file layouts (striping patterns) preferentially use a particular OST in
49       the sequence.</para>
50     <para> Normally the usage of OSTs is well balanced. However, if users create a small number of
51       exceptionally large files or incorrectly specify striping parameters, imbalanced OST usage may
52       result. When the free space across OSTs differs by more than a specific amount (17% by
53       default), the MDS then uses weighted random allocations with a preference for allocating
54       objects on OSTs with more free space. (This can reduce I/O performance until space usage is
55       rebalanced again.) For a more detailed description of how striping is allocated, see <xref
56         linkend="dbdoclet.50438209_10424"/>.</para>
57     <para condition="l22">Files can only be striped over a finite number of OSTs. Prior to Lustre
58       software release 2.2, the maximum number of OSTs that a file could be striped across was
59       limited to 160. As of Lustre software release 2.2, the maximum number of OSTs is 2000. For
60       more information, see <xref xmlns:xlink="http://www.w3.org/1999/xlink"
61         linkend="section_syy_gcl_qk"/>.</para>
62   </section>
63   <section xml:id="dbdoclet.50438209_48033">
64       <title><indexterm>
65         <primary>file layout</primary>
66         <secondary>See striping</secondary>
67       </indexterm><indexterm>
68         <primary>striping</primary>
69         <secondary>considerations</secondary>
70       </indexterm>
71       <indexterm>
72         <primary>space</primary>
73         <secondary>considerations</secondary>
74       </indexterm> Lustre File Layout (Striping) Considerations</title>
75     <para>Whether you should set up file striping and what parameter values you select depends on
76       your needs. A good rule of thumb is to stripe over as few objects as will meet those needs and
77       no more.</para>
78     <para>Some reasons for using striping include:</para>
79     <itemizedlist>
80       <listitem>
81         <para><emphasis role="bold">Providing high-bandwidth access.</emphasis> Many applications
82           require high-bandwidth access to a single file, which may be more bandwidth than can be
83           provided by a single OSS. Examples are a scientific application that writes to a single
84           file from hundreds of nodes, or a binary executable that is loaded by many nodes when an
85           application starts.</para>
86         <para>In cases like these, a file can be striped over as many OSSs as it takes to achieve
87           the required peak aggregate bandwidth for that file. Striping across a larger number of
88           OSSs should only be used when the file size is very large and/or is accessed by many nodes
89           at a time. Currently, Lustre files can be striped across up to 2000 OSTs, the maximum
90           stripe count for an <literal>ldiskfs</literal> file system.</para>
91       </listitem>
92       <listitem>
93         <para><emphasis role="bold">Improving performance when OSS bandwidth is exceeded.</emphasis>
94           Striping across many OSSs can improve performance if the aggregate client bandwidth
95           exceeds the server bandwidth and the application reads and writes data fast enough to take
96           advantage of the additional OSS bandwidth. The largest useful stripe count is bounded by
97           the I/O rate of the clients/jobs divided by the performance per OSS.</para>
98       </listitem>
99       <listitem>
100         <para><emphasis role="bold">Providing space for very large files.</emphasis> Striping is
101           useful when a single OST does not have enough free space to hold the entire file.</para>
102       </listitem>
103     </itemizedlist>
104     <para>Some reasons to minimize or avoid striping:</para>
105     <itemizedlist>
106       <listitem>
107         <para><emphasis role="bold">Increased overhead.</emphasis> Striping results in more locks
108           and extra network operations during common operations such as <literal>stat</literal> and
109             <literal>unlink</literal>. Even when these operations are performed in parallel, one
110           network operation takes less time than 100 operations.</para>
111         <para>Increased overhead also results from server contention. Consider a cluster with 100
112           clients and 100 OSSs, each with one OST. If each file has exactly one object and the load
113           is distributed evenly, there is no contention and the disks on each server can manage
114           sequential I/O. If each file has 100 objects, then the clients all compete with one
115           another for the attention of the servers, and the disks on each node seek in 100 different
116           directions resulting in needless contention.</para>
117       </listitem>
118       <listitem>
119         <para><emphasis role="bold">Increased risk.</emphasis> When files are striped across all
120           servers and one of the servers breaks down, a small part of each striped file is lost. By
121           comparison, if each file has exactly one stripe, fewer files are lost, but they are lost
122           in their entirety. Many users would prefer to lose some of their files entirely than all
123           of their files partially.</para>
124       </listitem>
125     </itemizedlist>
126     <section remap="h3">
127         <title><indexterm><primary>striping</primary><secondary>size</secondary></indexterm>
128             Choosing a Stripe Size</title>
129       <para>Choosing a stripe size is a balancing act, but reasonable defaults are described below.
130         The stripe size has no effect on a single-stripe file.</para>
131       <itemizedlist>
132         <listitem>
133           <para><emphasis role="bold">The stripe size must be a multiple of the page
134               size.</emphasis> Lustre software tools enforce a multiple of 64 KB (the maximum page
135             size on ia64 and PPC64 nodes) so that users on platforms with smaller pages do not
136             accidentally create files that might cause problems for ia64 clients.</para>
137         </listitem>
138         <listitem>
139           <para><emphasis role="bold">The smallest recommended stripe size is 512 KB.</emphasis>
140             Although you can create files with a stripe size of 64 KB, the smallest practical stripe
141             size is 512 KB because the Lustre file system sends 1MB chunks over the network.
142             Choosing a smaller stripe size may result in inefficient I/O to the disks and reduced
143             performance.</para>
144         </listitem>
145         <listitem>
146           <para><emphasis role="bold">A good stripe size for sequential I/O using high-speed
147               networks is between 1 MB and 4 MB.</emphasis> In most situations, stripe sizes larger
148             than 4 MB may result in longer lock hold times and contention during shared file
149             access.</para>
150         </listitem>
151         <listitem>
152           <para><emphasis role="bold">The maximum stripe size is 4 GB.</emphasis> Using a large
153             stripe size can improve performance when accessing very large files. It allows each
154             client to have exclusive access to its own part of a file. However, a large stripe size
155             can be counterproductive in cases where it does not match your I/O pattern.</para>
156         </listitem>
157         <listitem>
158           <para><emphasis role="bold">Choose a stripe pattern that takes into account the write
159               patterns of your application.</emphasis> Writes that cross an object boundary are
160             slightly less efficient than writes that go entirely to one server. If the file is
161             written in a consistent and aligned way, make the stripe size a multiple of the
162               <literal>write()</literal> size.</para>
163         </listitem>
164       </itemizedlist>
165     </section>
166   </section>
167   <section xml:id="dbdoclet.50438209_78664">
168       <title><indexterm>
169         <primary>striping</primary>
170         <secondary>configuration</secondary>
171       </indexterm>Setting the File Layout/Striping Configuration (<literal>lfs
172       setstripe</literal>)</title>
173     <para>Use the <literal>lfs setstripe</literal> command to create new files with a specific file layout (stripe pattern) configuration.</para>
174     <screen>lfs setstripe [--size|-s stripe_size] [--count|-c stripe_count] \
175 [--index|-i start_ost] [--pool|-p pool_name] <replaceable>filename|dirname</replaceable> </screen>
176     <para><emphasis role="bold">
177         <literal>stripe_size</literal>
178       </emphasis>
179       </para>
180     <para>The <literal>stripe_size</literal> indicates how much data to write to one OST before
181       moving to the next OST. The default <literal>stripe_size</literal> is 1 MB. Passing a
182         <literal>stripe_size</literal> of 0 causes the default stripe size to be used. Otherwise,
183       the <literal>stripe_size</literal> value must be a multiple of 64 KB.</para>
184     <para><emphasis role="bold">
185         <literal>stripe_count</literal>
186       </emphasis>
187       </para>
188     <para>The <literal>stripe_count</literal> indicates how many OSTs to use. The default <literal>stripe_count</literal> value is 1. Setting <literal>stripe_count</literal> to 0 causes the default stripe count to be used. Setting <literal>stripe_count</literal> to -1 means stripe over all available OSTs (full OSTs are skipped).</para>
189     <para><emphasis role="bold">
190         <literal>start_ost</literal>
191       </emphasis>
192       </para>
193     <para>The start OST is the first OST to which files are written. The default value for
194         <literal>start_ost</literal> is -1, which allows the MDS to choose the starting index. This
195       setting is strongly recommended, as it allows space and load balancing to be done by the MDS
196       as needed. If the value of <literal>start_ost</literal> is set to a value other than -1, the
197       file starts on the specified OST index. OST index numbering starts at 0.</para>
198     <note>
199       <para>If the specified OST is inactive or in a degraded mode, the MDS will silently choose
200         another target.</para>
201     </note>
202     <note>
203       <para>If you pass a <literal>start_ost</literal> value of 0 and a
204           <literal>stripe_count</literal> value of <emphasis>1</emphasis>, all files are written to
205         OST 0, until space is exhausted. <emphasis role="italic">This is probably not what you meant
206           to do.</emphasis> If you only want to adjust the stripe count and keep the other
207         parameters at their default settings, do not specify any of the other parameters:</para>
208       <para><screen>client# lfs setstripe -c <replaceable>stripe_count</replaceable> <replaceable>filename</replaceable></screen></para>
209     </note>
210     <para><emphasis role="bold">
211         <literal>pool_name</literal>
212       </emphasis>
213       </para>
214     <para>The <literal>pool_name</literal> specifies the OST pool to which the file will be written.
215       This allows limiting the OSTs used to a subset of all OSTs in the file system. For more
216       details about using OST pools, see <link xl:href="ManagingFileSystemIO.html#50438211_75549"
217         >Creating and Managing OST Pools</link>.</para>
218     <section remap="h3">
219       <title>Specifying a File Layout (Striping Pattern) for a Single File</title>
220       <para>It is possible to specify the file layout when a new file is created using the command <literal>lfs setstripe</literal>. This allows users to override the file system default parameters to tune the file layout more optimally for their application. Execution of an <literal>lfs setstripe</literal> command fails if the file already exists.</para>
221       <section xml:id="dbdoclet.50438209_60155">
222         <title>Setting the Stripe Size</title>
223         <para>The command to create a new file with a specified stripe size is similar to:</para>
224         <screen>[client]# lfs setstripe -s 4M /mnt/lustre/new_file</screen>
225         <para>This example command creates the new file <literal>/mnt/lustre/new_file</literal> with a stripe size of 4 MB.</para>
226         <para>Now, when a file is created, the new stripe setting evenly distributes the data over all the available OSTs:</para>
227         <screen> [client]# lfs getstripe /mnt/lustre/new_file
228 /mnt/lustre/4mb_file
229 lmm_stripe_count:   1
230 lmm_stripe_size:    4194304
231 lmm_stripe_offset:  1
232 obdidx     objid        objid           group
233 1          690550       0xa8976         0 </screen>
234         <para>In this example, the stripe size is 4 MB.</para>
235       </section>
236       <section remap="h4">
237           <title><indexterm><primary>striping</primary><secondary>count</secondary></indexterm>
238               Setting the Stripe Count</title>
239         <para>The command below creates a new file with a stripe count of <literal>-1</literal> to
240           specify striping over all available OSTs:</para>
241         <screen>[client]# lfs setstripe -c -1 /mnt/lustre/full_stripe</screen>
242         <para>The example below indicates that the file <literal>full_stripe</literal> is striped
243           over all six active OSTs in the configuration:</para>
244         <screen>[client]# lfs getstripe /mnt/lustre/full_stripe
245 /mnt/lustre/full_stripe
246   obdidx   objid   objid   group
247   0        8       0x8     0
248   1        4       0x4     0
249   2        5       0x5     0
250   3        5       0x5     0
251   4        4       0x4     0
252   5        2       0x2     0</screen>
253         <para> This is in contrast to the output in <xref linkend="dbdoclet.50438209_60155"/>, which
254           shows only a single object for the file.</para>
255       </section>
256     </section>
257     <section remap="h3">
258       <title><indexterm>
259           <primary>striping</primary>
260           <secondary>per directory</secondary>
261         </indexterm>Setting the Striping Layout for a Directory</title>
262       <para>In a directory, the <literal>lfs setstripe</literal> command sets a default striping
263         configuration for files created in the directory. The usage is the same as <literal>lfs
264           setstripe</literal> for a regular file, except that the directory must exist prior to
265         setting the default striping configuration. If a file is created in a directory with a
266         default stripe configuration (without otherwise specifying striping), the Lustre file system
267         uses those striping parameters instead of the file system default for the new file.</para>
268       <para>To change the striping pattern for a sub-directory, create a directory with desired file
269         layout as described above. Sub-directories inherit the file layout of the root/parent
270         directory.</para>
271     </section>
272     <section remap="h3">
273       <title><indexterm>
274           <primary>striping</primary>
275           <secondary>per file system</secondary>
276         </indexterm>Setting the Striping Layout for a File System</title>
277       <para>Setting the striping specification on the <literal>root</literal> directory determines
278         the striping for all new files created in the file system unless an overriding striping
279         specification takes precedence (such as a striping layout specified by the application, or
280         set using <literal>lfs setstripe</literal>, or specified for the parent directory).</para>
281       <note>
282         <para>The striping settings for a <literal>root</literal> directory are, by default, applied
283           to any new child directories created in the root directory, unless striping settings have
284           been specified for the child directory.</para>
285       </note>
286     </section>
287     <section remap="h3">
288       <title><indexterm>
289           <primary>striping</primary>
290           <secondary>on specific OST</secondary>
291         </indexterm>Creating a File on a Specific OST</title>
292       <para>You can use <literal>lfs setstripe</literal> to create a file on a specific OST. In the
293         following example, the file <literal>file1</literal> is created on the first OST (OST index
294         is 0).</para>
295       <screen>$ lfs setstripe --count 1 --index 0 file1
296 $ dd if=/dev/zero of=file1 count=1 bs=100M
297 1+0 records in
298 1+0 records out
299
300 $ lfs getstripe file1
301 /mnt/testfs/file1
302 /mnt/testfs/file1
303 lmm_stripe_count:   1
304 lmm_stripe_size:    1048576
305 lmm_stripe_offset:  0               
306      obdidx    objid   objid    group                    
307      0         37364   0x91f4   0</screen>
308     </section>
309   </section>
310   <section xml:id="dbdoclet.50438209_44776">
311     <title><indexterm><primary>striping</primary><secondary>getting information</secondary></indexterm>Retrieving File Layout/Striping Information (<literal>getstripe</literal>)</title>
312     <para>The <literal>lfs getstripe</literal> command is used to display information that shows
313       over which OSTs a file is distributed. For each OST, the index and UUID is displayed, along
314       with the OST index and object ID for each stripe in the file. For directories, the default
315       settings for files created in that directory are displayed.</para>
316     <section remap="h3">
317       <title>Displaying the Current Stripe Size</title>
318       <para>To see the current stripe size for a Lustre file or directory, use the <literal>lfs
319           getstripe</literal> command. For example, to view information for a directory, enter a
320         command similar to:</para>
321       <screen>[client]# lfs getstripe /mnt/lustre </screen>
322       <para>This command produces output similar to:</para>
323       <screen>/mnt/lustre 
324 (Default) stripe_count: 1 stripe_size: 1M stripe_offset: -1</screen>
325       <para>In this example, the default stripe count is <literal>1</literal> (data blocks are
326         striped over a single OST), the default stripe size is 1 MB, and the objects are created
327         over all available OSTs.</para>
328       <para>To view information for a file, enter a command similar to:</para>
329       <screen>$ lfs getstripe /mnt/lustre/foo
330 /mnt/lustre/foo
331   obdidx   objid    objid      group
332   2        835487   m0xcbf9f   0 </screen>
333       <para>In this example, the file is located on <literal>obdidx 2</literal>, which corresponds
334         to the OST <literal>lustre-OST0002</literal>. To see which node is serving that OST, run:
335         <screen>$ lctl get_param osc.lustre-OST0002-osc.ost_conn_uuid
336 osc.lustre-OST0002-osc.ost_conn_uuid=192.168.20.1@tcp</screen></para>
337     </section>
338     <section remap="h3">
339       <title>Inspecting the File Tree</title>
340       <para>To inspect an entire tree of files, use the <literal>lfs find</literal>  command:</para>
341       <screen>lfs find [--recursive | -r] <replaceable>file|directory</replaceable> ...</screen>
342     </section>
343         <section>
344       <title><indexterm>
345           <primary>striping</primary>
346           <secondary>remote directories</secondary>
347         </indexterm>Locating the MDT for a remote directory</title>
348       <para condition="l24">Lustre software release 2.4 can be configured with multiple MDTs in the
349         same file system. Each sub-directory can have a different MDT. To identify on which MDT a
350         given subdirectory is located, pass the <literal>getstripe -M</literal> parameters to
351           <literal>lfs</literal>. An example of this command is provided in the section <xref
352           linkend="dbdoclet.rmremotedir"/>.</para>
353     </section>
354   </section>
355   <section xml:id="dbdoclet.50438209_10424">
356     <title><indexterm>
357         <primary>space</primary>
358         <secondary>free space</secondary>
359       </indexterm><indexterm>
360         <primary>striping</primary>
361         <secondary>round-robin algorithm</secondary>
362       </indexterm><indexterm>
363         <primary>striping</primary>
364         <secondary>weighted algorithm</secondary>
365       </indexterm><indexterm>
366         <primary>round-robin algorithm</primary>
367       </indexterm><indexterm>
368         <primary>weighted algorithm</primary>
369       </indexterm>Managing Free Space</title>
370     <para>To optimize file system performance, the MDT assigns file stripes to OSTs based on two
371       allocation algorithms. The <emphasis role="italic">round-robin</emphasis> allocator gives
372       preference to location (spreading out stripes across OSSs to increase network bandwidth
373       utilization) and the weighted allocator gives preference to available space (balancing loads
374       across OSTs). Threshold and weighting factors for these two algorithms can be adjusted by the
375       user. This section describes how to check available free space on disks and how free space is
376       allocated. It then describes how to set the threshold and weighting factors for the allocation
377       algorithms.</para>
378     <section xml:id="dbdoclet.50438209_35838">
379       <title>Checking File System Free Space</title>
380       <para>Free space is an important consideration in assigning file stripes. The <literal>lfs
381           df</literal> command can be used to show available disk space on the mounted Lustre file
382         system and space consumption per OST. If multiple Lustre file systems are mounted, a path
383         may be specified, but is not required. Options to the <literal>lfs df</literal> command are
384         shown below.</para>
385       <informaltable frame="all">
386         <tgroup cols="2">
387           <colspec colname="c1" colwidth="50*"/>
388           <colspec colname="c2" colwidth="50*"/>
389           <thead>
390             <row>
391               <entry>
392                 <para><emphasis role="bold">Option</emphasis></para>
393               </entry>
394               <entry>
395                 <para><emphasis role="bold">Description</emphasis></para>
396               </entry>
397             </row>
398           </thead>
399           <tbody>
400             <row>
401               <entry>
402                 <para> <literal>-h</literal></para>
403               </entry>
404               <entry>
405                 <para> Displays sizes in human readable format (for example: 1K, 234M, 5G).</para>
406               </entry>
407             </row>
408             <row>
409               <entry>
410                 <para> <literal role="bold">-i, --inodes</literal></para>
411               </entry>
412               <entry>
413                 <para> Lists inodes instead of block usage.</para>
414               </entry>
415             </row>
416           </tbody>
417         </tgroup>
418       </informaltable>
419       <note>
420         <para>The <literal>df -i</literal> and <literal>lfs df -i</literal> commands show the
421             <emphasis role="italic">minimum</emphasis> number of inodes that can be created in the
422           file system at the current time. If the total number of objects available across all of
423           the OSTs is smaller than those available on the MDT(s), taking into account the default
424           file striping, then <literal>df -i</literal> will also report a smaller number of inodes
425           than could be created. Running <literal>lfs df -i</literal> will report the actual number
426           of inodes that are free on each target.</para>
427         <para>For ZFS file systems, the number of inodes that can be created is dynamic and depends
428           on the free space in the file system. The Free and Total inode counts reported for a ZFS
429           file system are only an estimate based on the current usage for each target. The Used
430           inode count is the actual number of inodes used by the file system.</para>
431       </note>
432       <para><emphasis role="bold">Examples</emphasis></para>
433       <screen>[client1] $ lfs df
434 UUID                1K-blockS  Used      Available Use% Mounted on
435 mds-lustre-0_UUID   9174328    1020024   8154304   11%  /mnt/lustre[MDT:0]
436 ost-lustre-0_UUID   94181368   56330708  37850660  59%  /mnt/lustre[OST:0]
437 ost-lustre-1_UUID   94181368   56385748  37795620  59%  /mnt/lustre[OST:1]
438 ost-lustre-2_UUID   94181368   54352012  39829356  57%  /mnt/lustre[OST:2]
439 filesystem summary: 282544104  167068468 39829356  57%  /mnt/lustre
440  
441 [client1] $ lfs df -h
442 UUID                bytes    Used    Available   Use%  Mounted on
443 mds-lustre-0_UUID   8.7G     996.1M  7.8G        11%   /mnt/lustre[MDT:0]
444 ost-lustre-0_UUID   89.8G    53.7G   36.1G       59%   /mnt/lustre[OST:0]
445 ost-lustre-1_UUID   89.8G    53.8G   36.0G       59%   /mnt/lustre[OST:1]
446 ost-lustre-2_UUID   89.8G    51.8G   38.0G       57%   /mnt/lustre[OST:2]
447 filesystem summary: 269.5G   159.3G  110.1G      59%   /mnt/lustre
448  
449 [client1] $ lfs df -i 
450 UUID                Inodes  IUsed IFree   IUse% Mounted on
451 mds-lustre-0_UUID   2211572 41924 2169648 1%    /mnt/lustre[MDT:0]
452 ost-lustre-0_UUID   737280  12183 725097  1%    /mnt/lustre[OST:0]
453 ost-lustre-1_UUID   737280  12232 725048  1%    /mnt/lustre[OST:1]
454 ost-lustre-2_UUID   737280  12214 725066  1%    /mnt/lustre[OST:2]
455 filesystem summary: 2211572 41924 2169648 1%    /mnt/lustre[OST:2]</screen>
456     </section>
457     <section remap="h3">
458         <title><indexterm>
459           <primary>striping</primary>
460           <secondary>allocations</secondary>
461         </indexterm> Stripe Allocation Methods</title>
462       <para>Two stripe allocation methods are provided:</para>
463       <itemizedlist>
464         <listitem>
465           <para><emphasis role="bold">Round-robin allocator</emphasis> - When the OSTs have
466             approximately the same amount of free space, the round-robin allocator alternates
467             stripes between OSTs on different OSSs, so the OST used for stripe 0 of each file is
468             evenly distributed among OSTs, regardless of the stripe count. In a simple example with
469             eight OSTs numbered 0-7, objects would be allocated like this:</para>
470           <para>
471             <screen>File 1: OST1, OST2, OST3, OST4
472 File 2: OST5, OST6, OST7
473 File 3: OST0, OST1, OST2, OST3, OST4, OST5
474 File 4: OST6, OST7, OST0</screen>
475           </para>
476           <para>Here are several more sample round-robin stripe orders (each letter represents a
477             different OST on a single OSS):</para>
478           <informaltable frame="none">
479             <tgroup cols="2">
480               <colspec colname="c1" colwidth="50*"/>
481               <colspec colname="c2" colwidth="50*"/>
482               <tbody>
483                 <row>
484                   <entry>
485                     <para> 3: AAA</para>
486                   </entry>
487                   <entry>
488                     <para> One 3-OST OSS</para>
489                   </entry>
490                 </row>
491                 <row>
492                   <entry>
493                     <para> 3x3: ABABAB</para>
494                   </entry>
495                   <entry>
496                     <para> Two 3-OST OSSs</para>
497                   </entry>
498                 </row>
499                 <row>
500                   <entry>
501                     <para> 3x4: BBABABA</para>
502                   </entry>
503                   <entry>
504                     <para> One 3-OST OSS (A) and one 4-OST OSS (B)</para>
505                   </entry>
506                 </row>
507                 <row>
508                   <entry>
509                     <para> 3x5: BBABBABA</para>
510                   </entry>
511                   <entry>
512                     <para> One 3-OST OSS (A) and one 5-OST OSS (B)</para>
513                   </entry>
514                 </row>
515                 <row>
516                   <entry>
517                     <para> 3x3x3: ABCABCABC</para>
518                   </entry>
519                   <entry>
520                     <para> Three 3-OST OSSs</para>
521                   </entry>
522                 </row>
523               </tbody>
524             </tgroup>
525           </informaltable>
526         </listitem>
527         <listitem>
528           <para><emphasis role="bold">Weighted allocator</emphasis> - When the free space difference
529             between the OSTs becomes significant, the weighting algorithm is used to influence OST
530             ordering based on size (amount of free space available on each OST) and location
531             (stripes evenly distributed across OSTs). The weighted allocator fills the emptier OSTs
532             faster, but uses a weighted random algorithm, so the OST with the most free space is not
533             necessarily chosen each time.</para>
534         </listitem>
535       </itemizedlist>
536       <para>The allocation method is determined by the amount of free-space imbalance on the OSTs.
537         When free space is relatively balanced across OSTs, the faster round-robin allocator is
538         used, which maximizes network balancing. The weighted allocator is used when any two OSTs
539         are out of balance by more than the specified threshold (17% by default). The threshold
540         between the two allocation methods is defined in the file
541             <literal>/proc/fs/<replaceable>fsname</replaceable>/lov/<replaceable>fsname</replaceable>-mdtlov/qos_threshold_rr</literal>. </para>
542       <para>To set the <literal>qos_threshold_r</literal> to <literal>25</literal>,  enter this
543         command on the
544         MGS:<screen>lctl set_param lov.<replaceable>fsname</replaceable>-mdtlov.quos_threshold_rr=25</screen></para>
545     </section>
546     <section remap="h3">
547       <title><indexterm>
548           <primary>space</primary>
549           <secondary>location weighting</secondary>
550         </indexterm>Adjusting the Weighting Between Free Space and Location</title>
551       <para>The weighting priority used by the weighted allocator is set in the file
552             <literal>/proc/fs/<replaceable>fsname</replaceable>/lov/<replaceable>fsname</replaceable>-mdtlov/qos_prio_free</literal>.
553         Increasing the value of <literal>qos_prio_free</literal> puts more weighting on the amount
554         of free space available on each OST and less on how stripes are distributed across OSTs. The
555         default value is <literal>91</literal> (percent). When the free space priority is set to
556           <literal>100</literal> (percent), weighting is based entirely on free space and location
557         is no longer used by the striping algorthm. </para>
558       <para>To change the allocator weighting to <literal>100</literal>, enter this command on the
559         MGS:</para>
560       <screen>lctl conf_param <replaceable>fsname</replaceable>-MDT0000.lov.qos_prio_free=100</screen>
561       <para> .</para>
562       <note>
563         <para>When <literal>qos_prio_free</literal> is set to <literal>100</literal>, a weighted
564           random algorithm is still used to assign stripes, so, for example, if OST2 has twice as
565           much free space as OST1, OST2 is twice as likely to be used, but it is not guaranteed to
566           be used.</para>
567       </note>
568     </section>
569   </section>
570   <section xml:id="section_syy_gcl_qk">
571     <title><indexterm>
572         <primary>striping</primary>
573         <secondary>wide striping</secondary>
574       </indexterm><indexterm>
575         <primary>wide striping</primary>
576       </indexterm>Lustre Striping Internals</title>
577     <para>For Lustre releases prior to Lustre software release 2.2, files can be striped across a
578       maximum of 160 OSTs. Lustre inodes use an extended attribute to record the location of each
579       object (the object ID and the number of the OST on which it is stored). The size of the
580       extended attribute limits the maximum stripe count to 160 objects.</para>
581     <para condition="l22">In Lustre software release 2.2 and subsequent releases, the maximum number
582       of OSTs over which files can be striped has been raised to 2000 by allocating a new block on
583       which to store the extended attribute that holds the object information. This feature, known
584       as "wide striping," only allocates the additional extended attribute data block if the file is
585       striped with a stripe count greater than 160. The file layout (object ID, OST number) is
586       stored on the new data block with a pointer to this block stored in the original Lustre inode
587       for the file. For files smaller than 160 objects, the Lustre inode is used to store the file
588       layout.</para>
589   </section>
590 </chapter>