19.5. Small File Performance Enhancements The ratio of the time taken to perform operations on the metadata of a file to performing operations on its data determines the difference between large files and small files. Metadata-intensive workload is the term used to identify such workloads. A few performance enhancements can be made to optimize the network and storage performance and minimize the effect of slow throughput and response time for small files in a Red Hat Gluster Storage trusted storage pool. Note For a small-file workload, activate the rhgs-random-io tuned profile. Configuring Threads for Event Processing You can set the client.event-thread and server.event-thread values for the client and server components. Setting the value to 4, for example, would enable handling four network connections simultaneously. Setting the event threads value for a client You can tune the Red Hat Gluster Storage Server performance by tuning the event thread values. Example 19.1. Tuning the event threads for a client accessing a volume Setting the event thread value for a server You can tune the Red Hat Gluster Storage Server performance using event thread values. Example 19.2. Tuning the event threads for a server accessing a volume Verifying the event thread values You can verify the event thread values that are set for the client and server components by executing the following command: See topic, Configuring Volume Options for information on the minimum, maximum, and default values for setting these volume options. Best practices to tune event threads It is possible to see performance gains with the Red Hat Gluster Storage stack by tuning the number of threads processing events from network connections. The following are the recommended best practices to tune the event thread values. As each thread processes a connection at a time, having more threads than connections to either the brick processes ( glusterfsd ) or the client processes ( glusterfs or gfapi ) is not recommended. Due to this reason, monitor the connection counts (using the netstat command) on the clients and on the bricks to arrive at an appropriate number for the event thread count. Configuring a higher event threads value than the available processing units could again cause context switches on these threads. As a result reducing the number deduced from the step to a number that is less that the available processing units is recommended. If a Red Hat Gluster Storage volume has a high number of brick processes running on a single node, then reducing the event threads number deduced in the step would help the competing processes to gain enough concurrency and avoid context switches across the threads. If a specific thread consumes more number of CPU cycles than needed, increasing the event thread count would enhance the performance of the Red Hat Gluster Storage Server. In addition to the deducing the appropriate event-thread count, increasing the server.outstanding-rpc-limit on the storage nodes can also help to queue the requests for the brick processes and not let the requests idle on the network queue. Another parameter that could improve the performance when tuning the event-threads value is to set the performance.io-thread-count (and its related thread-counts) to higher values, as these threads perform the actual IO operations on the underlying file system. 19.5.1. Enabling Lookup Optimization Distribute xlator (DHT) has a performance penalty when it deals with negative lookups. Negative lookups are lookup operations for entries that does not exist in the volume. A lookup for a file/directory that does not exist is a negative lookup. Negative lookups are expensive and typically slows down file creation, as DHT attempts to find the file in all sub-volumes. This especially impacts small file performance, where a large number of files are being added/created in quick succession to the volume. The negative lookup fan-out behavior can be optimized by not performing the same in a balanced volume. The cluster.lookup-optimize configuration option enables DHT lookup optimization. To enable this option run the following command: Note The configuration takes effect for newly created directories immediately post setting the above option. For existing directories, a rebalance is required to ensure the volume is in balance before DHT applies the optimization on older directories.

Commands:
gluster volume set VOLNAME client.event-threads <value>
gluster volume set test-vol client.event-threads 4
gluster volume set VOLNAME server.event-threads <value>
gluster volume set test-vol server.event-threads 4
gluster volume info VOLNAME
gluster volume set VOLNAME cluster.lookup-optimize <on/off>\