X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=LustreTuning.xml;h=286492345139f9affd86228d1c84dc25c3edc05b;hb=418981057df248fc8be41eb557e3a25cbbbedc55;hp=3ea6865f39e23af3c70faabcba541c2fa69d1612;hpb=95de3d1981252a83eeaebc3dc87d8132cee04ef5;p=doc%2Fmanual.git diff --git a/LustreTuning.xml b/LustreTuning.xml index 3ea6865..2864923 100644 --- a/LustreTuning.xml +++ b/LustreTuning.xml @@ -1,166 +1,813 @@ - - - - Lustre Tuning - - This chapter contains information about tuning Lustre for better performance and includes the following sections: - - + + Tuning a Lustre File System + This chapter contains information about tuning a Lustre file system for better performance + and includes the following sections: + + - - + + + + - - + + + + + + + + + + - - + - - + + + + Many options in the Lustre software are set by means of kernel module parameters. These + parameters are contained in the /etc/modprobe.d/lustre.conf file. + +
+ + <indexterm><primary>tuning</primary></indexterm> +<indexterm><primary>tuning</primary><secondary>service threads</secondary></indexterm> + Optimizing the Number of Service Threads + An OSS can have a minimum of two service threads and a maximum of 512 service threads. The + number of service threads is a function of how much RAM and how many CPUs are on each OSS node + (1 thread / 128MB * num_cpus). If the load on the OSS node is high, new service threads will + be started in order to process more requests concurrently, up to 4x the initial number of + threads (subject to the maximum of 512). For a 2GB 2-CPU system, the default thread count is + 32 and the maximum thread count is 128. + Increasing the size of the thread pool may help when: + + + Several OSTs are exported from a single OSS + + + Back-end storage is running synchronously + + + I/O completions take excessive time due to slow storage + + + Decreasing the size of the thread pool may help if: + + + Clients are overwhelming the storage capacity + + + There are lots of "slow I/O" or similar messages + + + Increasing the number of I/O threads allows the kernel and storage to aggregate many writes together for more efficient disk I/O. The OSS thread pool is shared--each thread allocates approximately 1.5 MB (maximum RPC size + 0.5 MB) for internal I/O buffers. + It is very important to consider memory consumption when increasing the thread pool size. Drives are only able to sustain a certain amount of parallel I/O activity before performance is degraded, due to the high number of seeks and the OST threads just waiting for I/O. In this situation, it may be advisable to decrease the load by decreasing the number of OST threads. + Determining the optimum number of OST threads is a process of trial and error, and varies for each particular configuration. Variables include the number of OSTs on each OSS, number and speed of disks, RAID configuration, and available RAM. You may want to start with a number of OST threads equal to the number of actual disk spindles on the node. If you use RAID, subtract any dead spindles not used for actual data (e.g., 1 of N of spindles for RAID5, 2 of N spindles for RAID6), and monitor the performance of clients during usual workloads. If performance is degraded, increase the thread count and see how that works until performance is degraded again or you reach satisfactory performance. + + If there are too many threads, the latency for individual I/O requests can become very high and should be avoided. Set the desired maximum thread count permanently using the method described above. + +
+ <indexterm><primary>tuning</primary><secondary>OSS threads</secondary></indexterm>Specifying the OSS Service Thread Count + The oss_num_threads parameter enables the number of OST service threads to be specified at module load time on the OSS nodes: + options ost oss_num_threads={N} + After startup, the minimum and maximum number of OSS thread counts can be set via the {service}.thread_{min,max,started} tunable. To change the tunable at runtime, run: + lctl {get,set}_param {service}.thread_{min,max,started} + Lustre software release 2.3 introduced binding service threads to CPU partition. This + works in a similar fashion to binding of threads on MDS. MDS thread tuning is covered in + . + + + oss_cpts=[EXPRESSION] binds the default OSS service on CPTs defined by [EXPRESSION]. + + + oss_io_cpts=[EXPRESSION] binds the IO OSS service on CPTs defined by [EXPRESSION]. + + - - - Many options in Lustre are set by means of kernel module parameters. These parameters are contained in the modprobe.conf file. - -
- 25.1 Optimizing the Number of Service Threads - An OSS can have a minimum of 2 service threads and a maximum of 512 service threads. The number of service threads is a function of how much RAM and how many CPUs are on each OSS node (1 thread / 128MB * num_cpus). If the load on the OSS node is high, new service threads will be started in order to process more requests concurrently, up to 4x the initial number of threads (subject to the maximum of 512). For a 2GB 2-CPU system, the default thread count is 32 and the maximum thread count is 128. - Increasing the size of the thread pool may help when: - - Several OSTs are exported from a single OSS + For further details, see . +
+
+ <indexterm><primary>tuning</primary><secondary>MDS threads</secondary></indexterm>Specifying the MDS Service Thread Count + The mds_num_threads parameter enables the number of MDS service threads to be specified at module load time on the MDS node: + options mds mds_num_threads={N} + After startup, the minimum and maximum number of MDS thread counts can be set via the {service}.thread_{min,max,started} tunable. To change the tunable at runtime, run: + lctl {get,set}_param {service}.thread_{min,max,started} + For details, see . + At this time, no testing has been done to determine the optimal number of MDS threads. The default value varies, based on server size, up to a maximum of 32. The maximum number of threads (MDS_MAX_THREADS) is 512. + + The OSS and MDS automatically start new service threads dynamically, in response to server load within a factor of 4. The default value is calculated the same way as before. Setting the _mu_threads module parameter disables automatic thread creation behavior. + + Lustre software release 2.3 introduced new parameters to provide more control to + administrators. + + + mds_rdpg_num_threads controls the number of threads in providing + the read page service. The read page service handles file close and readdir + operations. - - - Back-end storage is running synchronously + + mds_attr_num_threads controls the number of threads in providing + the setattr service to clients running Lustre software release 1.8. - - - I/O completions take excessive time due to slow storage + + Default values for the thread counts are automatically selected. The values are chosen to best exploit the number of CPUs present in the system and to provide best overall performance for typical workloads. +
+
+
+ <indexterm><primary>tuning</primary><secondary>MDS binding</secondary></indexterm>Binding MDS Service Thread to CPU Partitions + With the introduction of Node Affinity () in Lustre software + release 2.3, MDS threads can be bound to particular CPU partitions (CPTs). Default values for + bindings are selected automatically to provide good overall performance for a given CPU count. + However, an administrator can deviate from these setting if they choose. + + + mds_num_cpts=[EXPRESSION] binds the default MDS service threads to CPTs defined by EXPRESSION. For example mdt_num_cpts=[0-3] will bind the MDS service threads to CPT[0,1,2,3]. + + + mds_rdpg_num_cpts=[EXPRESSION] binds the read page service threads to CPTs defined by EXPRESSION. The read page service handles file close and readdir requests. For example mdt_rdpg_num_cpts=[4] will bind the read page threads to CPT4. + + + mds_attr_num_cpts=[EXPRESSION] binds the setattr service threads to CPTs defined by EXPRESSION. + + +
+
+ + <indexterm> + <primary>LNET</primary> + <secondary>tuning</secondary> + </indexterm><indexterm> + <primary>tuning</primary> + <secondary>LNET</secondary> + </indexterm>Tuning LNET Parameters + This section describes LNET tunables, the use of which may be necessary on some systems to + improve performance. To test the performance of your Lustre network, see . +
+ Transmit and Receive Buffer Size + The kernel allocates buffers for sending and receiving messages on a network. + ksocklnd has separate parameters for the transmit and receive buffers. + options ksocklnd tx_buffer_size=0 rx_buffer_size=0 + + If these parameters are left at the default value (0), the system automatically tunes the transmit and receive buffer size. In almost every case, this default produces the best performance. Do not attempt to tune these parameters unless you are a network expert. +
+
+ Hardware Interrupts (<literal>enable_irq_affinity</literal>) + The hardware interrupts that are generated by network adapters may be handled by any CPU in the system. In some cases, we would like network traffic to remain local to a single CPU to help keep the processor cache warm and minimize the impact of context switches. This is helpful when an SMP system has more than one network interface and ideal when the number of interfaces equals the number of CPUs. To enable the enable_irq_affinity parameter, enter: + options ksocklnd enable_irq_affinity=1 + In other cases, if you have an SMP platform with a single fast interface such as 10 Gb + Ethernet and more than two CPUs, you may see performance improve by turning this parameter + off. + options ksocklnd enable_irq_affinity=0 + By default, this parameter is off. As always, you should test the performance to compare the impact of changing this parameter. +
+
<indexterm><primary>tuning</primary><secondary>Network interface binding</secondary></indexterm>Binding Network Interface Against CPU Partitions + Lustre software release 2.3 and beyond provide enhanced network interface control. The + enhancement means that an administrator can bind an interface to one or more CPU partitions. + Bindings are specified as options to the LNET modules. For more information on specifying + module options, see + For example, o2ib0(ib0)[0,1] will ensure that all messages + for o2ib0 will be handled by LND threads executing on + CPT0 and CPT1. An additional example might be: + tcp1(eth0)[0]. Messages for tcp1 are handled by + threads on CPT0. +
+
<indexterm><primary>tuning</primary><secondary>Network interface credits</secondary></indexterm>Network Interface Credits + Network interface (NI) credits are shared across all CPU partitions (CPT). For example, + if a machine has four CPTs and the number of NI credits is 512, then each partition has 128 + credits. If a large number of CPTs exist on the system, LNET checks and validates the NI + credits for each CPT to ensure each CPT has a workable number of credits. For example, if a + machine has 16 CPTs and the number of NI credits is 256, then each partition only has 16 + credits. 16 NI credits is low and could negatively impact performance. As a result, LNET + automatically adjusts the credits to 8*peer_credits + (peer_credits is 8 by default), so each partition has 64 + credits. + Increasing the number of credits/peer_credits can + improve the performance of high latency networks (at the cost of consuming more memory) by + enabling LNET to send more inflight messages to a specific network/peer and keep the + pipeline saturated. + An administrator can modify the NI credit count using ksoclnd or + ko2iblnd. In the example below, 256 credits are applied to TCP + connections. + ksocklnd credits=256 + Applying 256 credits to IB connections can be achieved with: + ko2iblnd credits=256 + + In Lustre software release 2.3 and beyond, LNET may revalidate the NI credits, so the + administrator's request may not persist. + +
+
<indexterm><primary>tuning</primary><secondary>router buffers</secondary></indexterm>Router Buffers + When a node is set up as an LNET router, three pools of buffers are allocated: tiny, + small and large. These pools are allocated per CPU partition and are used to buffer messages + that arrive at the router to be forwarded to the next hop. The three different buffer sizes + accommodate different size messages. + If a message arrives that can fit in a tiny buffer then a tiny buffer is used, if a + message doesn’t fit in a tiny buffer, but fits in a small buffer, then a small buffer is + used. Finally if a message does not fit in either a tiny buffer or a small buffer, a large + buffer is used. + Router buffers are shared by all CPU partitions. For a machine with a large number of + CPTs, the router buffer number may need to be specified manually for best performance. A low + number of router buffers risks starving the CPU partitions of resources. + + + tiny_router_buffers: Zero payload buffers used for signals and + acknowledgements. - - - Decreasing the size of the thread pool may help if: - - Clients are overwhelming the storage capacity + + small_router_buffers: 4 KB payload buffers for small + messages - - - There are lots of "slow I/O" or similar messages + + large_router_buffers: 1 MB maximum payload buffers, corresponding + to the recommended RPC size of 1 MB. + + The default setting for router buffers typically results in acceptable performance. LNET + automatically sets a default value to reduce the likelihood of resource starvation. The size + of a router buffer can be modified as shown in the example below. In this example, the size + of the large buffer is modified using the large_router_buffers + parameter. + lnet large_router_buffers=8192 + + In Lustre software release 2.3 and beyond, LNET may revalidate the router buffer + setting, so the administrator's request may not persist. + +
+
<indexterm><primary>tuning</primary><secondary>portal round-robin</secondary></indexterm>Portal Round-Robin + Portal round-robin defines the policy LNET applies to deliver events and messages to the + upper layers. The upper layers are PLRPC service or LNET selftest. + If portal round-robin is disabled, LNET will deliver messages to CPTs based on a hash of the + source NID. Hence, all messages from a specific peer will be handled by the same CPT. This + can reduce data traffic between CPUs. However, for some workloads, this behavior may result + in poorly balancing loads across the CPU. + If portal round-robin is enabled, LNET will round-robin incoming events across all CPTs. This + may balance load better across the CPU but can incur a cross CPU overhead. + The current policy can be changed by an administrator with echo value > /proc/sys/lnet/portal_rotor. There are four options for value: + + + OFF + Disable portal round-robin on all incoming requests. + + + ON + Enable portal round-robin on all incoming requests. + + + RR_RT + Enable portal round-robin only for routed messages. + + + HASH_RT + Routed messages will be delivered to the upper layer by hash of source NID (instead of NID of router.) This is the default value. + + - - Increasing the number of I/O threads allows the kernel and storage to aggregate many writes together for more efficient disk I/O. The OSS thread pool is shared--each thread allocates approximately 1.5 MB (maximum RPC size + 0.5 MB) for internal I/O buffers. - It is very important to consider memory consumption when increasing the thread pool size. Drives are only able to sustain a certain amount of parallel I/O activity before performance is degraded, due to the high number of seeks and the OST threads just waiting for I/O. In this situation, it may be advisable to decrease the load by decreasing the number of OST threads. - Determining the optimum number of OST threads is a process of trial and error, and varies for each particular configuration. Variables include the number of OSTs on each OSS, number and speed of disks, RAID configuration, and available RAM. You may want to start with a number of OST threads equal to the number of actual disk spindles on the node. If you use RAID, subtract any dead spindles not used for actual data (e.g., 1 of N of spindles for RAID5, 2 of N spindles for RAID6), and monitor the performance of clients during usual workloads. If performance is degraded, increase the thread count and see how that works until performance is degraded again or you reach satisfactory performance. - If there are too many threads, the latency for individual I/O requests can become very high and should be avoided. Set the desired maximum thread count permanently using the method described above. -
- <anchor xml:id="dbdoclet.50438272_pgfId-1295614" xreflabel=""/>25.1.1 <anchor xml:id="dbdoclet.50438272_60005" xreflabel=""/>Specifying the OSS Service <anchor xml:id="dbdoclet.50438272_marker-1294858" xreflabel=""/>Thread Count - The oss_num_threads parameter enables the number of OST service threads to be specified at module load time on the OSS nodes: - options ost oss_num_threads={N} - After startup, the minimum and maximum number of OSS thread counts can be set via the {service}.thread_{min,max,started} tunable. To change the tunable at runtime, run: - lctl {get,set}_param {service}.thread_{min,max,started} - For details, see Setting MDS and OSS Thread Counts. -
-
- <anchor xml:id="dbdoclet.50438272_pgfId-1293756" xreflabel=""/>25.1.2 Specifying the MDS Service <anchor xml:id="dbdoclet.50438272_marker-1293755" xreflabel=""/>Thread Count - The mds_num_threads parameter enables the number of MDS service threads to be specified at module load time on the MDS node: - options mds mds_num_threads={N} - After startup, the minimum and maximum number of MDS thread counts can be set via the {service}.thread_{min,max,started} tunable. To change the tunable at runtime, run: - lctl {get,set}_param {service}.thread_{min,max,started} - For details, see Setting MDS and OSS Thread Counts. - At this time, no testing has been done to determine the optimal number of MDS threads. The default value varies, based on server size, up to a maximum of 32. The maximum number of threads (MDS_MAX_THREADS) is 512. - The OSS and MDS automatically start new service threads dynamically, in response to server load within a factor of 4. The default value is calculated the same way as before. Setting the _mu_threads module parameter disables automatic thread creation behavior. -
-
- 25.2 Tuning LNET Parameters - This section describes LNET tunables. that may be necessary on some systems to improve performance. To test the performance of your Lustre network, see Chapter 23: Testing Lustre Network Performance (LNET Self-Test). -
- <anchor xml:id="dbdoclet.50438272_pgfId-1291141" xreflabel=""/>25.2.1 Transmit and Receive Buffer Size - The kernel allocates buffers for sending and receiving messages on a network. - ksocklnd has separate parameters for the transmit and receive buffers. - options ksocklnd tx_buffer_size=0 rx_buffer_size=0 - - If these parameters are left at the default value (0), the system automatically tunes the transmit and receive buffer size. In almost every case, this default produces the best performance. Do not attempt to tune these parameters unless you are a network expert. -
-
- <anchor xml:id="dbdoclet.50438272_pgfId-1291145" xreflabel=""/>25.2.2 Hardware Interrupts (enable_irq_affinity) - The hardware interrupts that are generated by network adapters may be handled by any CPU in the system. In some cases, we would like network traffic to remain local to a single CPU to help keep the processor cache warm and minimize the impact of context switches. This is helpful when an SMP system has more than one network interface and ideal when the number of interfaces equals the number of CPUs. To enable the enable_irq_affinity parameter, enter: - options ksocklnd enable_irq_affinity=1 - - In other cases, if you have an SMP platform with a single fast interface such as 10Gb Ethernet and more than two CPUs, you may see performance improve by turning this parameter off. - options ksocklnd enable_irq_affinity=0 - - By default, this parameter is off. As always, you should test the performance to compare the impact of changing this parameter. -
+
+ LNET Peer Health + Two options are available to help determine peer health: + + peer_timeout - The timeout (in seconds) before an aliveness + query is sent to a peer. For example, if peer_timeout is set to + 180sec, an aliveness query is sent to the peer every 180 seconds. + This feature only takes effect if the node is configured as an LNET router. + In a routed environment, the peer_timeout feature should always + be on (set to a value in seconds) on routers. If the router checker has been enabled, + the feature should be turned off by setting it to 0 on clients and servers. + For a non-routed scenario, enabling the peer_timeout option + provides health information such as whether a peer is alive or not. For example, a + client is able to determine if an MGS or OST is up when it sends it a message. If a + response is received, the peer is alive; otherwise a timeout occurs when the request + is made. + In general, peer_timeout should be set to no less than the LND + timeout setting. For more information about LND timeouts, see . + When the o2iblnd (IB) driver is used, + peer_timeout should be at least twice the value of the + ko2iblnd keepalive option. for more information about keepalive + options, see . + + + avoid_asym_router_failure – When set to 1, the router checker + running on the client or a server periodically pings all the routers corresponding to + the NIDs identified in the routes parameter setting on the node to determine the + status of each router interface. The default setting is 1. (For more information about + the LNET routes parameter, see + A router is considered down if any of its NIDs are down. For example, router X has + three NIDs: Xnid1, Xnid2, and + Xnid3. A client is connected to the router via + Xnid1. The client has router checker enabled. The router checker + periodically sends a ping to the router via Xnid1. The router + responds to the ping with the status of each of its NIDs. In this case, it responds + with Xnid1=up, Xnid2=up, + Xnid3=down. If avoid_asym_router_failure==1, + the router is considered down if any of its NIDs are down, so router X is considered + down and will not be used for routing messages. If + avoid_asym_router_failure==0, router X will continue to be used + for routing messages. + + + The following router checker parameters must be set to the maximum value of the + corresponding setting for this option on any client or server: + + dead_router_check_interval + + + + live_router_check_interval + + + router_ping_timeout + + + For example, the dead_router_check_interval parameter on any router + must be MAX.
-
- 25.3 Lockless <anchor xml:id="dbdoclet.50438272_marker-1291703" xreflabel=""/>I/O Tunables - The lockless I/O tunable feature allows servers to ask clients to do lockless I/O (liblustre-style where the server does the locking) on contended files. - The lockless I/O patch introduces these tunables: - - OST-side: - +
+
+ <indexterm><primary>tuning</primary><secondary>libcfs</secondary></indexterm>libcfs Tuning +By default, the Lustre software will automatically generate CPU partitions (CPT) based on the + number of CPUs in the system. The CPT number will be 1 if the online CPU number is less than + five. + The CPT number can be explicitly set on the libcfs module using cpu_npartitions=NUMBER. The value of cpu_npartitions must be an integer between 1 and the number of online CPUs. +Setting CPT to 1 will disable most of the SMP Node Affinity functionality. +
+ CPU Partition String Patterns + CPU partitions can be described using string pattern notation. For example: + + + cpu_pattern="0[0,2,4,6] 1[1,3,5,7] + Create two CPTs, CPT0 contains CPU[0, 2, 4, 6]. CPT1 contains CPU[1,3,5,7]. + + cpu_pattern="N 0[0-3] 1[4-7] + Create two CPTs, CPT0 contains all CPUs in NUMA node[0-3], CPT1 contains all CPUs in NUMA node [4-7]. + + + The current configuration of the CPU partition can be read from + /proc/sys/lnet/cpu_partitions +
+
+
+ <indexterm><primary>tuning</primary><secondary>LND tuning</secondary></indexterm>LND Tuning + LND tuning allows the number of threads per CPU partition to be specified. An administrator can set the threads for both ko2iblnd and ksocklnd using the nscheds parameter. This adjusts the number of threads for each partition, not the overall number of threads on the LND. + Lustre software release 2.3 has greatly decreased the default number of threads for + ko2iblnd and ksocklnd on high-core count machines. + The current default values are automatically set and are chosen to work well across a number + of typical scenarios. +
+
+ <indexterm><primary>tuning</primary><secondary>Network Request Scheduler (NRS) Tuning</secondary></indexterm>Network Request Scheduler (NRS) Tuning + The Network Request Scheduler (NRS) allows the administrator to influence the order in which RPCs are handled at servers, on a per-PTLRPC service basis, by providing different policies that can be activated and tuned in order to influence the RPC ordering. The aim of this is to provide for better performance, and possibly discrete performance characteristics using future policies. + The NRS policy state of a PTLRPC service can be read and set via the {service}.nrs_policies tunable. To read a PTLRPC service's NRS policy state, run: + lctl get_param {service}.nrs_policies + For example, to read the NRS policy state of the ost_io service, + run: + $ lctl get_param ost.OSS.ost_io.nrs_policies +ost.OSS.ost_io.nrs_policies= - - /proc/fs/lustre/ldlm/namespaces/filter-lustre-* - - contended_locks - If the number of lock conflicts in the scan of granted and waiting queues at contended_locks is exceeded, the resource is considered to be contended. - contention_seconds - The resource keeps itself in a contended state as set in the parameter. - max_nolock_bytes - Server-side locking set only for requests less than the blocks set in the max_nolock_bytes parameter. If this tunable is set to zero (0), it disables server-side locking for read/write requests. - - Client-side: - +regular_requests: + - name: fifo + state: started + fallback: yes + queued: 0 + active: 0 - - /proc/fs/lustre/llite/lustre-* - - contention_seconds - llite inode remembers its contended state for the time specified in this parameter. - - Client-side statistics: - + - name: crrn + state: stopped + fallback: no + queued: 0 + active: 0 - - The /proc/fs/lustre/llite/lustre-*/stats file has new rows for lockless I/O statistics. - lockless_read_bytes and lockless_write_bytes - To count the total bytes read or written, the client makes its own decisions based on the request size. The client does not communicate with the server if the request size is smaller than the min_nolock_size, without acquiring locks by the client. -
-
- 25.4 Improving Lustre <anchor xml:id="dbdoclet.50438272_marker-1295851" xreflabel=""/>Performance When Working with Small Files - A Lustre environment where an application writes small file chunks from many clients to a single file will result in bad I/O performance. To improve Lustre'™s performance with small files: - - Have the application aggregate writes some amount before submitting them to Lustre. By default, Lustre enforces POSIX coherency semantics, so it results in lock ping-pong between client nodes if they are all writing to the same file at one time. - + - name: orr + state: stopped + fallback: no + queued: 0 + active: 0 - - Have the application do 4kB O_DIRECT sized I/O to the file and disable locking on the output file. This avoids partial-page IO submissions and, by disabling locking, you avoid contention between clients. - + - name: trr + state: started + fallback: no + queued: 2420 + active: 268 - - Have the application write contiguous data. - +high_priority_requests: + - name: fifo + state: started + fallback: yes + queued: 0 + active: 0 - - Add more disks or use SSD disks for the OSTs. This dramatically improves the IOPS rate. Consider creating larger OSTs rather than many smaller OSTs due to less overhead (journal, connections, etc). - + - name: crrn + state: stopped + fallback: no + queued: 0 + active: 0 - - Use RAID-1+0 OSTs instead of RAID-5/6. There is RAID parity overhead for writing small chunks of data to disk. - + - name: orr + state: stopped + fallback: no + queued: 0 + active: 0 - + - name: trr + state: stopped + fallback: no + queued: 0 + active: 0 + + NRS policy state is shown in either one or two sections, depending on the PTLRPC service being queried. The first section is named regular_requests and is available for all PTLRPC services, optionally followed by a second section which is named high_priority_requests. This is because some PTLRPC services are able to treat some types of RPCs as higher priority ones, such that they are handled by the server with higher priority compared to other, regular RPC traffic. For PTLRPC services that do not support high-priority RPCs, you will only see the regular_requests section. + There is a separate instance of each NRS policy on each PTLRPC service for handling regular and high-priority RPCs (if the service supports high-priority RPCs). For each policy instance, the following fields are shown: + + + + + + + + Field + + + Description + + + + + + + name + + + The name of the policy. + + + + + state + + + The state of the policy; this can be any of invalid, stopping, stopped, starting, started. A fully enabled policy is in the started state. + + + + + fallback + + + Whether the policy is acting as a fallback policy or not. A fallback policy is used to handle RPCs that other enabled policies fail to handle, or do not support the handling of. The possible values are no, yes. Currently, only the FIFO policy can act as a fallback policy. + + + + + queued + + + The number of RPCs that the policy has waiting to be serviced. + + + + + active + + + The number of RPCs that the policy is currently handling. + + + + + + To enable an NRS policy on a PTLRPC service run: + lctl set_param {service}.nrs_policies=policy_name + This will enable the policy policy_name for both regular and high-priority RPCs (if the PLRPC service supports high-priority RPCs) on the given service. For example, to enable the CRR-N NRS policy for the ldlm_cbd service, run: + $ lctl set_param ldlm.services.ldlm_cbd.nrs_policies=crrn +ldlm.services.ldlm_cbd.nrs_policies=crrn + + For PTLRPC services that support high-priority RPCs, you can also supply an optional reg|hp token, in order to enable an NRS policy for handling only regular or high-priority RPCs on a given PTLRPC service, by running: + lctl set_param {service}.nrs_policies="policy_name reg|hp" + For example, to enable the TRR policy for handling only regular, but not high-priority + RPCs on the ost_io service, run: + $ lctl set_param ost.OSS.ost_io.nrs_policies="trr reg" +ost.OSS.ost_io.nrs_policies="trr reg" + + + When enabling an NRS policy, the policy name must be given in lower-case characters, otherwise the operation will fail with an error message. + +
+ <indexterm> + <primary>tuning</primary> + <secondary>Network Request Scheduler (NRS) Tuning</secondary> + <tertiary>first in, first out (FIFO) policy</tertiary> + </indexterm>First In, First Out (FIFO) policy + The first in, first out (FIFO) policy handles RPCs in a service in the same order as + they arrive from the LNET layer, so no special processing takes place to modify the RPC + handling stream. FIFO is the default policy for all types of RPCs on all PTLRPC services, + and is always enabled irrespective of the state of other policies, so that it can be used as + a backup policy, in case a more elaborate policy that has been enabled fails to handle an + RPC, or does not support handling a given type of RPC. + The FIFO policy has no tunables that adjust its behaviour.
-
- 25.5 Understanding Why Write Performance Is Better Than Read Performance - Typically, the performance of write operations on a Lustre cluster is better than read operations. When doing writes, all clients are sending write RPCs asynchronously. The RPCs are allocated, and written to disk in the order they arrive. In many cases, this allows the back-end storage to aggregate writes efficiently. - In the case of read operations, the reads from clients may come in a different order and need a lot of seeking to get read from the disk. This noticeably hampers the read throughput. - Currently, there is no readahead on the OSTs themselves, though the clients do readahead. If there are lots of clients doing reads it would not be possible to do any readahead in any case because of memory consumption (consider that even a single RPC (1 MB) readahead for 1000 clients would consume 1 GB of RAM). - For file systems that use socklnd (TCP, Ethernet) as interconnect, there is also additional CPU overhead because the client cannot receive data without copying it from the network buffers. In the write case, the client CAN send data without the additional data copy. This means that the client is more likely to become CPU-bound during reads than writes. +
+ <indexterm> + <primary>tuning</primary> + <secondary>Network Request Scheduler (NRS) Tuning</secondary> + <tertiary>client round-robin over NIDs (CRR-N) policy</tertiary> + </indexterm>Client Round-Robin over NIDs (CRR-N) policy + The client round-robin over NIDs (CRR-N) policy performs batched round-robin scheduling + of all types of RPCs, with each batch consisting of RPCs originating from the same client + node, as identified by its NID. CRR-N aims to provide for better resource utilization across + the cluster, and to help shorten completion times of jobs in some cases, by distributing + available bandwidth more evenly across all clients. + The CRR-N policy can be enabled on all types of PTLRPC services, and has the following + tunable that can be used to adjust its behavior: + + + {service}.nrs_crrn_quantum + The {service}.nrs_crrn_quantum tunable determines the maximum allowed size of each batch of RPCs; the unit of measure is in number of RPCs. To read the maximum allowed batch size of a CRR-N policy, run: + lctl get_param {service}.nrs_crrn_quantum + For example, to read the maximum allowed batch size of a CRR-N policy on the ost_io service, run: + $ lctl get_param ost.OSS.ost_io.nrs_crrn_quantum +ost.OSS.ost_io.nrs_crrn_quantum=reg_quantum:16 +hp_quantum:8 + + You can see that there is a separate maximum allowed batch size value for regular (reg_quantum) and high-priority (hp_quantum) RPCs (if the PTLRPC service supports high-priority RPCs). + To set the maximum allowed batch size of a CRR-N policy on a given service, run: + lctl set_param {service}.nrs_crrn_quantum=1-65535 + This will set the maximum allowed batch size on a given service, for both regular and high-priority RPCs (if the PLRPC service supports high-priority RPCs), to the indicated value. + For example, to set the maximum allowed batch size on the ldlm_canceld service to 16 RPCs, run: + $ lctl set_param ldlm.services.ldlm_canceld.nrs_crrn_quantum=16 +ldlm.services.ldlm_canceld.nrs_crrn_quantum=16 + + For PTLRPC services that support high-priority RPCs, you can also specify a different maximum allowed batch size for regular and high-priority RPCs, by running: + $ lctl set_param {service}.nrs_crrn_quantum=reg_quantum|hp_quantum:1-65535" + For example, to set the maximum allowed batch size on the ldlm_canceld service, for high-priority RPCs to 32, run: + $ lctl set_param ldlm.services.ldlm_canceld.nrs_crrn_quantum="hp_quantum:32" +ldlm.services.ldlm_canceld.nrs_crrn_quantum=hp_quantum:32 + + By using the last method, you can also set the maximum regular and high-priority RPC batch sizes to different values, in a single command invocation. + +
+
+ <indexterm> + <primary>tuning</primary> + <secondary>Network Request Scheduler (NRS) Tuning</secondary> + <tertiary>object-based round-robin (ORR) policy</tertiary> + </indexterm>Object-based Round-Robin (ORR) policy + The object-based round-robin (ORR) policy performs batched round-robin scheduling of + bulk read write (brw) RPCs, with each batch consisting of RPCs that pertain to the same + backend-file system object, as identified by its OST FID. + The ORR policy is only available for use on the ost_io service. The RPC batches it forms can potentially consist of mixed bulk read and bulk write RPCs. The RPCs in each batch are ordered in an ascending manner, based on either the file offsets, or the physical disk offsets of each RPC (only applicable to bulk read RPCs). + The aim of the ORR policy is to provide for increased bulk read throughput in some cases, by ordering bulk read RPCs (and potentially bulk write RPCs), and thus minimizing costly disk seek operations. Performance may also benefit from any resulting improvement in resource utilization, or by taking advantage of better locality of reference between RPCs. + The ORR policy has the following tunables that can be used to adjust its behaviour: + + + ost.OSS.ost_io.nrs_orr_quantum + The ost.OSS.ost_io.nrs_orr_quantum tunable determines the maximum allowed size of each batch of RPCs; the unit of measure is in number of RPCs. To read the maximum allowed batch size of the ORR policy, run: + $ lctl get_param ost.OSS.ost_io.nrs_orr_quantum +ost.OSS.ost_io.nrs_orr_quantum=reg_quantum:256 +hp_quantum:16 + + You can see that there is a separate maximum allowed batch size value for regular (reg_quantum) and high-priority (hp_quantum) RPCs (if the PTLRPC service supports high-priority RPCs). + To set the maximum allowed batch size for the ORR policy, run: + $ lctl set_param ost.OSS.ost_io.nrs_orr_quantum=1-65535 + This will set the maximum allowed batch size for both regular and high-priority RPCs, to the indicated value. + You can also specify a different maximum allowed batch size for regular and high-priority RPCs, by running: + $ lctl set_param ost.OSS.ost_io.nrs_orr_quantum=reg_quantum|hp_quantum:1-65535 + For example, to set the maximum allowed batch size for regular RPCs to 128, run: + $ lctl set_param ost.OSS.ost_io.nrs_orr_quantum=reg_quantum:128 +ost.OSS.ost_io.nrs_orr_quantum=reg_quantum:128 + + By using the last method, you can also set the maximum regular and high-priority RPC batch sizes to different values, in a single command invocation. + + + ost.OSS.ost_io.nrs_orr_offset_type + The ost.OSS.ost_io.nrs_orr_offset_type tunable determines whether the ORR policy orders RPCs within each batch based on logical file offsets or physical disk offsets. To read the offset type value for the ORR policy, run: + $ lctl get_param ost.OSS.ost_io.nrs_orr_offset_type +ost.OSS.ost_io.nrs_orr_offset_type=reg_offset_type:physical +hp_offset_type:logical + + You can see that there is a separate offset type value for regular (reg_offset_type) and high-priority (hp_offset_type) RPCs. + To set the ordering type for the ORR policy, run: + $ lctl set_param ost.OSS.ost_io.nrs_orr_offset_type=physical|logical + This will set the offset type for both regular and high-priority RPCs, to the indicated value. + You can also specify a different offset type for regular and high-priority RPCs, by running: + $ lctl set_param ost.OSS.ost_io.nrs_orr_offset_type=reg_offset_type|hp_offset_type:physical|logical + For example, to set the offset type for high-priority RPCs to physical disk offsets, run: + $ lctl set_param ost.OSS.ost_io.nrs_orr_offset_type=hp_offset_type:physical +ost.OSS.ost_io.nrs_orr_offset_type=hp_offset_type:physical + By using the last method, you can also set offset type for regular and high-priority RPCs to different values, in a single command invocation. + Irrespective of the value of this tunable, only logical offsets can, and are used for ordering bulk write RPCs. + + + ost.OSS.ost_io.nrs_orr_supported + The ost.OSS.ost_io.nrs_orr_supported tunable determines the type of RPCs that the ORR policy will handle. To read the types of supported RPCs by the ORR policy, run: + $ lctl get_param ost.OSS.ost_io.nrs_orr_supported +ost.OSS.ost_io.nrs_orr_supported=reg_supported:reads +hp_supported=reads_and_writes + + You can see that there is a separate supported 'RPC types' value for regular (reg_supported) and high-priority (hp_supported) RPCs. + To set the supported RPC types for the ORR policy, run: + $ lctl set_param ost.OSS.ost_io.nrs_orr_supported=reads|writes|reads_and_writes + This will set the supported RPC types for both regular and high-priority RPCs, to the indicated value. + You can also specify a different supported 'RPC types' value for regular and high-priority RPCs, by running: + $ lctl set_param ost.OSS.ost_io.nrs_orr_supported=reg_supported|hp_supported:reads|writes|reads_and_writes + For example, to set the supported RPC types to bulk read and bulk write RPCs for regular requests, run: + $ lctl set_param ost.OSS.ost_io.nrs_orr_supported=reg_supported:reads_and_writes +ost.OSS.ost_io.nrs_orr_supported=reg_supported:reads_and_writes + + By using the last method, you can also set the supported RPC types for regular and high-priority RPC to different values, in a single command invocation. + + +
+
+ <indexterm> + <primary>tuning</primary> + <secondary>Network Request Scheduler (NRS) Tuning</secondary> + <tertiary>Target-based round-robin (TRR) policy</tertiary> + </indexterm>Target-based Round-Robin (TRR) policy + The target-based round-robin (TRR) policy performs batched round-robin scheduling of brw + RPCs, with each batch consisting of RPCs that pertain to the same OST, as identified by its + OST index. + The TRR policy is identical to the object-based round-robin (ORR) policy, apart from + using the brw RPC's target OST index instead of the backend-fs object's OST FID, for + determining the RPC scheduling order. The goals of TRR are effectively the same as for ORR, + and it uses the following tunables to adjust its behaviour: + + + ost.OSS.ost_io.nrs_trr_quantum + The purpose of this tunable is exactly the same as for the ost.OSS.ost_io.nrs_orr_quantum tunable for the ORR policy, and you can use it in exactly the same way. + + + ost.OSS.ost_io.nrs_trr_offset_type + The purpose of this tunable is exactly the same as for the ost.OSS.ost_io.nrs_orr_offset_type tunable for the ORR policy, and you can use it in exactly the same way. + + + ost.OSS.ost_io.nrs_trr_supported + The purpose of this tunable is exactly the same as for the ost.OSS.ost_io.nrs_orr_supported tunable for the ORR policy, and you can use it in exactly the sme way. + + +
+
+ <indexterm> + <primary>tuning</primary> + <secondary>Network Request Scheduler (NRS) Tuning</secondary> + <tertiary>Token Bucket Filter (TBF) policy</tertiary> + </indexterm>Token Bucket Filter (TBF) policy + The TBF (Token Bucket Filter) is a Lustre NRS policy which enables Lustre services + to enforce the RPC rate limit on clients/jobs for QoS (Quality of Service) purposes. +
+ The internal structure of TBF policy + + + + + + The internal structure of TBF policy + + +
+ When a RPC request arrives, TBF policy puts it to a waiting queue according to its + classification. The classification of RPC requests is based on either NID or JobID of the + RPC according to the configure of TBF. TBF policy maintains multiple queues in the system, + one queue for each category in the classification of RPC requests. The requests waits for + tokens in the FIFO queue before they have been handled so as to keep the RPC rates under the limits. +When Lustre services are too busy to handle all of the requests in time, all of the + specified rates of the queues will not be satisfied. Nothing bad will happen except + some of the RPC rates are slower than configured. In this case, the queue with higher + rate will have an advantage over the queues with lower rates, but none of them will be starved. +To manage the RPC rate of queues, we don't need to set the rate of each queue manually. + Instead, we define rules which TBF policy matches to determine RPC rate limits. All of + the defined rules are organized as an ordered list. Whenever a queue is newly created, + it goes though the rule list and takes the first matched rule as its rule, so that the + queue knows its RPC token rate. A rule can be added to or removed from the list at run + time. Whenever the list of rules is changed, the queues will update their matched rules. + + + ost.OSS.ost_io.nrs_tbf_rule + The format of the rule start command of TBF policy is as follows: + $ lctl set_param x.x.x.nrs_tbf_rule= + "[reg|hp] start rule_name arguments..." + The 'rule_name' argument is a string which identifies a rule. + The format of the 'arguments' is changing according to the + type of the TBF policy. For the NID based TBF policy, its format is as follows: + $ lctl set_param x.x.x.nrs_tbf_rule= + "[reg|hp] start rule_name {nidlist} rate" + The format of 'nidlist' argument is the same as the + format when configuring LNET route. The 'rate' argument is + the RPC rate of the rule, means the upper limit number of requests per second. + Following commands are valid. Please note that a newly started rule is prior to old rules, + so the order of starting rules is critical too. + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "start other_clients {192.168.*.*@tcp} 50" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "start loginnode {192.168.1.1@tcp} 100" + General rule can be replaced by two rules (reg and hp) as follows: + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "reg start loginnode {192.168.1.1@tcp} 100" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "hp start loginnode {192.168.1.1@tcp} 100" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "start computes {192.168.1.[2-128]@tcp} 500" + The above rules will put an upper limit for servers to process at most 5x as many RPCs + from compute nodes as login nodes. + For the JobID (please see for more details) based TBF policy, its format is as follows: + $ lctl set_param x.x.x.nrs_tbf_rule= + "[reg|hp] start name {jobid_list} rate" + Following commands are valid: + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "start user1 {iozone.500 dd.500} 100" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "start iozone_user1 {iozone.500} 100" + Same as nid, could use reg and hp rules separately: + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "hp start iozone_user1 {iozone.500} 100" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule= + "reg start iozone_user1 {iozone.500} 100" + The format of the rule change command of TBF policy is as follows: + $ lctl set_param x.x.x.nrs_tbf_rule= + "[reg|hp] change rule_name rate" + Following commands are valid: + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="change loginnode 200" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="reg change loginnode 200" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="hp change loginnode 200" + The format of the rule stop command of TBF policy is as follows: + $ lctl set_param x.x.x.nrs_tbf_rule="[reg|hp] stop rule_name" + Following commands are valid: + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="stop loginnode" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="reg stop loginnode" + $ lctl set_param ost.OSS.ost_io.nrs_tbf_rule="hp stop loginnode" + + +
+
+
+ <indexterm><primary>tuning</primary><secondary>lockless I/O</secondary></indexterm>Lockless I/O Tunables + The lockless I/O tunable feature allows servers to ask clients to do lockless I/O (liblustre-style where the server does the locking) on contended files. + The lockless I/O patch introduces these tunables: + + + OST-side: + /proc/fs/lustre/ldlm/namespaces/filter-lustre-* + + contended_locks - If the number of lock conflicts in the scan of granted and waiting queues at contended_locks is exceeded, the resource is considered to be contended. + contention_seconds - The resource keeps itself in a contended state as set in the parameter. + max_nolock_bytes - Server-side locking set only for requests less than the blocks set in the max_nolock_bytes parameter. If this tunable is set to zero (0), it disables server-side locking for read/write requests. + + + Client-side: + /proc/fs/lustre/llite/lustre-* + contention_seconds - llite inode remembers its contended state for the time specified in this parameter. + + + Client-side statistics: + The /proc/fs/lustre/llite/lustre-*/stats file has new rows for lockless I/O statistics. + lockless_read_bytes and lockless_write_bytes - To count the total bytes read or written, the client makes its own decisions based on the request size. The client does not communicate with the server if the request size is smaller than the min_nolock_size, without acquiring locks by the client. + + +
+
+ <indexterm> + <primary>tuning</primary> + <secondary>for small files</secondary> + </indexterm>Improving Lustre File System Performance When Working with Small Files + An environment where an application writes small file chunks from many clients to a single + file will result in bad I/O performance. To improve the performance of the Lustre file system + with small files: + + + Have the application aggregate writes some amount before submitting them to the Lustre + file system. By default, the Lustre software enforces POSIX coherency semantics, so it + results in lock ping-pong between client nodes if they are all writing to the same file at + one time. + + + Have the application do 4kB O_DIRECT sized I/O to the file and disable locking on the output file. This avoids partial-page IO submissions and, by disabling locking, you avoid contention between clients. + + + Have the application write contiguous data. + + + Add more disks or use SSD disks for the OSTs. This dramatically improves the IOPS rate. Consider creating larger OSTs rather than many smaller OSTs due to less overhead (journal, connections, etc). + + + Use RAID-1+0 OSTs instead of RAID-5/6. There is RAID parity overhead for writing small chunks of data to disk. + + +
+
+ <indexterm><primary>tuning</primary><secondary>write performance</secondary></indexterm>Understanding Why Write Performance is Better Than Read Performance + Typically, the performance of write operations on a Lustre cluster is better than read operations. When doing writes, all clients are sending write RPCs asynchronously. The RPCs are allocated, and written to disk in the order they arrive. In many cases, this allows the back-end storage to aggregate writes efficiently. + In the case of read operations, the reads from clients may come in a different order and need a lot of seeking to get read from the disk. This noticeably hampers the read throughput. + Currently, there is no readahead on the OSTs themselves, though the clients do readahead. If there are lots of clients doing reads it would not be possible to do any readahead in any case because of memory consumption (consider that even a single RPC (1 MB) readahead for 1000 clients would consume 1 GB of RAM). + For file systems that use socklnd (TCP, Ethernet) as interconnect, there is also additional CPU overhead because the client cannot receive data without copying it from the network buffers. In the write case, the client CAN send data without the additional data copy. This means that the client is more likely to become CPU-bound during reads than writes. +