MDTest

Description
MDtest is an MPI-based application for evaluating the metadata performance of a file system and has been designed to test parallel file systems. MDTest is not a Lustre-specific benchmark and can be run on any POSIX-compliant file system, but it does require a fully installed and configured file system implementation in order to run. For Lustre, this means the MGS, MDS and OSS services must be installed, configured and running, and that there is a population of Lustre clients running with the Lustre file system mounted.

The  application runs on Lustre clients in a fully configured Lustre file system. Multiple  processes are run in parallel across several nodes using MPI in order to saturate file system I/O. The program can create directory trees of arbitrary depth and can be directed to create a mixture of work-loads, including file-only tests.

Purpose
MDTest measures the metadata performance of a given file system implementation and will run on any POSIX-compliant file system. The program works by creating, stat-ing and deleting a tree of directories and files in parallel across a population of machines (typically compute nodes in an HPC cluster). In the case of Lustre, the machines are Lustre clients. While  can be run stand-alone to measure local file system performance, it is really intended to be run on parallel and shared file systems.

Metadata performance is a critical measurement of file system capability and is increasingly relevant to parallel file system workloads in general. It is therefore important to be able to demonstrate the ability of Lustre to match and even exceed application requirements for file systems. MDTest provides a way to define a standard test that can be used to assess baseline performance of a file system, and provide a comparative measure against storage platforms.

Preparation
The  application is distributed as source code and must be compiled for use on the target environment. There are currently two distributions of, both available on GitHub. They are: LANL / mdtest and LLNL / mdtest. LANL have added features not available in the LLNL version, most notable of which are some Lustre-awareness to allow striping across multiple MDTs and AWS S3 support. There is indeed, even a third option, hidden in the depths of the HPDD JIRA issue tracking system in ticket LU-56.

Why this should be so, it is not this author's place to speculate; nor would he venture to suggest which of these versions is the canonical reference implementation. However, in order to break the deadlock, the remainder of this document shall refer to the LANL  implementation, if for no other reason than that it has had the more recent update.

The remainder of this document will use OpenMPI for the examples. Integration with job schedulers is not discussed – examples will call the  command directly.

Download and Compile MDTest
To compile the  binary, run the following steps on a suitable machine:

 Install the pre-requisite development tools. On RHEL or CentOS systems, this can be accomplished by running the following command:  sudo yum -y install openmpi-devel git  Download the  source:  git clone https://github.com/MDTEST-LANL/mdtest.git   Compile the software:  cd mdtest module load mpi/openmpi-x86_64 make clean && make  Quickly verify that the program runs:  ./mdtest For example:  [mduser@ct7-c1 mdtest]$ ./mdtest -- started at 06/28/2017 03:07:55 --

mdtest-1.9.4-rc1 was launched with 1 total task(s) on 1 node(s) Command line used: ./mdtest Path: /lustre/demo/mdtest FS: 58.0 GiB  Used FS: 1.1%   Inodes: 5.0 Mi   Used Inodes: 0.0%

1 tasks, 0 files/directories

SUMMARY: (of 1 iterations) Operation                     Max            Min           Mean        Std Dev -                     ---            ---                   ---   Directory creation:          0.000          0.000          0.000          0.000 Directory stat   :          0.000          0.000          0.000          0.000 Directory removal :         0.000          0.000          0.000          0.000 File creation    :          0.000          0.000          0.000          0.000 File stat        :          0.000          0.000          0.000          0.000 File read        :          0.000          0.000          0.000          0.000 File removal     :          0.000          0.000          0.000          0.000 Tree creation    :        461.255        461.255        461.255          0.000 Tree removal     :        497.512        497.512        497.512          0.000

-- finished at 06/28/2017 03:07:55 -- Copy the  command onto all of the Lustre client nodes that will be used to run the benchmark. Alternatively, copy onto the Lustre file system itself so that the application is available on all of the nodes automatically.  

Note: There is currently a bug in some versions of the  library, notably version 1.3.0, that can cause a delay in starting MPI applications. When this occurs the following warning will appear in the command output:

<pre style="overflow-x:auto;"> hfi_wait_for_device: The /dev/hfi1_0 device failed to appear after 15.0 seconds: Connection timed out

This issue affects RHEL and CentOS 7.3, and is resolved in RHEL / CentOS 7.4+ and the upstream project. Details can be found here:

https://bugzilla.redhat.com/show_bug.cgi?id=1408316

Prepare the run-time environment
 Create a user account from which to run the application, if a suitable account does not already exist. The account must be propagated across all of the Lustre client nodes that will participate in the benchmark, as well as the MDS servers for the file system. On the servers, it is recommended that the account is disabled in order to prevent users from logging into those machines. </li> Some MPI implementations rely upon passphrase-less SSH keys. Login as the benchmark user to one of the nodes and create a passphrase-less SSH key. This will enable the  command to launch processes on each of the client nodes that will run the benchmark. For example:

