本页面介绍了如何使用 Compute Engine 客户端测试 Google Cloud Managed Lustre 实例的性能。它提供了有关如何使用 fio 衡量单客户端性能以及使用 IOR 基准测试工具衡量多客户端总体性能的说明。
衡量单客户端性能
如需测试单个 Compute Engine 客户端的读取和写入性能,请使用 fio(灵活的 I/O 测试工具)命令行工具。
安装 fio:
Rocky 8
sudo dnf install fio -yUbuntu 20.04 和 22.04
sudo apt update sudo install fio运行以下命令:
fio --ioengine=libaio --filesize=32G --ramp_time=2s \ --runtime=5m --numjobs=16 --direct=1 --verify=0 --randrepeat=0 \ --group_reporting --directory=/lustre --buffer_compress_percentage=50 \ --name=read --blocksize=1m --iodepth=64 --readwrite=read
测试大约需要 5 分钟才能完成。完成后,系统会显示结果。根据您的配置,您可以获得高达虚拟机的最大网络速度的吞吐量,以及每 TiB 数千 IOPS。
衡量多客户账号的表现
如需测试多个 Compute Engine 客户端的 Managed Lustre 读取和写入性能,请使用 IOR 基准测试工具。以下说明介绍了如何自动执行客户端设置,以及如何使用 IOR 测试来自多个客户端计算机的聚合 I/O。IOR 使用 MPI(一种消息传递协议)来使多个客户端机器能够相互协调。
在开始之前,请确保网络的 mtu 值已设置为 8896。
设置环境变量并生成 SSH 密钥
在部署集群之前,请在本地机器上生成 SSH 密钥。此密钥将在创建期间分发到客户端计算机,以实现 MPI 的无密码通信。
export SSH_USER="lustre-user"
export CLIENT_PREFIX="lustre-client"
# Generate an SSH key for the specified user
ssh-keygen -t rsa -b 4096 -C "${SSH_USER}" -N '' -f "./id_rsa"
chmod 600 "./id_rsa"
# Create a metadata file formatted for Google Cloud
echo "${SSH_USER}:$(cat "./id_rsa.pub") ${SSH_USER}" > "./keys.txt"
创建启动脚本
将以下内容保存到本地计算机上名为 install-ior.sh 的文件中。此脚本可检测操作系统、等待启动锁释放、安全地安装 Lustre 客户端和依赖项、编译稳定的 IOR 版本,并装载 Managed Lustre 文件系统。
将 LUSTRE_IP 替换为您的 Managed Lustre 实例的 IP 地址,并将 FS_NAME 替换为您的文件系统名称。
#!/bin/bash
source /etc/os-release
if [[ "$ID" == "ubuntu" ]]; then
# Ubuntu
# Wait for apt lock
while fuser /var/lib/dpkg/lock-frontend >/dev/null 2>&1; do sleep 5; done
# Configure Artifact Registry repo for Ubuntu
curl -fsSL https://us-apt.pkg.dev/doc/repo-signing-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/us-apt-pkg-dev.gpg
if [[ "$VERSION_ID" == "22.04" ]]; then
REPO_NAME="lustre-client-ubuntu-jammy"
elif [[ "$VERSION_ID" == "24.04" ]]; then
REPO_NAME="lustre-client-ubuntu-noble"
fi
echo "deb [signed-by=/usr/share/keyrings/us-apt-pkg-dev.gpg] https://us-apt.pkg.dev/projects/lustre-client-binaries $REPO_NAME main" | sudo tee /etc/apt/sources.list.d/lustre-client.list
sudo apt-get update
while ! sudo apt-get install -y lustre-client-modules-$(uname -r) lustre-client-utils openmpi-bin libopenmpi-dev make gcc g++ wget git automake autoconf libaio-dev; do
sleep 5
done
sudo modprobe lustre
else
# Red Hat / Rocky Linux
while systemctl is-active --quiet dnf-makecache.service; do sleep 5; done
if [[ "$ID" == "rocky" && "$VERSION_ID" == 8* ]]; then
REPO="lustre-client-rocky-8"
elif [[ "$ID" == "rocky" && "$VERSION_ID" == 9* ]]; then
REPO="lustre-client-rocky-9"
elif [[ "$ID" == "rhel" && "$VERSION_ID" == 9* ]]; then
REPO="lustre-client-rocky-9"
fi
gcloud beta artifacts print-settings yum --repository=$REPO --location=us --project=lustre-client-binaries | sudo bash
while ! sudo dnf -y --enablerepo=$REPO install kmod-lustre-client lustre-client; do sleep 5; done
sudo modprobe lustre
while ! sudo dnf install -y openmpi openmpi-devel make gcc gcc-c++ wget git automake autoconf libaio-devel; do sleep 5; done
export PATH=$PATH:/usr/lib64/openmpi/bin
fi
# Build IOR from source
echo "Cloning repo: https://github.com/hpc/ior.git and building IOR"
pushd /tmp
git clone -b 4.0.0 https://github.com/hpc/ior
cd ior
./bootstrap
./configure --disable-dependency-tracking --with-aio
make clean
make -j"$(nproc)"
sudo make install
popd
echo "Finished building IOR"
# Mount the Managed Lustre file system
mkdir -p /lustre
if ! grep -q "/lustre" /etc/fstab; then
echo "LUSTRE_IP@tcp:/FS_NAME /lustre lustre defaults,_netdev 0 0" >> /etc/fstab
fi
mount -a
部署客户端机器
运行以下命令以批量创建 Compute Engine 客户端机器。
gcloud compute instances bulk create \
--name-pattern="${CLIENT_PREFIX}-####" \
--zone="ZONE" \
--machine-type="MACHINE_TYPE" \
--scopes="https://www.googleapis.com/auth/cloud-platform" \
--network-interface=subnet=SUBNET,nic-type=GVNIC \
--network-performance-configs=total-egress-bandwidth-tier=TIER_1 \
--metadata-from-file=ssh-keys=./keys.txt,startup-script=install-ior.sh \
--create-disk=auto-delete=yes,boot=yes,\
image-family=IMAGE_FAMILY,\
image-project=IMAGE_PROJECT,\
mode=rw,size=100,type=DISK_TYPE \
--count NUM_NODES
将 ZONE 和 SUBNET 替换为您的具体部署值。
选择一个 MACHINE_TYPE。基准的整体性能取决于客户端机器类型。如需了解如何选择机器类型以获得最佳吞吐量,请参阅性能注意事项。
如果您的机器类型不支持 TIER_1 网络,请从命令中删除
--network-performance-configs行。将 DISK_TYPE 设置为
hyperdisk-balanced(对于世代名称中包含4的机器类型,例如c4a或n4)或pd-balanced。指定 IMAGE_FAMILY 和 IMAGE_PROJECT。 支持的值包括:
操作系统 映像系列 (x86)