Whamcloud - gitweb
LUDOC-328 tbf: add HTC strategy to NRS-TBF section
[doc/manual.git] / LustreTuning.xml
1 <?xml version='1.0' encoding='utf-8'?>
2 <chapter xmlns="http://docbook.org/ns/docbook"
3 xmlns:xl="http://www.w3.org/1999/xlink" version="5.0" xml:lang="en-US"
4 xml:id="lustretuning">
5   <title xml:id="lustretuning.title">Tuning a Lustre File System</title>
6   <para>This chapter contains information about tuning a Lustre file system for
7   better performance.</para>
8   <note>
9     <para>Many options in the Lustre software are set by means of kernel module
10     parameters. These parameters are contained in the 
11     <literal>/etc/modprobe.d/lustre.conf</literal> file.</para>
12   </note>
13   <section xml:id="dbdoclet.50438272_55226">
14     <title>
15     <indexterm>
16       <primary>tuning</primary>
17     </indexterm>
18     <indexterm>
19       <primary>tuning</primary>
20       <secondary>service threads</secondary>
21     </indexterm>Optimizing the Number of Service Threads</title>
22     <para>An OSS can have a minimum of two service threads and a maximum of 512
23     service threads. The number of service threads is a function of how much
24     RAM and how many CPUs are on each OSS node (1 thread / 128MB * num_cpus).
25     If the load on the OSS node is high, new service threads will be started in
26     order to process more requests concurrently, up to 4x the initial number of
27     threads (subject to the maximum of 512). For a 2GB 2-CPU system, the
28     default thread count is 32 and the maximum thread count is 128.</para>
29     <para>Increasing the size of the thread pool may help when:</para>
30     <itemizedlist>
31       <listitem>
32         <para>Several OSTs are exported from a single OSS</para>
33       </listitem>
34       <listitem>
35         <para>Back-end storage is running synchronously</para>
36       </listitem>
37       <listitem>
38         <para>I/O completions take excessive time due to slow storage</para>
39       </listitem>
40     </itemizedlist>
41     <para>Decreasing the size of the thread pool may help if:</para>
42     <itemizedlist>
43       <listitem>
44         <para>Clients are overwhelming the storage capacity</para>
45       </listitem>
46       <listitem>
47         <para>There are lots of "slow I/O" or similar messages</para>
48       </listitem>
49     </itemizedlist>
50     <para>Increasing the number of I/O threads allows the kernel and storage to
51     aggregate many writes together for more efficient disk I/O. The OSS thread
52     pool is shared--each thread allocates approximately 1.5 MB (maximum RPC
53     size + 0.5 MB) for internal I/O buffers.</para>
54     <para>It is very important to consider memory consumption when increasing
55     the thread pool size. Drives are only able to sustain a certain amount of
56     parallel I/O activity before performance is degraded, due to the high
57     number of seeks and the OST threads just waiting for I/O. In this
58     situation, it may be advisable to decrease the load by decreasing the
59     number of OST threads.</para>
60     <para>Determining the optimum number of OSS threads is a process of trial
61     and error, and varies for each particular configuration. Variables include
62     the number of OSTs on each OSS, number and speed of disks, RAID
63     configuration, and available RAM. You may want to start with a number of
64     OST threads equal to the number of actual disk spindles on the node. If you
65     use RAID, subtract any dead spindles not used for actual data (e.g., 1 of N
66     of spindles for RAID5, 2 of N spindles for RAID6), and monitor the
67     performance of clients during usual workloads. If performance is degraded,
68     increase the thread count and see how that works until performance is
69     degraded again or you reach satisfactory performance.</para>
70     <note>
71       <para>If there are too many threads, the latency for individual I/O
72       requests can become very high and should be avoided. Set the desired
73       maximum thread count permanently using the method described above.</para>
74     </note>
75     <section>
76       <title>
77       <indexterm>
78         <primary>tuning</primary>
79         <secondary>OSS threads</secondary>
80       </indexterm>Specifying the OSS Service Thread Count</title>
81       <para>The 
82       <literal>oss_num_threads</literal> parameter enables the number of OST
83       service threads to be specified at module load time on the OSS
84       nodes:</para>
85       <screen>
86 options ost oss_num_threads={N}
87 </screen>
88       <para>After startup, the minimum and maximum number of OSS thread counts
89       can be set via the 
90       <literal>{service}.thread_{min,max,started}</literal> tunable. To change
91       the tunable at runtime, run:</para>
92       <para>
93         <screen>
94 lctl {get,set}_param {service}.thread_{min,max,started}
95 </screen>
96       </para>
97       <para>
98       This works in a similar fashion to 
99       binding of threads on MDS. MDS thread tuning is covered in 
100       <xref linkend="dbdoclet.mdsbinding" />.</para>
101       <itemizedlist>
102         <listitem>
103           <para>
104           <literal>oss_cpts=[EXPRESSION]</literal> binds the default OSS service
105           on CPTs defined by 
106           <literal>[EXPRESSION]</literal>.</para>
107         </listitem>
108         <listitem>
109           <para>
110           <literal>oss_io_cpts=[EXPRESSION]</literal> binds the IO OSS service
111           on CPTs defined by 
112           <literal>[EXPRESSION]</literal>.</para>
113         </listitem>
114       </itemizedlist>
115       <para>For further details, see 
116       <xref linkend="dbdoclet.50438271_87260" />.</para>
117     </section>
118     <section xml:id="dbdoclet.mdstuning">
119       <title>
120       <indexterm>
121         <primary>tuning</primary>
122         <secondary>MDS threads</secondary>
123       </indexterm>Specifying the MDS Service Thread Count</title>
124       <para>The 
125       <literal>mds_num_threads</literal> parameter enables the number of MDS
126       service threads to be specified at module load time on the MDS
127       node:</para>
128       <screen>options mds mds_num_threads={N}</screen>
129       <para>After startup, the minimum and maximum number of MDS thread counts
130       can be set via the 
131       <literal>{service}.thread_{min,max,started}</literal> tunable. To change
132       the tunable at runtime, run:</para>
133       <para>
134         <screen>
135 lctl {get,set}_param {service}.thread_{min,max,started}
136 </screen>
137       </para>
138       <para>For details, see 
139       <xref linkend="dbdoclet.50438271_87260" />.</para>
140       <para>The number of MDS service threads started depends on system size
141       and the load on the server, and has a default maximum of 64. The
142       maximum potential number of threads (<literal>MDS_MAX_THREADS</literal>)
143       is 1024.</para>
144       <note>
145         <para>The OSS and MDS start two threads per service per CPT at mount
146         time, and dynamically increase the number of running service threads in
147         response to server load. Setting the <literal>*_num_threads</literal>
148         module parameter starts the specified number of threads for that
149         service immediately and disables automatic thread creation behavior.
150         </para>
151       </note>
152       <para condition='l23'>Lustre software release 2.3 introduced new
153       parameters to provide more control to administrators.</para>
154       <itemizedlist>
155         <listitem>
156           <para>
157           <literal>mds_rdpg_num_threads</literal> controls the number of threads
158           in providing the read page service. The read page service handles
159           file close and readdir operations.</para>
160         </listitem>
161         <listitem>
162           <para>
163           <literal>mds_attr_num_threads</literal> controls the number of threads
164           in providing the setattr service to clients running Lustre software
165           release 1.8.</para>
166         </listitem>
167       </itemizedlist>
168     </section>
169   </section>
170   <section xml:id="dbdoclet.mdsbinding" condition='l23'>
171     <title>
172     <indexterm>
173       <primary>tuning</primary>
174       <secondary>MDS binding</secondary>
175     </indexterm>Binding MDS Service Thread to CPU Partitions</title>
176     <para>With the introduction of Node Affinity (
177     <xref linkend="nodeaffdef" />) in Lustre software release 2.3, MDS threads
178     can be bound to particular CPU partitions (CPTs) to improve CPU cache
179     usage and memory locality.  Default values for CPT counts and CPU core
180     bindings are selected automatically to provide good overall performance for
181     a given CPU count. However, an administrator can deviate from these setting
182     if they choose.  For details on specifying the mapping of CPU cores to
183     CPTs see <xref linkend="dbdoclet.libcfstuning"/>.
184     </para>
185     <itemizedlist>
186       <listitem>
187         <para>
188         <literal>mds_num_cpts=[EXPRESSION]</literal> binds the default MDS
189         service threads to CPTs defined by 
190         <literal>EXPRESSION</literal>. For example 
191         <literal>mds_num_cpts=[0-3]</literal> will bind the MDS service threads
192         to 
193         <literal>CPT[0,1,2,3]</literal>.</para>
194       </listitem>
195       <listitem>
196         <para>
197         <literal>mds_rdpg_num_cpts=[EXPRESSION]</literal> binds the read page
198         service threads to CPTs defined by 
199         <literal>EXPRESSION</literal>. The read page service handles file close
200         and readdir requests. For example 
201         <literal>mds_rdpg_num_cpts=[4]</literal> will bind the read page threads
202         to 
203         <literal>CPT4</literal>.</para>
204       </listitem>
205       <listitem>
206         <para>
207         <literal>mds_attr_num_cpts=[EXPRESSION]</literal> binds the setattr
208         service threads to CPTs defined by 
209         <literal>EXPRESSION</literal>.</para>
210       </listitem>
211     </itemizedlist>
212         <para>Parameters must be set before module load in the file 
213     <literal>/etc/modprobe.d/lustre.conf</literal>. For example:
214     <example><title>lustre.conf</title>
215     <screen>options lnet networks=tcp0(eth0)
216 options mdt mds_num_cpts=[0]</screen>
217     </example>
218     </para>
219   </section>
220   <section xml:id="dbdoclet.50438272_73839">
221     <title>
222     <indexterm>
223       <primary>LNet</primary>
224       <secondary>tuning</secondary>
225     </indexterm>
226     <indexterm>
227       <primary>tuning</primary>
228       <secondary>LNet</secondary>
229     </indexterm>Tuning LNet Parameters</title>
230     <para>This section describes LNet tunables, the use of which may be
231     necessary on some systems to improve performance. To test the performance
232     of your Lustre network, see 
233     <xref linkend='lnetselftest' />.</para>
234     <section remap="h3">
235       <title>Transmit and Receive Buffer Size</title>
236       <para>The kernel allocates buffers for sending and receiving messages on
237       a network.</para>
238       <para>
239       <literal>ksocklnd</literal> has separate parameters for the transmit and
240       receive buffers.</para>
241       <screen>
242 options ksocklnd tx_buffer_size=0 rx_buffer_size=0
243 </screen>
244       <para>If these parameters are left at the default value (0), the system
245       automatically tunes the transmit and receive buffer size. In almost every
246       case, this default produces the best performance. Do not attempt to tune
247       these parameters unless you are a network expert.</para>
248     </section>
249     <section remap="h3">
250       <title>Hardware Interrupts (
251       <literal>enable_irq_affinity</literal>)</title>
252       <para>The hardware interrupts that are generated by network adapters may
253       be handled by any CPU in the system. In some cases, we would like network
254       traffic to remain local to a single CPU to help keep the processor cache
255       warm and minimize the impact of context switches. This is helpful when an
256       SMP system has more than one network interface and ideal when the number
257       of interfaces equals the number of CPUs. To enable the 
258       <literal>enable_irq_affinity</literal> parameter, enter:</para>
259       <screen>
260 options ksocklnd enable_irq_affinity=1
261 </screen>
262       <para>In other cases, if you have an SMP platform with a single fast
263       interface such as 10 Gb Ethernet and more than two CPUs, you may see
264       performance improve by turning this parameter off.</para>
265       <screen>
266 options ksocklnd enable_irq_affinity=0
267 </screen>
268       <para>By default, this parameter is off. As always, you should test the
269       performance to compare the impact of changing this parameter.</para>
270     </section>
271     <section condition='l23'>
272       <title>
273       <indexterm>
274         <primary>tuning</primary>
275         <secondary>Network interface binding</secondary>
276       </indexterm>Binding Network Interface Against CPU Partitions</title>
277       <para>Lustre software release 2.3 and beyond provide enhanced network
278       interface control. The enhancement means that an administrator can bind
279       an interface to one or more CPU partitions. Bindings are specified as
280       options to the LNet modules. For more information on specifying module
281       options, see 
282       <xref linkend="dbdoclet.50438293_15350" /></para>
283       <para>For example, 
284       <literal>o2ib0(ib0)[0,1]</literal> will ensure that all messages for 
285       <literal>o2ib0</literal> will be handled by LND threads executing on 
286       <literal>CPT0</literal> and 
287       <literal>CPT1</literal>. An additional example might be: 
288       <literal>tcp1(eth0)[0]</literal>. Messages for 
289       <literal>tcp1</literal> are handled by threads on 
290       <literal>CPT0</literal>.</para>
291     </section>
292     <section>
293       <title>
294       <indexterm>
295         <primary>tuning</primary>
296         <secondary>Network interface credits</secondary>
297       </indexterm>Network Interface Credits</title>
298       <para>Network interface (NI) credits are shared across all CPU partitions
299       (CPT). For example, if a machine has four CPTs and the number of NI
300       credits is 512, then each partition has 128 credits. If a large number of
301       CPTs exist on the system, LNet checks and validates the NI credits for
302       each CPT to ensure each CPT has a workable number of credits. For
303       example, if a machine has 16 CPTs and the number of NI credits is 256,
304       then each partition only has 16 credits. 16 NI credits is low and could
305       negatively impact performance. As a result, LNet automatically adjusts
306       the credits to 8*
307       <literal>peer_credits</literal>(
308       <literal>peer_credits</literal> is 8 by default), so each partition has 64
309       credits.</para>
310       <para>Increasing the number of 
311       <literal>credits</literal>/
312       <literal>peer_credits</literal> can improve the performance of high
313       latency networks (at the cost of consuming more memory) by enabling LNet
314       to send more inflight messages to a specific network/peer and keep the
315       pipeline saturated.</para>
316       <para>An administrator can modify the NI credit count using 
317       <literal>ksoclnd</literal> or 
318       <literal>ko2iblnd</literal>. In the example below, 256 credits are
319       applied to TCP connections.</para>
320       <screen>
321 ksocklnd credits=256
322 </screen>
323       <para>Applying 256 credits to IB connections can be achieved with:</para>
324       <screen>
325 ko2iblnd credits=256
326 </screen>
327       <note condition="l23">
328         <para>In Lustre software release 2.3 and beyond, LNet may revalidate
329         the NI credits, so the administrator's request may not persist.</para>
330       </note>
331     </section>
332     <section>
333       <title>
334       <indexterm>
335         <primary>tuning</primary>
336         <secondary>router buffers</secondary>
337       </indexterm>Router Buffers</title>
338       <para>When a node is set up as an LNet router, three pools of buffers are
339       allocated: tiny, small and large. These pools are allocated per CPU
340       partition and are used to buffer messages that arrive at the router to be
341       forwarded to the next hop. The three different buffer sizes accommodate
342       different size messages.</para>
343       <para>If a message arrives that can fit in a tiny buffer then a tiny
344       buffer is used, if a message doesn’t fit in a tiny buffer, but fits in a
345       small buffer, then a small buffer is used. Finally if a message does not
346       fit in either a tiny buffer or a small buffer, a large buffer is
347       used.</para>
348       <para>Router buffers are shared by all CPU partitions. For a machine with
349       a large number of CPTs, the router buffer number may need to be specified
350       manually for best performance. A low number of router buffers risks
351       starving the CPU partitions of resources.</para>
352       <itemizedlist>
353         <listitem>
354           <para>
355           <literal>tiny_router_buffers</literal>: Zero payload buffers used for
356           signals and acknowledgements.</para>
357         </listitem>
358         <listitem>
359           <para>
360           <literal>small_router_buffers</literal>: 4 KB payload buffers for
361           small messages</para>
362         </listitem>
363         <listitem>
364           <para>
365           <literal>large_router_buffers</literal>: 1 MB maximum payload
366           buffers, corresponding to the recommended RPC size of 1 MB.</para>
367         </listitem>
368       </itemizedlist>
369       <para>The default setting for router buffers typically results in
370       acceptable performance. LNet automatically sets a default value to reduce
371       the likelihood of resource starvation. The size of a router buffer can be
372       modified as shown in the example below. In this example, the size of the
373       large buffer is modified using the 
374       <literal>large_router_buffers</literal> parameter.</para>
375       <screen>
376 lnet large_router_buffers=8192
377 </screen>
378       <note condition="l23">
379         <para>In Lustre software release 2.3 and beyond, LNet may revalidate
380         the router buffer setting, so the administrator's request may not
381         persist.</para>
382       </note>
383     </section>
384     <section>
385       <title>
386       <indexterm>
387         <primary>tuning</primary>
388         <secondary>portal round-robin</secondary>
389       </indexterm>Portal Round-Robin</title>
390       <para>Portal round-robin defines the policy LNet applies to deliver
391       events and messages to the upper layers. The upper layers are PLRPC
392       service or LNet selftest.</para>
393       <para>If portal round-robin is disabled, LNet will deliver messages to
394       CPTs based on a hash of the source NID. Hence, all messages from a
395       specific peer will be handled by the same CPT. This can reduce data
396       traffic between CPUs. However, for some workloads, this behavior may
397       result in poorly balancing loads across the CPU.</para>
398       <para>If portal round-robin is enabled, LNet will round-robin incoming
399       events across all CPTs. This may balance load better across the CPU but
400       can incur a cross CPU overhead.</para>
401       <para>The current policy can be changed by an administrator with 
402       <literal>echo 
403       <replaceable>value</replaceable>&gt;
404       /proc/sys/lnet/portal_rotor</literal>. There are four options for 
405       <literal>
406         <replaceable>value</replaceable>
407       </literal>:</para>
408       <itemizedlist>
409         <listitem>
410           <para>
411             <literal>OFF</literal>
412           </para>
413           <para>Disable portal round-robin on all incoming requests.</para>
414         </listitem>
415         <listitem>
416           <para>
417             <literal>ON</literal>
418           </para>
419           <para>Enable portal round-robin on all incoming requests.</para>
420         </listitem>
421         <listitem>
422           <para>
423             <literal>RR_RT</literal>
424           </para>
425           <para>Enable portal round-robin only for routed messages.</para>
426         </listitem>
427         <listitem>
428           <para>
429             <literal>HASH_RT</literal>
430           </para>
431           <para>Routed messages will be delivered to the upper layer by hash of
432           source NID (instead of NID of router.) This is the default
433           value.</para>
434         </listitem>
435       </itemizedlist>
436     </section>
437     <section>
438       <title>LNet Peer Health</title>
439       <para>Two options are available to help determine peer health:
440       <itemizedlist>
441         <listitem>
442           <para>
443           <literal>peer_timeout</literal>- The timeout (in seconds) before an
444           aliveness query is sent to a peer. For example, if 
445           <literal>peer_timeout</literal> is set to 
446           <literal>180sec</literal>, an aliveness query is sent to the peer
447           every 180 seconds. This feature only takes effect if the node is
448           configured as an LNet router.</para>
449           <para>In a routed environment, the 
450           <literal>peer_timeout</literal> feature should always be on (set to a
451           value in seconds) on routers. If the router checker has been enabled,
452           the feature should be turned off by setting it to 0 on clients and
453           servers.</para>
454           <para>For a non-routed scenario, enabling the 
455           <literal>peer_timeout</literal> option provides health information
456           such as whether a peer is alive or not. For example, a client is able
457           to determine if an MGS or OST is up when it sends it a message. If a
458           response is received, the peer is alive; otherwise a timeout occurs
459           when the request is made.</para>
460           <para>In general, 
461           <literal>peer_timeout</literal> should be set to no less than the LND
462           timeout setting. For more information about LND timeouts, see 
463           <xref xmlns:xlink="http://www.w3.org/1999/xlink"
464           linkend="section_c24_nt5_dl" />.</para>
465           <para>When the 
466           <literal>o2iblnd</literal>(IB) driver is used, 
467           <literal>peer_timeout</literal> should be at least twice the value of
468           the 
469           <literal>ko2iblnd</literal> keepalive option. for more information
470           about keepalive options, see 
471           <xref xmlns:xlink="http://www.w3.org/1999/xlink"
472           linkend="section_ngq_qhy_zl" />.</para>
473         </listitem>
474         <listitem>
475           <para>
476           <literal>avoid_asym_router_failure</literal>– When set to 1, the
477           router checker running on the client or a server periodically pings
478           all the routers corresponding to the NIDs identified in the routes
479           parameter setting on the node to determine the status of each router
480           interface. The default setting is 1. (For more information about the
481           LNet routes parameter, see 
482           <xref xmlns:xlink="http://www.w3.org/1999/xlink"
483           linkend="dbdoclet.50438216_71227" /></para>
484           <para>A router is considered down if any of its NIDs are down. For
485           example, router X has three NIDs: 
486           <literal>Xnid1</literal>, 
487           <literal>Xnid2</literal>, and 
488           <literal>Xnid3</literal>. A client is connected to the router via 
489           <literal>Xnid1</literal>. The client has router checker enabled. The
490           router checker periodically sends a ping to the router via 
491           <literal>Xnid1</literal>. The router responds to the ping with the
492           status of each of its NIDs. In this case, it responds with 
493           <literal>Xnid1=up</literal>, 
494           <literal>Xnid2=up</literal>, 
495           <literal>Xnid3=down</literal>. If 
496           <literal>avoid_asym_router_failure==1</literal>, the router is
497           considered down if any of its NIDs are down, so router X is
498           considered down and will not be used for routing messages. If 
499           <literal>avoid_asym_router_failure==0</literal>, router X will
500           continue to be used for routing messages.</para>
501         </listitem>
502       </itemizedlist></para>
503       <para>The following router checker parameters must be set to the maximum
504       value of the corresponding setting for this option on any client or
505       server:
506       <itemizedlist>
507         <listitem>
508           <para>
509             <literal>dead_router_check_interval</literal>
510           </para>
511         </listitem>
512         <listitem>
513           <para>
514             <literal>live_router_check_interval</literal>
515           </para>
516         </listitem>
517         <listitem>
518           <para>
519             <literal>router_ping_timeout</literal>
520           </para>
521         </listitem>
522       </itemizedlist></para>
523       <para>For example, the 
524       <literal>dead_router_check_interval</literal> parameter on any router must
525       be MAX.</para>
526     </section>
527   </section>
528   <section xml:id="dbdoclet.libcfstuning" condition='l23'>
529     <title>
530     <indexterm>
531       <primary>tuning</primary>
532       <secondary>libcfs</secondary>
533     </indexterm>libcfs Tuning</title>
534     <para>Lustre software release 2.3 introduced binding service threads via
535     CPU Partition Tables (CPTs). This allows the system administrator to
536     fine-tune on which CPU cores the Lustre service threads are run, for both
537     OSS and MDS services, as well as on the client.
538     </para>
539     <para>CPTs are useful to reserve some cores on the OSS or MDS nodes for
540     system functions such as system monitoring, HA heartbeat, or similar
541     tasks.  On the client it may be useful to restrict Lustre RPC service
542     threads to a small subset of cores so that they do not interfere with
543     computation, or because these cores are directly attached to the network
544     interfaces.
545     </para>
546     <para>By default, the Lustre software will automatically generate CPU
547     partitions (CPT) based on the number of CPUs in the system.
548     The CPT count can be explicitly set on the libcfs module using 
549     <literal>cpu_npartitions=<replaceable>NUMBER</replaceable></literal>.
550     The value of <literal>cpu_npartitions</literal> must be an integer between
551     1 and the number of online CPUs.
552     </para>
553     <para condition='l29'>In Lustre 2.9 and later the default is to use
554     one CPT per NUMA node.  In earlier versions of Lustre, by default there
555     was a single CPT if the online CPU core count was four or fewer, and
556     additional CPTs would be created depending on the number of CPU cores,
557     typically with 4-8 cores per CPT.
558     </para>
559     <tip>
560       <para>Setting <literal>cpu_npartitions=1</literal> will disable most
561       of the SMP Node Affinity functionality.</para>
562     </tip>
563     <section>
564       <title>CPU Partition String Patterns</title>
565       <para>CPU partitions can be described using string pattern notation.
566       If <literal>cpu_pattern=N</literal> is used, then there will be one
567       CPT for each NUMA node in the system, with each CPT mapping all of
568       the CPU cores for that NUMA node.
569       </para>
570       <para>It is also possible to explicitly specify the mapping between
571       CPU cores and CPTs, for example:</para>
572       <itemizedlist>
573         <listitem>
574           <para>
575             <literal>cpu_pattern="0[2,4,6] 1[3,5,7]</literal>
576           </para>
577           <para>Create two CPTs, CPT0 contains cores 2, 4, and 6, while CPT1
578           contains cores 3, 5, 7.  CPU cores 0 and 1 will not be used by Lustre
579           service threads, and could be used for node services such as
580           system monitoring, HA heartbeat threads, etc.  The binding of
581           non-Lustre services to those CPU cores may be done in userspace
582           using <literal>numactl(8)</literal> or other application-specific
583           methods, but is beyond the scope of this document.</para>
584         </listitem>
585         <listitem>
586           <para>
587             <literal>cpu_pattern="N 0[0-3] 1[4-7]</literal>
588           </para>
589           <para>Create two CPTs, with CPT0 containing all CPUs in NUMA
590           node[0-3], while CPT1 contains all CPUs in NUMA node [4-7].</para>
591         </listitem>
592       </itemizedlist>
593       <para>The current configuration of the CPU partition can be read via 
594       <literal>lctl get_parm cpu_partition_table</literal>.  For example,
595       a simple 4-core system has a single CPT with all four CPU cores:
596       <screen>$ lctl get_param cpu_partition_table
597 cpu_partition_table=0   : 0 1 2 3</screen>
598       while a larger NUMA system with four 12-core CPUs may have four CPTs:
599       <screen>$ lctl get_param cpu_partition_table
600 cpu_partition_table=
601 0       : 0 1 2 3 4 5 6 7 8 9 10 11
602 1       : 12 13 14 15 16 17 18 19 20 21 22 23
603 2       : 24 25 26 27 28 29 30 31 32 33 34 35
604 3       : 36 37 38 39 40 41 42 43 44 45 46 47
605 </screen>
606       </para>
607     </section>
608   </section>
609   <section xml:id="dbdoclet.lndtuning">
610     <title>
611     <indexterm>
612       <primary>tuning</primary>
613       <secondary>LND tuning</secondary>
614     </indexterm>LND Tuning</title>
615     <para>LND tuning allows the number of threads per CPU partition to be
616     specified. An administrator can set the threads for both 
617     <literal>ko2iblnd</literal> and 
618     <literal>ksocklnd</literal> using the 
619     <literal>nscheds</literal> parameter. This adjusts the number of threads for
620     each partition, not the overall number of threads on the LND.</para>
621     <note>
622       <para>Lustre software release 2.3 has greatly decreased the default
623       number of threads for 
624       <literal>ko2iblnd</literal> and 
625       <literal>ksocklnd</literal> on high-core count machines. The current
626       default values are automatically set and are chosen to work well across a
627       number of typical scenarios.</para>
628     </note>
629     <section>
630         <title>ko2iblnd Tuning</title>
631         <para>The following table outlines the ko2iblnd module parameters to be used
632     for tuning:</para>
633         <informaltable frame="all">
634           <tgroup cols="3">
635             <colspec colname="c1" colwidth="50*" />
636             <colspec colname="c2" colwidth="50*" />
637             <colspec colname="c3" colwidth="50*" />
638             <thead>
639               <row>
640                 <entry>
641                   <para>
642                     <emphasis role="bold">Module Parameter</emphasis>
643                   </para>
644                 </entry>
645                 <entry>
646                   <para>
647                     <emphasis role="bold">Default Value</emphasis>
648                   </para>
649                 </entry>
650                 <entry>
651                   <para>
652                     <emphasis role="bold">Description</emphasis>
653                   </para>
654                 </entry>
655               </row>
656             </thead>
657             <tbody>
658               <row>
659                 <entry>
660                   <para>
661                     <literal>service</literal>
662                   </para>
663                 </entry>
664                 <entry>
665                   <para>
666                     <literal>987</literal>
667                   </para>
668                 </entry>
669                 <entry>
670                   <para>Service number (within RDMA_PS_TCP).</para>
671                 </entry>
672               </row>
673               <row>
674                 <entry>
675                   <para>
676                     <literal>cksum</literal>
677                   </para>
678                 </entry>
679                 <entry>
680                   <para>
681                     <literal>0</literal>
682                   </para>
683                 </entry>
684                 <entry>
685                   <para>Set non-zero to enable message (not RDMA) checksums.</para>
686                 </entry>
687               </row>
688               <row>
689                 <entry>
690                   <para>
691                     <literal>timeout</literal>
692                   </para>
693                 </entry>
694                 <entry>
695                 <para>
696                   <literal>50</literal>
697                 </para>
698               </entry>
699                 <entry>
700                   <para>Timeout in seconds.</para>
701                 </entry>
702               </row>
703               <row>
704                 <entry>
705                   <para>
706                     <literal>nscheds</literal>
707                   </para>
708                 </entry>
709                 <entry>
710                   <para>
711                     <literal>0</literal>
712                   </para>
713                 </entry>
714                 <entry>
715                   <para>Number of threads in each scheduler pool (per CPT).  Value of
716           zero means we derive the number from the number of cores.</para>
717                 </entry>
718               </row>
719               <row>
720                 <entry>
721                   <para>
722                     <literal>conns_per_peer</literal>
723                   </para>
724                 </entry>
725                 <entry>
726                   <para>
727                     <literal>4 (OmniPath), 1 (Everything else)</literal>
728                   </para>
729                 </entry>
730                 <entry>
731                   <para>Introduced in 2.10. Number of connections to each peer. Messages
732           are sent round-robin over the connection pool.  Provides signifiant
733           improvement with OmniPath.</para>
734                 </entry>
735               </row>
736               <row>
737                 <entry>
738                   <para>
739                     <literal>ntx</literal>
740                   </para>
741                 </entry>
742                 <entry>
743                   <para>
744                     <literal>512</literal>
745                   </para>
746                 </entry>
747                 <entry>
748                   <para>Number of message descriptors allocated for each pool at
749           startup. Grows at runtime. Shared by all CPTs.</para>
750                 </entry>
751               </row>
752               <row>
753                 <entry>
754                   <para>
755                     <literal>credits</literal>
756                   </para>
757                 </entry>
758                 <entry>
759                   <para>
760                     <literal>256</literal>
761                   </para>
762                 </entry>
763                 <entry>
764                   <para>Number of concurrent sends on network.</para>
765                 </entry>
766               </row>
767               <row>
768                 <entry>
769                   <para>
770                     <literal>peer_credits</literal>
771                   </para>
772                 </entry>
773                 <entry>
774                   <para>
775                     <literal>8</literal>
776                   </para>
777                 </entry>
778                 <entry>
779                   <para>Number of concurrent sends to 1 peer. Related/limited by IB
780           queue size.</para>
781                 </entry>
782               </row>
783               <row>
784                 <entry>
785                   <para>
786                     <literal>peer_credits_hiw</literal>
787                   </para>
788                 </entry>
789                 <entry>
790                   <para>
791                     <literal>0</literal>
792                   </para>
793                 </entry>
794                 <entry>
795                   <para>When eagerly to return credits.</para>
796                 </entry>
797               </row>
798               <row>
799                 <entry>
800                   <para>
801                     <literal>peer_buffer_credits</literal>
802                   </para>
803                 </entry>
804                 <entry>
805                   <para>
806                     <literal>0</literal>
807                   </para>
808                 </entry>
809                 <entry>
810                   <para>Number per-peer router buffer credits.</para>
811                 </entry>
812               </row>
813               <row>
814                 <entry>
815                   <para>
816                     <literal>peer_timeout</literal>
817                   </para>
818                 </entry>
819                 <entry>
820                   <para>
821                     <literal>180</literal>
822                   </para>
823                 </entry>
824                 <entry>
825                   <para>Seconds without aliveness news to declare peer dead (less than
826           or equal to 0 to disable).</para>
827                 </entry>
828               </row>
829               <row>
830                 <entry>
831                   <para>
832                     <literal>ipif_name</literal>
833                   </para>
834                 </entry>
835                 <entry>
836                   <para>
837                     <literal>ib0</literal>
838                   </para>
839                 </entry>
840                 <entry>
841                   <para>IPoIB interface name.</para>
842                 </entry>
843               </row>
844               <row>
845                 <entry>
846                   <para>
847                     <literal>retry_count</literal>
848                   </para>
849                 </entry>
850                 <entry>
851                   <para>
852                     <literal>5</literal>
853                   </para>
854                 </entry>
855                 <entry>
856                   <para>Retransmissions when no ACK received.</para>
857                 </entry>
858               </row>
859               <row>
860                 <entry>
861                   <para>
862                     <literal>rnr_retry_count</literal>
863                   </para>
864                 </entry>
865                 <entry>
866                   <para>
867                     <literal>6</literal>
868                   </para>
869                 </entry>
870                 <entry>
871                   <para>RNR retransmissions.</para>
872                 </entry>
873               </row>
874               <row>
875                 <entry>
876                   <para>
877                     <literal>keepalive</literal>
878                   </para>
879                 </entry>
880                 <entry>
881                   <para>
882                     <literal>100</literal>
883                   </para>
884                 </entry>
885                 <entry>
886                   <para>Idle time in seconds before sending a keepalive.</para>
887                 </entry>
888               </row>
889               <row>
890                 <entry>
891                   <para>
892                     <literal>ib_mtu</literal>
893                   </para>
894                 </entry>
895                 <entry>
896                   <para>
897                     <literal>0</literal>
898                   </para>
899                 </entry>
900                 <entry>
901                   <para>IB MTU 256/512/1024/2048/4096.</para>
902                 </entry>
903               </row>
904               <row>
905                 <entry>
906                   <para>
907                     <literal>concurrent_sends</literal>
908                   </para>
909                 </entry>
910                 <entry>
911                   <para>
912                     <literal>0</literal>
913                   </para>
914                 </entry>
915                 <entry>
916                   <para>Send work-queue sizing. If zero, derived from
917           <literal>map_on_demand</literal> and <literal>peer_credits</literal>.
918           </para>
919                 </entry>
920               </row>
921               <row>
922                 <entry>
923                   <para>
924                     <literal>map_on_demand</literal>
925                   </para>
926                 </entry>
927                 <entry>
928                   <para>
929             <literal>0 (pre-4.8 Linux) 1 (4.8 Linux onward) 32 (OmniPath)</literal>
930                   </para>
931                 </entry>
932                 <entry>
933                   <para>Number of fragments reserved for connection.  If zero, use
934           global memory region (found to be security issue).  If non-zero, use
935           FMR or FastReg for memory registration.  Value needs to agree between
936           both peers of connection.</para>
937                 </entry>
938               </row>
939               <row>
940                 <entry>
941                   <para>
942                     <literal>fmr_pool_size</literal>
943                   </para>
944                 </entry>
945                 <entry>
946                   <para>
947                     <literal>512</literal>
948                   </para>
949                 </entry>
950                 <entry>
951                   <para>Size of fmr pool on each CPT (>= ntx / 4).  Grows at runtime.
952           </para>
953                 </entry>
954               </row>
955               <row>
956                 <entry>
957                   <para>
958                     <literal>fmr_flush_trigger</literal>
959                   </para>
960                 </entry>
961                 <entry>
962                   <para>
963                     <literal>384</literal>
964                   </para>
965                 </entry>
966                 <entry>
967                   <para>Number dirty FMRs that triggers pool flush.</para>
968                 </entry>
969               </row>
970               <row>
971                 <entry>
972                   <para>
973                     <literal>fmr_cache</literal>
974                   </para>
975                 </entry>
976                 <entry>
977                   <para>
978                     <literal>1</literal>
979                   </para>
980                 </entry>
981                 <entry>
982                   <para>Non-zero to enable FMR caching.</para>
983                 </entry>
984               </row>
985               <row>
986                 <entry>
987                   <para>
988                     <literal>dev_failover</literal>
989                   </para>
990                 </entry>
991                 <entry>
992                   <para>
993                     <literal>0</literal>
994                   </para>
995                 </entry>
996                 <entry>
997                   <para>HCA failover for bonding (0 OFF, 1 ON, other values reserved).
998           </para>
999                 </entry>
1000               </row>
1001               <row>
1002                 <entry>
1003                   <para>
1004                     <literal>require_privileged_port</literal>
1005                   </para>
1006                 </entry>
1007                 <entry>
1008                   <para>
1009                     <literal>0</literal>
1010                   </para>
1011                 </entry>
1012                 <entry>
1013                   <para>Require privileged port when accepting connection.</para>
1014                 </entry>
1015               </row>
1016               <row>
1017                 <entry>
1018                   <para>
1019                     <literal>use_privileged_port</literal>
1020                   </para>
1021                 </entry>
1022                 <entry>
1023                   <para>
1024                     <literal>1</literal>
1025                   </para>
1026                 </entry>
1027                 <entry>
1028                   <para>Use privileged port when initiating connection.</para>
1029                 </entry>
1030               </row>
1031               <row>
1032                 <entry>
1033                   <para>
1034                     <literal>wrq_sge</literal>
1035                   </para>
1036                 </entry>
1037                 <entry>
1038                   <para>
1039                     <literal>2</literal>
1040                   </para>
1041                 </entry>
1042                 <entry>
1043                   <para>Introduced in 2.10. Number scatter/gather element groups per
1044           work request.  Used to deal with fragmentations which can consume
1045           double the number of work requests.</para>
1046                 </entry>
1047               </row>
1048             </tbody>
1049           </tgroup>
1050         </informaltable>
1051     </section>
1052   </section>
1053   <section xml:id="dbdoclet.nrstuning" condition='l24'>
1054     <title>
1055     <indexterm>
1056       <primary>tuning</primary>
1057       <secondary>Network Request Scheduler (NRS) Tuning</secondary>
1058     </indexterm>Network Request Scheduler (NRS) Tuning</title>
1059     <para>The Network Request Scheduler (NRS) allows the administrator to
1060     influence the order in which RPCs are handled at servers, on a per-PTLRPC
1061     service basis, by providing different policies that can be activated and
1062     tuned in order to influence the RPC ordering. The aim of this is to provide
1063     for better performance, and possibly discrete performance characteristics
1064     using future policies.</para>
1065     <para>The NRS policy state of a PTLRPC service can be read and set via the 
1066     <literal>{service}.nrs_policies</literal> tunable. To read a PTLRPC
1067     service's NRS policy state, run:</para>
1068     <screen>
1069 lctl get_param {service}.nrs_policies
1070 </screen>
1071     <para>For example, to read the NRS policy state of the 
1072     <literal>ost_io</literal> service, run:</para>
1073     <screen>
1074 $ lctl get_param ost.OSS.ost_io.nrs_policies
1075 ost.OSS.ost_io.nrs_policies=
1076
1077 regular_requests:
1078   - name: fifo
1079     state: started
1080     fallback: yes
1081     queued: 0
1082     active: 0
1083
1084   - name: crrn
1085     state: stopped
1086     fallback: no
1087     queued: 0
1088     active: 0
1089
1090   - name: orr
1091     state: stopped
1092     fallback: no
1093     queued: 0
1094     active: 0
1095
1096   - name: trr
1097     state: started
1098     fallback: no
1099     queued: 2420
1100     active: 268
1101
1102   - name: tbf
1103     state: stopped
1104     fallback: no
1105     queued: 0
1106     active: 0
1107
1108   - name: delay
1109     state: stopped
1110     fallback: no
1111     queued: 0
1112     active: 0
1113
1114 high_priority_requests:
1115   - name: fifo
1116     state: started
1117     fallback: yes
1118     queued: 0
1119     active: 0
1120
1121   - name: crrn
1122     state: stopped
1123     fallback: no
1124     queued: 0
1125     active: 0
1126
1127   - name: orr
1128     state: stopped
1129     fallback: no
1130     queued: 0
1131     active: 0
1132
1133   - name: trr
1134     state: stopped
1135     fallback: no
1136     queued: 0
1137     active: 0
1138
1139   - name: tbf
1140     state: stopped
1141     fallback: no
1142     queued: 0
1143     active: 0
1144
1145   - name: delay
1146     state: stopped
1147     fallback: no
1148     queued: 0
1149     active: 0
1150
1151 </screen>
1152     <para>NRS policy state is shown in either one or two sections, depending on
1153     the PTLRPC service being queried. The first section is named 
1154     <literal>regular_requests</literal> and is available for all PTLRPC
1155     services, optionally followed by a second section which is named 
1156     <literal>high_priority_requests</literal>. This is because some PTLRPC
1157     services are able to treat some types of RPCs as higher priority ones, such
1158     that they are handled by the server with higher priority compared to other,
1159     regular RPC traffic. For PTLRPC services that do not support high-priority
1160     RPCs, you will only see the 
1161     <literal>regular_requests</literal> section.</para>
1162     <para>There is a separate instance of each NRS policy on each PTLRPC
1163     service for handling regular and high-priority RPCs (if the service
1164     supports high-priority RPCs). For each policy instance, the following
1165     fields are shown:</para>
1166     <informaltable frame="all">
1167       <tgroup cols="2">
1168         <colspec colname="c1" colwidth="50*" />
1169         <colspec colname="c2" colwidth="50*" />
1170         <thead>
1171           <row>
1172             <entry>
1173               <para>
1174                 <emphasis role="bold">Field</emphasis>
1175               </para>
1176             </entry>
1177             <entry>
1178               <para>
1179                 <emphasis role="bold">Description</emphasis>
1180               </para>
1181             </entry>
1182           </row>
1183         </thead>
1184         <tbody>
1185           <row>
1186             <entry>
1187               <para>
1188                 <literal>name</literal>
1189               </para>
1190             </entry>
1191             <entry>
1192               <para>The name of the policy.</para>
1193             </entry>
1194           </row>
1195           <row>
1196             <entry>
1197               <para>
1198                 <literal>state</literal>
1199               </para>
1200             </entry>
1201             <entry>
1202               <para>The state of the policy; this can be any of 
1203               <literal>invalid, stopping, stopped, starting, started</literal>.
1204               A fully enabled policy is in the 
1205               <literal>started</literal> state.</para>
1206             </entry>
1207           </row>
1208           <row>
1209             <entry>
1210               <para>
1211                 <literal>fallback</literal>
1212               </para>
1213             </entry>
1214             <entry>
1215               <para>Whether the policy is acting as a fallback policy or not. A
1216               fallback policy is used to handle RPCs that other enabled
1217               policies fail to handle, or do not support the handling of. The
1218               possible values are 
1219               <literal>no, yes</literal>. Currently, only the FIFO policy can
1220               act as a fallback policy.</para>
1221             </entry>
1222           </row>
1223           <row>
1224             <entry>
1225               <para>
1226                 <literal>queued</literal>
1227               </para>
1228             </entry>
1229             <entry>
1230               <para>The number of RPCs that the policy has waiting to be
1231               serviced.</para>
1232             </entry>
1233           </row>
1234           <row>
1235             <entry>
1236               <para>
1237                 <literal>active</literal>
1238               </para>
1239             </entry>
1240             <entry>
1241               <para>The number of RPCs that the policy is currently
1242               handling.</para>
1243             </entry>
1244           </row>
1245         </tbody>
1246       </tgroup>
1247     </informaltable>
1248     <para>To enable an NRS policy on a PTLRPC service run:</para>
1249     <screen>
1250 lctl set_param {service}.nrs_policies=
1251 <replaceable>policy_name</replaceable>
1252 </screen>
1253     <para>This will enable the policy 
1254     <replaceable>policy_name</replaceable>for both regular and high-priority
1255     RPCs (if the PLRPC service supports high-priority RPCs) on the given
1256     service. For example, to enable the CRR-N NRS policy for the ldlm_cbd
1257     service, run:</para>
1258     <screen>
1259 $ lctl set_param ldlm.services.ldlm_cbd.nrs_policies=crrn
1260 ldlm.services.ldlm_cbd.nrs_policies=crrn
1261       
1262 </screen>
1263     <para>For PTLRPC services that support high-priority RPCs, you can also
1264     supply an optional 
1265     <replaceable>reg|hp</replaceable>token, in order to enable an NRS policy
1266     for handling only regular or high-priority RPCs on a given PTLRPC service,
1267     by running:</para>
1268     <screen>
1269 lctl set_param {service}.nrs_policies="
1270 <replaceable>policy_name</replaceable> 
1271 <replaceable>reg|hp</replaceable>"
1272 </screen>
1273     <para>For example, to enable the TRR policy for handling only regular, but
1274     not high-priority RPCs on the 
1275     <literal>ost_io</literal> service, run:</para>
1276     <screen>
1277 $ lctl set_param ost.OSS.ost_io.nrs_policies="trr reg"
1278 ost.OSS.ost_io.nrs_policies="trr reg"
1279       
1280 </screen>
1281     <note>
1282       <para>When enabling an NRS policy, the policy name must be given in
1283       lower-case characters, otherwise the operation will fail with an error
1284       message.</para>
1285     </note>
1286     <section>
1287       <title>
1288       <indexterm>
1289         <primary>tuning</primary>
1290         <secondary>Network Request Scheduler (NRS) Tuning</secondary>
1291         <tertiary>first in, first out (FIFO) policy</tertiary>
1292       </indexterm>First In, First Out (FIFO) policy</title>
1293       <para>The first in, first out (FIFO) policy handles RPCs in a service in
1294       the same order as they arrive from the LNet layer, so no special
1295       processing takes place to modify the RPC handling stream. FIFO is the
1296       default policy for all types of RPCs on all PTLRPC services, and is
1297       always enabled irrespective of the state of other policies, so that it
1298       can be used as a backup policy, in case a more elaborate policy that has
1299       been enabled fails to handle an RPC, or does not support handling a given
1300       type of RPC.</para>
1301       <para>The FIFO policy has no tunables that adjust its behaviour.</para>
1302     </section>
1303     <section>
1304       <title>
1305       <indexterm>
1306         <primary>tuning</primary>
1307         <secondary>Network Request Scheduler (NRS) Tuning</secondary>
1308         <tertiary>client round-robin over NIDs (CRR-N) policy</tertiary>
1309       </indexterm>Client Round-Robin over NIDs (CRR-N) policy</title>
1310       <para>The client round-robin over NIDs (CRR-N) policy performs batched
1311       round-robin scheduling of all types of RPCs, with each batch consisting
1312       of RPCs originating from the same client node, as identified by its NID.
1313       CRR-N aims to provide for better resource utilization across the cluster,
1314       and to help shorten completion times of jobs in some cases, by
1315       distributing available bandwidth more evenly across all clients.</para>
1316       <para>The CRR-N policy can be enabled on all types of PTLRPC services,
1317       and has the following tunable that can be used to adjust its
1318       behavior:</para>
1319       <itemizedlist>
1320         <listitem>
1321           <para>
1322             <literal>{service}.nrs_crrn_quantum</literal>
1323           </para>
1324           <para>The 
1325           <literal>{service}.nrs_crrn_quantum</literal> tunable determines the
1326           maximum allowed size of each batch of RPCs; the unit of measure is in
1327           number of RPCs. To read the maximum allowed batch size of a CRR-N
1328           policy, run:</para>
1329           <screen>
1330 lctl get_param {service}.nrs_crrn_quantum
1331 </screen>
1332           <para>For example, to read the maximum allowed batch size of a CRR-N
1333           policy on the ost_io service, run:</para>
1334           <screen>
1335 $ lctl get_param ost.OSS.ost_io.nrs_crrn_quantum
1336 ost.OSS.ost_io.nrs_crrn_quantum=reg_quantum:16
1337 hp_quantum:8
1338           
1339 </screen>
1340           <para>You can see that there is a separate maximum allowed batch size
1341           value for regular (
1342           <literal>reg_quantum</literal>) and high-priority (
1343           <literal>hp_quantum</literal>) RPCs (if the PTLRPC service supports
1344           high-priority RPCs).</para>
1345           <para>To set the maximum allowed batch size of a CRR-N policy on a
1346           given service, run:</para>
1347           <screen>
1348 lctl set_param {service}.nrs_crrn_quantum=
1349 <replaceable>1-65535</replaceable>
1350 </screen>
1351           <para>This will set the maximum allowed batch size on a given
1352           service, for both regular and high-priority RPCs (if the PLRPC
1353           service supports high-priority RPCs), to the indicated value.</para>
1354           <para>For example, to set the maximum allowed batch size on the
1355           ldlm_canceld service to 16 RPCs, run:</para>
1356           <screen>
1357 $ lctl set_param ldlm.services.ldlm_canceld.nrs_crrn_quantum=16
1358 ldlm.services.ldlm_canceld.nrs_crrn_quantum=16
1359           
1360 </screen>
1361           <para>For PTLRPC services that support high-priority RPCs, you can
1362           also specify a different maximum allowed batch size for regular and
1363           high-priority RPCs, by running:</para>
1364           <screen>
1365 $ lctl set_param {service}.nrs_crrn_quantum=
1366 <replaceable>reg_quantum|hp_quantum</replaceable>:
1367 <replaceable>1-65535</replaceable>"
1368 </screen>
1369           <para>For example, to set the maximum allowed batch size on the
1370           ldlm_canceld service, for high-priority RPCs to 32, run:</para>
1371           <screen>
1372 $ lctl set_param ldlm.services.ldlm_canceld.nrs_crrn_quantum="hp_quantum:32"
1373 ldlm.services.ldlm_canceld.nrs_crrn_quantum=hp_quantum:32
1374           
1375 </screen>
1376           <para>By using the last method, you can also set the maximum regular
1377           and high-priority RPC batch sizes to different values, in a single
1378           command invocation.</para>
1379         </listitem>
1380       </itemizedlist>
1381     </section>
1382     <section>
1383       <title>
1384       <indexterm>
1385         <primary>tuning</primary>
1386         <secondary>Network Request Scheduler (NRS) Tuning</secondary>
1387         <tertiary>object-based round-robin (ORR) policy</tertiary>
1388       </indexterm>Object-based Round-Robin (ORR) policy</title>
1389       <para>The object-based round-robin (ORR) policy performs batched
1390       round-robin scheduling of bulk read write (brw) RPCs, with each batch
1391       consisting of RPCs that pertain to the same backend-file system object,
1392       as identified by its OST FID.</para>
1393       <para>The ORR policy is only available for use on the ost_io service. The
1394       RPC batches it forms can potentially consist of mixed bulk read and bulk
1395       write RPCs. The RPCs in each batch are ordered in an ascending manner,
1396       based on either the file offsets, or the physical disk offsets of each
1397       RPC (only applicable to bulk read RPCs).</para>
1398       <para>The aim of the ORR policy is to provide for increased bulk read
1399       throughput in some cases, by ordering bulk read RPCs (and potentially
1400       bulk write RPCs), and thus minimizing costly disk seek operations.
1401       Performance may also benefit from any resulting improvement in resource
1402       utilization, or by taking advantage of better locality of reference
1403       between RPCs.</para>
1404       <para>The ORR policy has the following tunables that can be used to
1405       adjust its behaviour:</para>
1406       <itemizedlist>
1407         <listitem>
1408           <para>
1409             <literal>ost.OSS.ost_io.nrs_orr_quantum</literal>
1410           </para>
1411           <para>The 
1412           <literal>ost.OSS.ost_io.nrs_orr_quantum</literal> tunable determines
1413           the maximum allowed size of each batch of RPCs; the unit of measure
1414           is in number of RPCs. To read the maximum allowed batch size of the
1415           ORR policy, run:</para>
1416           <screen>
1417 $ lctl get_param ost.OSS.ost_io.nrs_orr_quantum
1418 ost.OSS.ost_io.nrs_orr_quantum=reg_quantum:256
1419 hp_quantum:16
1420           
1421 </screen>
1422           <para>You can see that there is a separate maximum allowed batch size
1423           value for regular (
1424           <literal>reg_quantum</literal>) and high-priority (
1425           <literal>hp_quantum</literal>) RPCs (if the PTLRPC service supports
1426           high-priority RPCs).</para>
1427           <para>To set the maximum allowed batch size for the ORR policy,
1428           run:</para>
1429           <screen>
1430 $ lctl set_param ost.OSS.ost_io.nrs_orr_quantum=
1431 <replaceable>1-65535</replaceable>
1432 </screen>
1433           <para>This will set the maximum allowed batch size for both regular
1434           and high-priority RPCs, to the indicated value.</para>
1435           <para>You can also specify a different maximum allowed batch size for
1436           regular and high-priority RPCs, by running:</para>
1437           <screen>
1438 $ lctl set_param ost.OSS.ost_io.nrs_orr_quantum=
1439 <replaceable>reg_quantum|hp_quantum</replaceable>:
1440 <replaceable>1-65535</replaceable>
1441 </screen>
1442           <para>For example, to set the maximum allowed batch size for regular
1443           RPCs to 128, run:</para>
1444           <screen>
1445 $ lctl set_param ost.OSS.ost_io.nrs_orr_quantum=reg_quantum:128
1446 ost.OSS.ost_io.nrs_orr_quantum=reg_quantum:128
1447           
1448 </screen>
1449           <para>By using the last method, you can also set the maximum regular
1450           and high-priority RPC batch sizes to different values, in a single
1451           command invocation.</para>
1452         </listitem>
1453         <listitem>
1454           <para>
1455             <literal>ost.OSS.ost_io.nrs_orr_offset_type</literal>
1456           </para>
1457           <para>The 
1458           <literal>ost.OSS.ost_io.nrs_orr_offset_type</literal> tunable
1459           determines whether the ORR policy orders RPCs within each batch based
1460           on logical file offsets or physical disk offsets. To read the offset
1461           type value for the ORR policy, run:</para>
1462           <screen>
1463 $ lctl get_param ost.OSS.ost_io.nrs_orr_offset_type
1464 ost.OSS.ost_io.nrs_orr_offset_type=reg_offset_type:physical
1465 hp_offset_type:logical
1466           
1467 </screen>
1468           <para>You can see that there is a separate offset type value for
1469           regular (
1470           <literal>reg_offset_type</literal>) and high-priority (
1471           <literal>hp_offset_type</literal>) RPCs.</para>
1472           <para>To set the ordering type for the ORR policy, run:</para>
1473           <screen>
1474 $ lctl set_param ost.OSS.ost_io.nrs_orr_offset_type=
1475 <replaceable>physical|logical</replaceable>
1476 </screen>
1477           <para>This will set the offset type for both regular and
1478           high-priority RPCs, to the indicated value.</para>
1479           <para>You can also specify a different offset type for regular and
1480           high-priority RPCs, by running:</para>
1481           <screen>
1482 $ lctl set_param ost.OSS.ost_io.nrs_orr_offset_type=
1483 <replaceable>reg_offset_type|hp_offset_type</replaceable>:
1484 <replaceable>physical|logical</replaceable>
1485 </screen>
1486           <para>For example, to set the offset type for high-priority RPCs to
1487           physical disk offsets, run:</para>
1488           <screen>
1489 $ lctl set_param ost.OSS.ost_io.nrs_orr_offset_type=hp_offset_type:physical
1490 ost.OSS.ost_io.nrs_orr_offset_type=hp_offset_type:physical
1491 </screen>
1492           <para>By using the last method, you can also set offset type for
1493           regular and high-priority RPCs to different values, in a single
1494           command invocation.</para>
1495           <note>
1496             <para>Irrespective of the value of this tunable, only logical
1497             offsets can, and are used for ordering bulk write RPCs.</para>
1498           </note>
1499         </listitem>
1500         <listitem>
1501           <para>
1502             <literal>ost.OSS.ost_io.nrs_orr_supported</literal>
1503           </para>
1504           <para>The 
1505           <literal>ost.OSS.ost_io.nrs_orr_supported</literal> tunable determines
1506           the type of RPCs that the ORR policy will handle. To read the types
1507           of supported RPCs by the ORR policy, run:</para>
1508           <screen>
1509 $ lctl get_param ost.OSS.ost_io.nrs_orr_supported
1510 ost.OSS.ost_io.nrs_orr_supported=reg_supported:reads
1511 hp_supported=reads_and_writes
1512           
1513 </screen>
1514           <para>You can see that there is a separate supported 'RPC types'
1515           value for regular (
1516           <literal>reg_supported</literal>) and high-priority (
1517           <literal>hp_supported</literal>) RPCs.</para>
1518           <para>To set the supported RPC types for the ORR policy, run:</para>
1519           <screen>
1520 $ lctl set_param ost.OSS.ost_io.nrs_orr_supported=
1521 <replaceable>reads|writes|reads_and_writes</replaceable>
1522 </screen>
1523           <para>This will set the supported RPC types for both regular and
1524           high-priority RPCs, to the indicated value.</para>
1525           <para>You can also specify a different supported 'RPC types' value
1526           for regular and high-priority RPCs, by running:</para>
1527           <screen>
1528 $ lctl set_param ost.OSS.ost_io.nrs_orr_supported=
1529 <replaceable>reg_supported|hp_supported</replaceable>:
1530 <replaceable>reads|writes|reads_and_writes</replaceable>
1531 </screen>
1532           <para>For example, to set the supported RPC types to bulk read and
1533           bulk write RPCs for regular requests, run:</para>
1534           <screen>
1535 $ lctl set_param
1536 ost.OSS.ost_io.nrs_orr_supported=reg_supported:reads_and_writes
1537 ost.OSS.ost_io.nrs_orr_supported=reg_supported:reads_and_writes
1538           
1539 </screen>
1540           <para>By using the last method, you can also set the supported RPC
1541           types for regular and high-priority RPC to different values, in a
1542           single command invocation.</para>
1543         </listitem>
1544       </itemizedlist>
1545     </section>
1546     <section>
1547       <title>
1548       <indexterm>
1549         <primary>tuning</primary>
1550         <secondary>Network Request Scheduler (NRS) Tuning</secondary>
1551         <tertiary>Target-based round-robin (TRR) policy</tertiary>
1552       </indexterm>Target-based Round-Robin (TRR) policy</title>
1553       <para>The target-based round-robin (TRR) policy performs batched
1554       round-robin scheduling of brw RPCs, with each batch consisting of RPCs
1555       that pertain to the same OST, as identified by its OST index.</para>
1556       <para>The TRR policy is identical to the object-based round-robin (ORR)
1557       policy, apart from using the brw RPC's target OST index instead of the
1558       backend-fs object's OST FID, for determining the RPC scheduling order.
1559       The goals of TRR are effectively the same as for ORR, and it uses the
1560       following tunables to adjust its behaviour:</para>
1561       <itemizedlist>
1562         <listitem>
1563           <para>
1564             <literal>ost.OSS.ost_io.nrs_trr_quantum</literal>
1565           </para>
1566           <para>The purpose of this tunable is exactly the same as for the 
1567           <literal>ost.OSS.ost_io.nrs_orr_quantum</literal> tunable for the ORR
1568           policy, and you can use it in exactly the same way.</para>
1569         </listitem>
1570         <listitem>
1571           <para>
1572             <literal>ost.OSS.ost_io.nrs_trr_offset_type</literal>
1573           </para>
1574           <para>The purpose of this tunable is exactly the same as for the 
1575           <literal>ost.OSS.ost_io.nrs_orr_offset_type</literal> tunable for the
1576           ORR policy, and you can use it in exactly the same way.</para>
1577         </listitem>
1578         <listitem>
1579           <para>
1580             <literal>ost.OSS.ost_io.nrs_trr_supported</literal>
1581           </para>
1582           <para>The purpose of this tunable is exactly the same as for the 
1583           <literal>ost.OSS.ost_io.nrs_orr_supported</literal> tunable for the
1584           ORR policy, and you can use it in exactly the sme way.</para>
1585         </listitem>
1586       </itemizedlist>
1587     </section>
1588     <section xml:id="dbdoclet.tbftuning" condition='l26'>
1589       <title>
1590       <indexterm>
1591         <primary>tuning</primary>
1592         <secondary>Network Request Scheduler (NRS) Tuning</secondary>
1593         <tertiary>Token Bucket Filter (TBF) policy</tertiary>
1594       </indexterm>Token Bucket Filter (TBF) policy</title>
1595       <para>The TBF (Token Bucket Filter) is a Lustre NRS policy which enables
1596       Lustre services to enforce the RPC rate limit on clients/jobs for QoS
1597       (Quality of Service) purposes.</para>
1598       <figure>
1599         <title>The internal structure of TBF policy</title>
1600         <mediaobject>
1601           <imageobject>
1602             <imagedata scalefit="1" width="100%"
1603             fileref="figures/TBF_policy.svg" />
1604           </imageobject>
1605           <textobject>
1606             <phrase>The internal structure of TBF policy</phrase>
1607           </textobject>
1608         </mediaobject>
1609       </figure>
1610       <para>When a RPC request arrives, TBF policy puts it to a waiting queue
1611       according to its classification. The classification of RPC requests is
1612       based on either NID or JobID of the RPC according to the configure of
1613       TBF. TBF policy maintains multiple queues in the system, one queue for
1614       each category in the classification of RPC requests. The requests waits
1615       for tokens in the FIFO queue before they have been handled so as to keep
1616       the RPC rates under the limits.</para>
1617       <para>When Lustre services are too busy to handle all of the requests in
1618       time, all of the specified rates of the queues will not be satisfied.
1619       Nothing bad will happen except some of the RPC rates are slower than
1620       configured. In this case, the queue with higher rate will have an
1621       advantage over the queues with lower rates, but none of them will be
1622       starved.</para>
1623       <para>To manage the RPC rate of queues, we don't need to set the rate of
1624       each queue manually. Instead, we define rules which TBF policy matches to
1625       determine RPC rate limits. All of the defined rules are organized as an
1626       ordered list. Whenever a queue is newly created, it goes though the rule
1627       list and takes the first matched rule as its rule, so that the queue
1628       knows its RPC token rate. A rule can be added to or removed from the list
1629       at run time. Whenever the list of rules is changed, the queues will
1630       update their matched rules.</para>
1631       <section remap="h4">
1632         <title>Enable TBF policy</title>
1633         <para>Command:</para>
1634         <screen>lctl set_param ost.OSS.ost_io.nrs_policies="tbf &lt;<replaceable>policy</replaceable>&gt;"
1635         </screen>
1636         <para>For now, the RPCs can be classified into the different types
1637         according to their NID, JOBID and OPCode. (UID/GID will be supported
1638         soon.) When enabling TBF policy, you can specify one of the types, or
1639         just use "tbf" to enable all of them to do a fine-grained RPC requests
1640         classification.</para>
1641         <para>Example:</para>
1642         <screen>$ lctl set_param ost.OSS.ost_io.nrs_policies="tbf"
1643 $ lctl set_param ost.OSS.ost_io.nrs_policies="tbf nid"
1644 $ lctl set_param ost.OSS.ost_io.nrs_policies="tbf jobid"
1645 $ lctl set_param ost.OSS.ost_io.nrs_policies="tbf opcode"</screen>
1646       </section>
1647       <section remap="h4">
1648         <title>Start a TBF rule</title>
1649         <para>The TBF rule is defined in the parameter
1650         <literal>ost.OSS.ost_io.nrs_tbf_rule</literal>.</para>
1651         <para>Command:</para>
1652         <screen>lctl set_param x.x.x.nrs_tbf_rule=
1653 "[reg|hp] start <replaceable>rule_name</replaceable> <replaceable>arguments</replaceable>..."
1654         </screen>
1655         <para>'<replaceable>rule_name</replaceable>' is a string of the TBF
1656         policy rule's name and '<replaceable>arguments</replaceable>' is a
1657         string to specify the detailed rule according to the different types.
1658         </para>
1659         <itemizedlist>
1660         <para>Next, the different types of TBF policies will be described.</para>
1661           <listitem>
1662             <para><emphasis role="bold">NID based TBF policy</emphasis></para>
1663             <para>Command:</para>
1664             <screen>lctl set_param x.x.x.nrs_tbf_rule=
1665 "[reg|hp] start <replaceable>rule_name</replaceable> nid={<replaceable>nidlist</replaceable>} rate=<replaceable>rate</replaceable>"
1666             </screen>
1667             <para>'<replaceable>nidlist</replaceable>' uses the same format
1668             as configuring LNET route. '<replaceable>rate</replaceable>' is
1669             the (upper limit) RPC rate of the rule.</para>
1670             <para>Example:</para>
1671             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1672 "start other_clients nid={192.168.*.*@tcp} rate=50"
1673 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1674 "start computes nid={192.168.1.[2-128]@tcp} rate=500"
1675 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1676 "start loginnode nid={192.168.1.1@tcp} rate=100"</screen>
1677             <para>In this example, the rate of processing RPC requests from
1678             compute nodes is at most 5x as fast as those from login nodes.
1679             The output of <literal>ost.OSS.ost_io.nrs_tbf_rule</literal> is
1680             like:</para>
1681             <screen>lctl get_param ost.OSS.ost_io.nrs_tbf_rule
1682 ost.OSS.ost_io.nrs_tbf_rule=
1683 regular_requests:
1684 CPT 0:
1685 loginnode {192.168.1.1@tcp} 100, ref 0
1686 computes {192.168.1.[2-128]@tcp} 500, ref 0
1687 other_clients {192.168.*.*@tcp} 50, ref 0
1688 default {*} 10000, ref 0
1689 high_priority_requests:
1690 CPT 0:
1691 loginnode {192.168.1.1@tcp} 100, ref 0
1692 computes {192.168.1.[2-128]@tcp} 500, ref 0
1693 other_clients {192.168.*.*@tcp} 50, ref 0
1694 default {*} 10000, ref 0</screen>
1695             <para>Also, the rule can be written in <literal>reg</literal> and
1696             <literal>hp</literal> formats:</para>
1697             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1698 "reg start loginnode nid={192.168.1.1@tcp} rate=100"
1699 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1700 "hp start loginnode nid={192.168.1.1@tcp} rate=100"</screen>
1701           </listitem>
1702           <listitem>
1703             <para><emphasis role="bold">JobID based TBF policy</emphasis></para>
1704             <para>For the JobID, please see
1705             <xref xmlns:xlink="http://www.w3.org/1999/xlink"
1706             linkend="dbdoclet.jobstats" /> for more details.</para>
1707             <para>Command:</para>
1708             <screen>lctl set_param x.x.x.nrs_tbf_rule=
1709 "[reg|hp] start <replaceable>name</replaceable> jobid={<replaceable>jobid_list</replaceable>} rate=<replaceable>rate</replaceable>"
1710             </screen>
1711             <para>Wildcard is supported in
1712             {<replaceable>jobid_list</replaceable>}.</para>
1713             <para>Example:</para>
1714             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1715 "start iozone_user jobid={iozone.500} rate=100"
1716 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1717 "start dd_user jobid={dd.*} rate=50"
1718 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1719 "start user1 jobid={*.600} rate=10"
1720 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1721 "start user2 jobid={io*.10* *.500} rate=200"</screen>
1722             <para>Also, the rule can be written in <literal>reg</literal> and
1723             <literal>hp</literal> formats:</para>
1724             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1725 "hp start iozone_user1 jobid={iozone.500} rate=100"
1726 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1727 "reg start iozone_user1 jobid={iozone.500} rate=100"</screen>
1728           </listitem>
1729           <listitem>
1730             <para><emphasis role="bold">Opcode based TBF policy</emphasis></para>
1731             <para>Command:</para>
1732             <screen>$ lctl set_param x.x.x.nrs_tbf_rule=
1733 "[reg|hp] start <replaceable>name</replaceable> opcode={<replaceable>opcode_list</replaceable>} rate=<replaceable>rate</replaceable>"
1734             </screen>
1735             <para>Example:</para>
1736             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1737 "start user1 opcode={ost_read} rate=100"
1738 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1739 "start iozone_user1 opcode={ost_read ost_write} rate=200"</screen>
1740             <para>Also, the rule can be written in <literal>reg</literal> and
1741             <literal>hp</literal> formats:</para>
1742             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1743 "hp start iozone_user1 opcode={ost_read} rate=100"
1744 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1745 "reg start iozone_user1 opcode={ost_read} rate=100"</screen>
1746           </listitem>
1747           <listitem>
1748             <para><emphasis role="bold">Policy combination</emphasis></para>
1749             <para>To support rules with complex expressions of NID/JOBID/OPCode
1750             conditions, TBF classifier is extented to classify RPC in a more
1751             fine-grained way. This feature supports logical conditional
1752             conjunction and disjunction operations among different types.
1753             In the rule:
1754             "&amp;" represents the conditional conjunction and
1755             "," represents the conditional disjunction.</para>
1756             <para>Example:</para>
1757             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1758 "start comp_rule opcode={ost_write}&amp;jobid={dd.0},\
1759 nid={192.168.1.[1-128]@tcp 0@lo} rate=100"</screen>
1760             <para>In this example, those RPCs whose <literal>opcode</literal> is
1761             ost_write and <literal>jobid</literal> is dd.0, or
1762             <literal>nid</literal> satisfies the condition of
1763             {192.168.1.[1-128]@tcp 0@lo} will be processed at the rate of 100
1764             req/sec.
1765             The output of <literal>ost.OSS.ost_io.nrs_tbf_rule</literal>is like:
1766             </para>
1767             <screen>$ lctl get_param ost.OSS.ost_io.nrs_tbf_rule
1768 ost.OSS.ost_io.nrs_tbf_rule=
1769 regular_requests:
1770 CPT 0:
1771 comp_rule opcode={ost_write}&amp;jobid={dd.0},nid={192.168.1.[1-128]@tcp 0@lo} 100, ref 0
1772 default * 10000, ref 0
1773 CPT 1:
1774 comp_rule opcode={ost_write}&amp;jobid={dd.0},nid={192.168.1.[1-128]@tcp 0@lo} 100, ref 0
1775 default * 10000, ref 0
1776 high_priority_requests:
1777 CPT 0:
1778 comp_rule opcode={ost_write}&amp;jobid={dd.0},nid={192.168.1.[1-128]@tcp 0@lo} 100, ref 0
1779 default * 10000, ref 0
1780 CPT 1:
1781 comp_rule opcode={ost_write}&amp;jobid={dd.0},nid={192.168.1.[1-128]@tcp 0@lo} 100, ref 0
1782 default * 10000, ref 0</screen>
1783           </listitem>
1784         </itemizedlist>
1785       </section>
1786       <section remap="h4">
1787           <title>Change a TBF rule</title>
1788           <para>Command:</para>
1789           <screen>lctl set_param x.x.x.nrs_tbf_rule=
1790 "[reg|hp] change <replaceable>rule_name</replaceable> rate=<replaceable>rate</replaceable>"
1791           </screen>
1792           <para>Example:</para>
1793           <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1794 "change loginnode rate=200"
1795 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1796 "reg change loginnode rate=200"
1797 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1798 "hp change loginnode rate=200"
1799 </screen>
1800       </section>
1801       <section remap="h4">
1802           <title>Stop a TBF rule</title>
1803           <para>Command:</para>
1804           <screen>lctl set_param x.x.x.nrs_tbf_rule="[reg|hp] stop
1805 <replaceable>rule_name</replaceable>"</screen>
1806           <para>Example:</para>
1807           <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop loginnode"
1808 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="reg stop loginnode"
1809 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="hp stop loginnode"</screen>
1810       </section>
1811       <section remap="h4">
1812         <title>Rule options</title>
1813         <para>To support more flexible rule conditions, the following options
1814         are added.</para>
1815         <itemizedlist>
1816           <listitem>
1817             <para><emphasis role="bold">Reordering of TBF rules</emphasis></para>
1818             <para>By default, a newly started rule is prior to the old ones,
1819             but by specifying the argument '<literal>rank=</literal>' when
1820             inserting a new rule with "<literal>start</literal>" command,
1821             the rank of the rule can be changed. Also, it can be changed by
1822             "<literal>change</literal>" command.
1823             </para>
1824             <para>Command:</para>
1825             <screen>lctl set_param ost.OSS.ost_io.nrs_tbf_rule=
1826 "start <replaceable>rule_name</replaceable> <replaceable>arguments</replaceable>... rank=<replaceable>obj_rule_name</replaceable>"
1827 lctl set_param ost.OSS.ost_io.nrs_tbf_rule=
1828 "change <replaceable>rule_name</replaceable> rate=<replaceable>rate</replaceable> rank=<replaceable>obj_rule_name</replaceable>"
1829 </screen>
1830             <para>By specifying the existing rule
1831             '<replaceable>obj_rule_name</replaceable>', the new rule
1832             '<replaceable>rule_name</replaceable>' will be moved to the front of
1833             '<replaceable>obj_rule_name</replaceable>'.</para>
1834             <para>Example:</para>
1835             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1836 "start computes nid={192.168.1.[2-128]@tcp} rate=500"
1837 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1838 "start user1 jobid={iozone.500 dd.500} rate=100"
1839 $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=\
1840 "start iozone_user1 opcode={ost_read ost_write} rate=200 rank=computes"</screen>
1841             <para>In this example, rule "iozone_user1" is added to the front of
1842             rule "computes". We can see the order by the following command:
1843             </para>
1844             <screen>$ lctl get_param ost.OSS.ost_io.nrs_tbf_rule
1845 ost.OSS.ost_io.nrs_tbf_rule=
1846 regular_requests:
1847 CPT 0:
1848 user1 jobid={iozone.500 dd.500} 100, ref 0
1849 iozone_user1 opcode={ost_read ost_write} 200, ref 0
1850 computes nid={192.168.1.[2-128]@tcp} 500, ref 0
1851 default * 10000, ref 0
1852 CPT 1:
1853 user1 jobid={iozone.500 dd.500} 100, ref 0
1854 iozone_user1 opcode={ost_read ost_write} 200, ref 0
1855 computes nid={192.168.1.[2-128]@tcp} 500, ref 0
1856 default * 10000, ref 0
1857 high_priority_requests:
1858 CPT 0:
1859 user1 jobid={iozone.500 dd.500} 100, ref 0
1860 iozone_user1 opcode={ost_read ost_write} 200, ref 0
1861 computes nid={192.168.1.[2-128]@tcp} 500, ref 0
1862 default * 10000, ref 0
1863 CPT 1:
1864 user1 jobid={iozone.500 dd.500} 100, ref 0
1865 iozone_user1 opcode={ost_read ost_write} 200, ref 0
1866 computes nid={192.168.1.[2-128]@tcp} 500, ref 0
1867 default * 10000, ref 0</screen>
1868           </listitem>
1869           <listitem>
1870             <para><emphasis role="bold">TBF realtime policies under congestion
1871             </emphasis></para>
1872             <para>During TBF evaluation, we find that when the sum of I/O
1873             bandwidth requirements for all classes exceeds the system capacity,
1874             the classes with the same rate limits get less bandwidth than if
1875             preconfigured evenly. The reason for this is the heavy load on a
1876             congested server will result in some missed deadlines for some
1877             classes. The number of the calculated tokens may be larger than 1
1878             during dequeuing. In the original implementation, all classes are
1879             equally handled to simply discard exceeding tokens.</para>
1880             <para>Thus, a Hard Token Compensation (HTC) strategy has been
1881             implemented. A class can be configured with the HTC feature by the
1882             rule it matches. This feature means that requests in this kind of
1883             class queues have high real-time requirements and that the bandwidth
1884             assignment must be satisfied as good as possible. When deadline
1885             misses happen, the class keeps the deadline unchanged and the time
1886             residue(the remainder of elapsed time divided by 1/r) is compensated
1887             to the next round. This ensures that the next idle I/O thread will
1888             always select this class to serve until all accumulated exceeding
1889             tokens are handled or there are no pending requests in the class
1890             queue.</para>
1891             <para>Command:</para>
1892             <para>A new command format is added to enable the realtime feature
1893             for a rule:</para>
1894             <screen>lctl set_param x.x.x.nrs_tbf_rule=\
1895 "start <replaceable>rule_name</replaceable> <replaceable>arguments</replaceable>... realtime=1</screen>
1896             <para>Example:</para>
1897             <screen>$ lctl set_param ost.OSS.ost_io.nrs_tbf_rule=
1898 "start realjob jobid={dd.0} rate=100 realtime=1</screen>
1899             <para>This example rule means the RPC requests whose JobID is dd.0
1900             will be processed at the rate of 100req/sec in realtime.</para>
1901           </listitem>
1902         </itemizedlist>
1903       </section>
1904     </section>
1905     <section xml:id="dbdoclet.delaytuning" condition='l2A'>
1906       <title>
1907       <indexterm>
1908         <primary>tuning</primary>
1909         <secondary>Network Request Scheduler (NRS) Tuning</secondary>
1910         <tertiary>Delay policy</tertiary>
1911       </indexterm>Delay policy</title>
1912       <para>The NRS Delay policy seeks to perturb the timing of request
1913       processing at the PtlRPC layer, with the goal of simulating high server
1914       load, and finding and exposing timing related problems. When this policy
1915       is active, upon arrival of a request the policy will calculate an offset,
1916       within a defined, user-configurable range, from the request arrival
1917       time, to determine a time after which the request should be handled.
1918       The request is then stored using the cfs_binheap implementation,
1919       which sorts the request according to the assigned start time.
1920       Requests are removed from the binheap for handling once their start
1921       time has been passed.</para>
1922       <para>The Delay policy can be enabled on all types of PtlRPC services,
1923       and has the following tunables that can be used to adjust its behavior:
1924       </para>
1925       <itemizedlist>
1926         <listitem>
1927           <para>
1928             <literal>{service}.nrs_delay_min</literal>
1929           </para>
1930           <para>The
1931           <literal>{service}.nrs_delay_min</literal> tunable controls the
1932           minimum amount of time, in seconds, that a request will be delayed by
1933           this policy.  The default is 5 seconds. To read this value run:</para>
1934           <screen>
1935 lctl get_param {service}.nrs_delay_min</screen>
1936           <para>For example, to read the minimum delay set on the ost_io
1937           service, run:</para>
1938           <screen>
1939 $ lctl get_param ost.OSS.ost_io.nrs_delay_min
1940 ost.OSS.ost_io.nrs_delay_min=reg_delay_min:5
1941 hp_delay_min:5</screen>
1942         <para>To set the minimum delay in RPC processing, run:</para>
1943         <screen>
1944 lctl set_param {service}.nrs_delay_min=<replaceable>0-65535</replaceable></screen>
1945         <para>This will set the minimum delay time on a given service, for both
1946         regular and high-priority RPCs (if the PtlRPC service supports
1947         high-priority RPCs), to the indicated value.</para>
1948         <para>For example, to set the minimum delay time on the ost_io service
1949         to 10, run:</para>
1950         <screen>
1951 $ lctl set_param ost.OSS.ost_io.nrs_delay_min=10
1952 ost.OSS.ost_io.nrs_delay_min=10</screen>
1953         <para>For PtlRPC services that support high-priority RPCs, to set a
1954         different minimum delay time for regular and high-priority RPCs, run:
1955         </para>
1956         <screen>
1957 lctl set_param {service}.nrs_delay_min=<replaceable>reg_delay_min|hp_delay_min</replaceable>:<replaceable>0-65535</replaceable>
1958         </screen>
1959         <para>For example, to set the minimum delay time on the ost_io service
1960         for high-priority RPCs to 3, run:</para>
1961         <screen>
1962 $ lctl set_param ost.OSS.ost_io.nrs_delay_min=hp_delay_min:3
1963 ost.OSS.ost_io.nrs_delay_min=hp_delay_min:3</screen>
1964         <para>Note, in all cases the minimum delay time cannot exceed the
1965         maximum delay time.</para>
1966         </listitem>
1967         <listitem>
1968           <para>
1969             <literal>{service}.nrs_delay_max</literal>
1970           </para>
1971           <para>The
1972           <literal>{service}.nrs_delay_max</literal> tunable controls the
1973           maximum amount of time, in seconds, that a request will be delayed by
1974           this policy.  The default is 300 seconds. To read this value run:
1975           </para>
1976           <screen>lctl get_param {service}.nrs_delay_max</screen>
1977           <para>For example, to read the maximum delay set on the ost_io
1978           service, run:</para>
1979           <screen>
1980 $ lctl get_param ost.OSS.ost_io.nrs_delay_max
1981 ost.OSS.ost_io.nrs_delay_max=reg_delay_max:300
1982 hp_delay_max:300</screen>
1983         <para>To set the maximum delay in RPC processing, run:</para>
1984         <screen>lctl set_param {service}.nrs_delay_max=<replaceable>0-65535</replaceable>
1985 </screen>
1986         <para>This will set the maximum delay time on a given service, for both
1987         regular and high-priority RPCs (if the PtlRPC service supports
1988         high-priority RPCs), to the indicated value.</para>
1989         <para>For example, to set the maximum delay time on the ost_io service
1990         to 60, run:</para>
1991         <screen>
1992 $ lctl set_param ost.OSS.ost_io.nrs_delay_max=60
1993 ost.OSS.ost_io.nrs_delay_max=60</screen>
1994         <para>For PtlRPC services that support high-priority RPCs, to set a
1995         different maximum delay time for regular and high-priority RPCs, run:
1996         </para>
1997         <screen>lctl set_param {service}.nrs_delay_max=<replaceable>reg_delay_max|hp_delay_max</replaceable>:<replaceable>0-65535</replaceable></screen>
1998         <para>For example, to set the maximum delay time on the ost_io service
1999         for high-priority RPCs to 30, run:</para>
2000         <screen>
2001 $ lctl set_param ost.OSS.ost_io.nrs_delay_max=hp_delay_max:30
2002 ost.OSS.ost_io.nrs_delay_max=hp_delay_max:30</screen>
2003         <para>Note, in all cases the maximum delay time cannot be less than the
2004         minimum delay time.</para>
2005         </listitem>
2006         <listitem>
2007           <para>
2008             <literal>{service}.nrs_delay_pct</literal>
2009           </para>
2010           <para>The
2011           <literal>{service}.nrs_delay_pct</literal> tunable controls the
2012           percentage of requests that will be delayed by this policy. The
2013           default is 100. Note, when a request is not selected for handling by
2014           the delay policy due to this variable then the request will be handled
2015           by whatever fallback policy is defined for that service. If no other
2016           fallback policy is defined then the request will be handled by the
2017           FIFO policy.  To read this value run:</para>
2018           <screen>lctl get_param {service}.nrs_delay_pct</screen>
2019           <para>For example, to read the percentage of requests being delayed on
2020           the ost_io service, run:</para>
2021           <screen>
2022 $ lctl get_param ost.OSS.ost_io.nrs_delay_pct
2023 ost.OSS.ost_io.nrs_delay_pct=reg_delay_pct:100
2024 hp_delay_pct:100</screen>
2025         <para>To set the percentage of delayed requests, run:</para>
2026         <screen>
2027 lctl set_param {service}.nrs_delay_pct=<replaceable>0-100</replaceable></screen>
2028         <para>This will set the percentage of requests delayed on a given
2029         service, for both regular and high-priority RPCs (if the PtlRPC service
2030         supports high-priority RPCs), to the indicated value.</para>
2031         <para>For example, to set the percentage of delayed requests on the
2032         ost_io service to 50, run:</para>
2033         <screen>
2034 $ lctl set_param ost.OSS.ost_io.nrs_delay_pct=50
2035 ost.OSS.ost_io.nrs_delay_pct=50
2036 </screen>
2037         <para>For PtlRPC services that support high-priority RPCs, to set a
2038         different delay percentage for regular and high-priority RPCs, run:
2039         </para>
2040         <screen>lctl set_param {service}.nrs_delay_pct=<replaceable>reg_delay_pct|hp_delay_pct</replaceable>:<replaceable>0-100</replaceable>
2041 </screen>
2042         <para>For example, to set the percentage of delayed requests on the
2043         ost_io service for high-priority RPCs to 5, run:</para>
2044         <screen>$ lctl set_param ost.OSS.ost_io.nrs_delay_pct=hp_delay_pct:5
2045 ost.OSS.ost_io.nrs_delay_pct=hp_delay_pct:5
2046 </screen>
2047         </listitem>
2048       </itemizedlist>
2049     </section>
2050   </section>
2051   <section xml:id="dbdoclet.50438272_25884">
2052     <title>
2053     <indexterm>
2054       <primary>tuning</primary>
2055       <secondary>lockless I/O</secondary>
2056     </indexterm>Lockless I/O Tunables</title>
2057     <para>The lockless I/O tunable feature allows servers to ask clients to do
2058     lockless I/O (the server does the locking on behalf of clients) for
2059     contended files to avoid lock ping-pong.</para>
2060     <para>The lockless I/O patch introduces these tunables:</para>
2061     <itemizedlist>
2062       <listitem>
2063         <para>
2064           <emphasis role="bold">OST-side:</emphasis>
2065         </para>
2066         <screen>
2067 ldlm.namespaces.filter-<replaceable>fsname</replaceable>-*.
2068 </screen>
2069         <para>
2070         <literal>contended_locks</literal>- If the number of lock conflicts in
2071         the scan of granted and waiting queues at contended_locks is exceeded,
2072         the resource is considered to be contended.</para>
2073         <para>
2074         <literal>contention_seconds</literal>- The resource keeps itself in a
2075         contended state as set in the parameter.</para>
2076         <para>
2077         <literal>max_nolock_bytes</literal>- Server-side locking set only for
2078         requests less than the blocks set in the
2079         <literal>max_nolock_bytes</literal> parameter. If this tunable is
2080         set to zero (0), it disables server-side locking for read/write
2081         requests.</para>
2082       </listitem>
2083       <listitem>
2084         <para>
2085           <emphasis role="bold">Client-side:</emphasis>
2086         </para>
2087         <screen>
2088 /proc/fs/lustre/llite/lustre-*
2089 </screen>
2090         <para>
2091         <literal>contention_seconds</literal>- 
2092         <literal>llite</literal> inode remembers its contended state for the
2093         time specified in this parameter.</para>
2094       </listitem>
2095       <listitem>
2096         <para>
2097           <emphasis role="bold">Client-side statistics:</emphasis>
2098         </para>
2099         <para>The 
2100         <literal>/proc/fs/lustre/llite/lustre-*/stats</literal> file has new
2101         rows for lockless I/O statistics.</para>
2102         <para>
2103         <literal>lockless_read_bytes</literal> and 
2104         <literal>lockless_write_bytes</literal>- To count the total bytes read
2105         or written, the client makes its own decisions based on the request
2106         size. The client does not communicate with the server if the request
2107         size is smaller than the 
2108         <literal>min_nolock_size</literal>, without acquiring locks by the
2109         client.</para>
2110       </listitem>
2111     </itemizedlist>
2112   </section>
2113   <section condition="l29">
2114       <title>
2115         <indexterm>
2116           <primary>tuning</primary>
2117           <secondary>with lfs ladvise</secondary>
2118         </indexterm>
2119         Server-Side Advice and Hinting
2120       </title>
2121       <section><title>Overview</title>
2122       <para>Use the <literal>lfs ladvise</literal> command give file access
2123       advices or hints to servers.</para>
2124       <screen>lfs ladvise [--advice|-a ADVICE ] [--background|-b]
2125 [--start|-s START[kMGT]]
2126 {[--end|-e END[kMGT]] | [--length|-l LENGTH[kMGT]]}
2127 <emphasis>file</emphasis> ...
2128       </screen>
2129       <para>
2130         <informaltable frame="all">
2131           <tgroup cols="2">
2132           <colspec colname="c1" colwidth="50*"/>
2133           <colspec colname="c2" colwidth="50*"/>
2134           <thead>
2135             <row>
2136               <entry>
2137                 <para><emphasis role="bold">Option</emphasis></para>
2138               </entry>
2139               <entry>
2140                 <para><emphasis role="bold">Description</emphasis></para>
2141               </entry>
2142             </row>
2143           </thead>
2144           <tbody>
2145             <row>
2146               <entry>
2147                 <para><literal>-a</literal>, <literal>--advice=</literal>
2148                 <literal>ADVICE</literal></para>
2149               </entry>
2150               <entry>
2151                 <para>Give advice or hint of type <literal>ADVICE</literal>.
2152                 Advice types are:</para>
2153                 <para><literal>willread</literal> to prefetch data into server
2154                 cache</para>
2155                 <para><literal>dontneed</literal> to cleanup data cache on
2156                 server</para>
2157               </entry>
2158             </row>
2159             <row>
2160               <entry>
2161                 <para><literal>-b</literal>, <literal>--background</literal>
2162                 </para>
2163               </entry>
2164               <entry>
2165                 <para>Enable the advices to be sent and handled asynchronously.
2166                 </para>
2167               </entry>
2168             </row>
2169             <row>
2170               <entry>
2171                 <para><literal>-s</literal>, <literal>--start=</literal>
2172                         <literal>START_OFFSET</literal></para>
2173               </entry>
2174               <entry>
2175                 <para>File range starts from <literal>START_OFFSET</literal>
2176                 </para>
2177                 </entry>
2178             </row>
2179             <row>
2180                 <entry>
2181                     <para><literal>-e</literal>, <literal>--end=</literal>
2182                         <literal>END_OFFSET</literal></para>
2183                 </entry>
2184                 <entry>
2185                     <para>File range ends at (not including)
2186                     <literal>END_OFFSET</literal>.  This option may not be
2187                     specified at the same time as the <literal>-l</literal>
2188                     option.</para>
2189                 </entry>
2190             </row>
2191             <row>
2192                 <entry>
2193                     <para><literal>-l</literal>, <literal>--length=</literal>
2194                         <literal>LENGTH</literal></para>
2195                 </entry>
2196                 <entry>
2197                   <para>File range has length of <literal>LENGTH</literal>.
2198                   This option may not be specified at the same time as the
2199                   <literal>-e</literal> option.</para>
2200                 </entry>
2201             </row>
2202           </tbody>
2203           </tgroup>
2204         </informaltable>
2205       </para>
2206       <para>Typically, <literal>lfs ladvise</literal> forwards the advice to
2207       Lustre servers without guaranteeing when and what servers will react to
2208       the advice. Actions may or may not triggered when the advices are
2209       recieved, depending on the type of the advice, as well as the real-time
2210       decision of the affected server-side components.</para>
2211       <para>A typical usage of ladvise is to enable applications and users with
2212       external knowledge to intervene in server-side cache management. For
2213       example, if a bunch of different clients are doing small random reads of a
2214       file, prefetching pages into OSS cache with big linear reads before the
2215       random IO is a net benefit. Fetching that data into each client cache with
2216       fadvise() may not be, due to much more data being sent to the client.
2217       </para>
2218       <para>The main difference between the Linux <literal>fadvise()</literal>
2219       system call and <literal>lfs ladvise</literal> is that
2220       <literal>fadvise()</literal> is only a client side mechanism that does
2221       not pass the advice to the filesystem, while <literal>ladvise</literal>
2222       can send advices or hints to the Lustre server side.</para>
2223       </section>
2224       <section><title>Examples</title>
2225         <para>The following example gives the OST(s) holding the first 1GB of
2226         <literal>/mnt/lustre/file1</literal>a hint that the first 1GB of the
2227         file will be read soon.</para>
2228         <screen>client1$ lfs ladvise -a willread -s 0 -e 1048576000 /mnt/lustre/file1
2229         </screen>
2230         <para>The following example gives the OST(s) holding the first 1GB of
2231         <literal>/mnt/lustre/file1</literal> a hint that the first 1GB of file
2232         will not be read in the near future, thus the OST(s) could clear the
2233         cache of the file in the memory.</para>
2234         <screen>client1$ lfs ladvise -a dontneed -s 0 -e 1048576000 /mnt/lustre/file1
2235         </screen>
2236       </section>
2237   </section>
2238   <section condition="l29">
2239       <title>
2240           <indexterm>
2241               <primary>tuning</primary>
2242               <secondary>Large Bulk IO</secondary>
2243           </indexterm>
2244           Large Bulk IO (16MB RPC)
2245       </title>
2246       <section><title>Overview</title>
2247           <para>Beginning with Lustre 2.9, Lustre is extended to support RPCs up
2248           to 16MB in size. By enabling a larger RPC size, fewer RPCs will be
2249           required to transfer the same amount of data between clients and
2250           servers.  With a larger RPC size, the OSS can submit more data to the
2251           underlying disks at once, therefore it can produce larger disk I/Os
2252           to fully utilize the increasing bandwidth of disks.</para>
2253           <para>At client connection time, clients will negotiate with
2254           servers what the maximum RPC size it is possible to use, but the
2255           client can always send RPCs smaller than this maximum.</para>
2256           <para>The parameter <literal>brw_size</literal> is used on the OST
2257           to tell the client the maximum (preferred) IO size.  All clients that
2258           talk to this target should never send an RPC greater than this size.
2259           Clients can individually set a smaller RPC size limit via the
2260           <literal>osc.*.max_pages_per_rpc</literal> tunable.
2261           </para>
2262           <note>
2263           <para>The smallest <literal>brw_size</literal> that can be set for
2264           ZFS OSTs is the <literal>recordsize</literal> of that dataset.  This
2265           ensures that the client can always write a full ZFS file block if it
2266           has enough dirty data, and does not otherwise force it to do read-
2267           modify-write operations for every RPC.
2268           </para>
2269           </note>
2270       </section>
2271       <section><title>Usage</title>
2272           <para>In order to enable a larger RPC size,
2273           <literal>brw_size</literal> must be changed to an IO size value up to
2274           16MB.  To temporarily change <literal>brw_size</literal>, the
2275           following command should be run on the OSS:</para>
2276           <screen>oss# lctl set_param obdfilter.<replaceable>fsname</replaceable>-OST*.brw_size=16</screen>
2277           <para>To persistently change <literal>brw_size</literal>, one of the following
2278           commands should be run on the OSS:</para>
2279           <screen>oss# lctl set_param -P obdfilter.<replaceable>fsname</replaceable>-OST*.brw_size=16</screen>
2280           <screen>oss# lctl conf_param <replaceable>fsname</replaceable>-OST*.obdfilter.brw_size=16</screen>
2281           <para>When a client connects to an OST target, it will fetch
2282           <literal>brw_size</literal> from the target and pick the maximum value
2283           of <literal>brw_size</literal> and its local setting for
2284           <literal>max_pages_per_rpc</literal> as the actual RPC size.
2285           Therefore, the <literal>max_pages_per_rpc</literal> on the client side
2286           would have to be set to 16M, or 4096 if the PAGESIZE is 4KB, to enable
2287           a 16MB RPC.  To temporarily make the change, the following command
2288           should be run on the client to set
2289           <literal>max_pages_per_rpc</literal>:</para>
2290           <screen>client$ lctl set_param osc.<replaceable>fsname</replaceable>-OST*.max_pages_per_rpc=16M</screen>
2291           <para>To persistently make this change, the following command should
2292           be run:</para>
2293           <screen>client$ lctl conf_param <replaceable>fsname</replaceable>-OST*.osc.max_pages_per_rpc=16M</screen>
2294           <caution><para>The <literal>brw_size</literal> of an OST can be
2295           changed on the fly.  However, clients have to be remounted to
2296           renegotiate the new maximum RPC size.</para></caution>
2297       </section>
2298   </section>
2299   <section xml:id="dbdoclet.50438272_80545">
2300     <title>
2301     <indexterm>
2302       <primary>tuning</primary>
2303       <secondary>for small files</secondary>
2304     </indexterm>Improving Lustre I/O Performance for Small Files</title>
2305     <para>An environment where an application writes small file chunks from
2306     many clients to a single file can result in poor I/O performance. To
2307     improve the performance of the Lustre file system with small files:</para>
2308     <itemizedlist>
2309       <listitem>
2310         <para>Have the application aggregate writes some amount before
2311         submitting them to the Lustre file system. By default, the Lustre
2312         software enforces POSIX coherency semantics, so it results in lock
2313         ping-pong between client nodes if they are all writing to the same
2314         file at one time.</para>
2315         <para>Using MPI-IO Collective Write functionality in
2316         the Lustre ADIO driver is one way to achieve this in a straight
2317         forward manner if the application is already using MPI-IO.</para>
2318       </listitem>
2319       <listitem>
2320         <para>Have the application do 4kB
2321         <literal>O_DIRECT</literal> sized I/O to the file and disable locking
2322         on the output file. This avoids partial-page IO submissions and, by
2323         disabling locking, you avoid contention between clients.</para>
2324       </listitem>
2325       <listitem>
2326         <para>Have the application write contiguous data.</para>
2327       </listitem>
2328       <listitem>
2329         <para>Add more disks or use SSD disks for the OSTs. This dramatically
2330         improves the IOPS rate. Consider creating larger OSTs rather than many
2331         smaller OSTs due to less overhead (journal, connections, etc).</para>
2332       </listitem>
2333       <listitem>
2334         <para>Use RAID-1+0 OSTs instead of RAID-5/6. There is RAID parity
2335         overhead for writing small chunks of data to disk.</para>
2336       </listitem>
2337     </itemizedlist>
2338   </section>
2339   <section xml:id="dbdoclet.50438272_45406">
2340     <title>
2341     <indexterm>
2342       <primary>tuning</primary>
2343       <secondary>write performance</secondary>
2344     </indexterm>Understanding Why Write Performance is Better Than Read
2345     Performance</title>
2346     <para>Typically, the performance of write operations on a Lustre cluster is
2347     better than read operations. When doing writes, all clients are sending
2348     write RPCs asynchronously. The RPCs are allocated, and written to disk in
2349     the order they arrive. In many cases, this allows the back-end storage to
2350     aggregate writes efficiently.</para>
2351     <para>In the case of read operations, the reads from clients may come in a
2352     different order and need a lot of seeking to get read from the disk. This
2353     noticeably hampers the read throughput.</para>
2354     <para>Currently, there is no readahead on the OSTs themselves, though the
2355     clients do readahead. If there are lots of clients doing reads it would not
2356     be possible to do any readahead in any case because of memory consumption
2357     (consider that even a single RPC (1 MB) readahead for 1000 clients would
2358     consume 1 GB of RAM).</para>
2359     <para>For file systems that use socklnd (TCP, Ethernet) as interconnect,
2360     there is also additional CPU overhead because the client cannot receive
2361     data without copying it from the network buffers. In the write case, the
2362     client CAN send data without the additional data copy. This means that the
2363     client is more likely to become CPU-bound during reads than writes.</para>
2364   </section>
2365 </chapter>