<pre style="overflow-x:auto;"> [mjcowe@ct7-c1 ~]$ ssh-keygen -t rsa -N "" -f $HOME/.ssh/id_rsa Generating public/private rsa key pair. Created directory '/home/mjcowe/.ssh'. Your identification has been saved in /home/mjcowe/.ssh/id_rsa. Your public key has been saved in /home/mjcowe/.ssh/id_rsa.pub. The key fingerprint is: e4:b1:10:a2:7f:e8:b1:74:f3:c3:24:76:46:3d:4d:91 mjcowe@ct7-c1 The key's randomart image is: +--[ RSA 2048]+ +-+ </li> Copy the public key into the  file for the account.</li> If the user account is not hosted on a shared file system (e.g. a Lustre filesystem), then copy the public and private keys that were generated into the  directory of each of the Lustre client nodes that will be used in the benchmark. Normally, user accounts are hosted on a shared resource, making this step unnecessary. </li> Consider relaxing the  SSH option so that host entries are automatically added into   rather than prompting the user to confirm the connection. When running MPI programs across many nodes, this can save a good deal of inconvenience. If the account home directory is not on a shared storage, all nodes will need to be updated. <pre style="overflow-x:auto;"> Host * StrictHostKeyChecking no </li> Install the MPI runtime onto all Lustre client nodes: <pre style="overflow-x:auto;"> yum install openmpi </li> Append the following lines to  (assuming BASH is the login shell) on the account running the benchmark: <pre style="overflow-x:auto"> module purge module load mpi/openmpi-x86_64 This ensures that the Open MPI library path and binary path are added to the user environment every time the user logs in (and every time  is invoked across multiple nodes). The  file is not read when   starts processes on remote nodes, which is why it is not chosen in this case. </li> </ol>
 * . .    oo   |
 * . . . . oE   |
 * .  . + o .    |
 * . . = o .    |
 * = * S       |
 * o * O        |
 * o  +        |

Benchmark Execution
 Login to one of the compute nodes as the benchmark user Create a host file for the  command, containing the list of Lustre clients that will be used for the benchmark. Each line in the file represents a machine and the number of slots (usually equal to the number of CPU cores). For example:

<pre style="overflow-x:auto"> for i in `seq -f "%03g" 1 32`; do echo "n"$i" slots=16" done > $HOME/hfile n001 slots=16 n002 slots=16 n003 slots=16 n004 slots=16 ... <ul> The first column of the host file contains the name of the nodes. This can also be an IP address if the  file or DNS is not set up. The second column is used to represent the number of CPU cores. </ul> </li> Run a quick test using  to launch the benchmark and verify that the environment is set up correctly. For example: <pre style="overflow-x:auto"> mpirun --hostfile $HOME/hfile --map-by node -np `cat $HOME/hfile|wc -l` hostname This should return the hostnames of all the machines that are in the test environment. The results are returned unsorted, in order of completion.
 * 1) Result:

Note: If the  does not work, and the output has only one or a very small number of unique hostnames repeated in the output, then set   for each host in the host file. Otherwise,  will fill up the slots on the first node before launching processes on subsequent nodes.

This may be desirable for multi-process tests but not for the single task per client test. Do not set the slot count higher than the number of cores present. If over-subscription is required, set the -np flag to greater than the number of physical cores. This informs OpenMPI that the task will be oversubscribed and will run in a mode that yields the processor to peers.

Refer to: OpenMPI FAQ -- Oversubscribing Nodes, and also the notes on OpenMPI at the end of this document. </li> Use  to launch the  benchmark. For example: <pre style="overflow-x:auto"> mpirun --hostfile $HOME/hfile -np 48 ./mdtest -n 20840 -i 10 -u -d /lustre/demo/mdtest-scratch In the above example, 48 processes will be distributed across the nodes listed in the host file, with each process creating 20,840 directories and files  for a total of 1,000,320 files/directories. The test will conduct 10 iterations and use   as the target base directory. The  flag tells the program to assign a unique working directory per task.

When first running the test on a new system, your test should be sized for 10,000 files/directories. This will give you an idea of how your system will handle the test. Gradually increase the number of files/directories as you feel more comfortable with the results you are seeing up to a maximum of 1,000,000 files/directory, or higher if there is a specific requirement in excess of this value. Note that 100,000 files/directories is probably the minimum value that will deliver a meaningful result (such that MDS cacheing does not affect results).

Start with a small number of threads and increase with each run using a doubling sequence starting at one (1, 2, 4, 8, 16), keeping the total number of files created as close to your target files/directories as possible. This means that as the thread count increases, the value of the  parameter should decrease. </li> </ol>

Notes on OpenMPI
When preparing the benchmark, pay careful attention to the distribution of processes across the nodes. will, by default, fill the slots of one node before allocating processes to the next node in the list. i.e. all of the slots on the first node in the file will be consumed before allocating processes to the second node, then third node, and so on. If the number of slots requested is lower than the overall number of slots in the host file, then utlisation will not be evenly distributed, and some nodes may not be used at all.

If the number of process is larger than the number of available slots,  will oversubscribe one or more nodes until all the processes have been launched. This can be exploited to create more even distribution of processes across nodes by setting the number of slots per host to 1. However, note that  will decide where the additional processes will run, which can lead to performance variance from run to run of a job.

The  option distributes processes evenly across the nodes, and does not try to consume all of the slots from one node before allocating processes to the next node in the list. For example, if there are 4 nodes, each with 16 slots (64 slots total), and a job is submitted that requires only 24 slots, then each node will be allocated 6 processes.

Experiment with the options by using the  command as the target application. For example: <pre style="overflow-x:auto"> [mduser@ct7-c1 ~]$ cat $HOME/hfile ct7-c1 slots=16 ct7-c2 slots=16 ct7-c3 slots=16 ct7-c4 slots=16

[mduser@ct7-c1 ~]$ mpirun --hostfile $HOME/hfile -np `cat $HOME/hfile|wc -l` hostname ct7-c1 ct7-c1 ct7-c1 ct7-c1
 * 1) By default, mpirun will fill slots on one node before allocating slots from the next:

[mduser@ct7-c1 ~]$ mpirun --hostfile $HOME/hfile --map-by node -np `cat $HOME/hfile|wc -l` hostname ct7-c2 ct7-c1 ct7-c3 ct7-c4
 * 1) The --map-by node option distributes the processes evenly:

The  parameter is the total number of threads. If the host file has 16 nodes but the value of is 1, then only one thread on one node is being used to complete the operations.

The  man page provides a comprehensive description of the available options.

See also the OpenMPI FAQ, and the section on oversubscription.