이 페이지 개선에 도움 주기
이 사용자 가이드에 기여하려면 모든 페이지의 오른쪽 창에 있는 GitHub에서 이 페이지 편집 링크를 선택합니다.
노드에서 Amazon FSx for Lustre 성능 최적화(비 EFA)
시작 템플릿 사용자 데이터를 사용한 노드 초기화 중에 튜닝 파라미터를 적용하여 Amazon FSx for Lustre 성능을 최적화할 수 있습니다.
참고
-
FSx for Lustre CSI 드라이버 생성 및 배포에 대한 자세한 내용은 FSx for Lustre CSI 드라이버 배포 섹션을 참조하세요.
-
EFA 지원 노드를 사용하여 성능을 최적화하려면 노드에서 Amazon FSx for Lustre 성능 최적화(EFA) 섹션을 참조하세요.
시작 템플릿 사용자 데이터를 사용하는 이유는 무엇인가요?
-
노드 초기화 중에 튜닝을 자동으로 적용합니다.
-
모든 노드에서 일관된 구성을 보장합니다.
-
수동 노드 구성이 필요하지 않습니다.
예제 스크립트 개요
이 주제에 정의된 예제 스크립트는 다음 작업을 수행합니다.
# 1. Install Lustre client
-
Amazon Linux(AL) OS 버전을 자동으로 감지합니다.
-
적절한 Lustre 클라이언트 패키지를 설치합니다.
# 2. Apply network and RPC tunings
-
병렬 RPC 처리를 위해
ptlrpcd_per_cpt_max=64를 설정합니다. -
네트워크 버퍼를 최적화하도록
ksocklnd credits=2560을 구성합니다.
# 3. Load Lustre modules
-
기존 Lustre 모듈을 안전하게 제거합니다(있는 경우).
-
기존 파일 시스템의 탑재 해제를 처리합니다.
-
새 Lustre 모듈을 로드합니다.
# 4. Lustre Network Initialization
-
Lustre 네트워킹 구성을 초기화합니다.
-
필요한 네트워크 파라미터를 설정합니다.
# 5. Mount FSx filesystem
-
이 섹션에서는 환경의 값을 조정해야 합니다.
# 6. Apply tunings
-
LRU(리소스 잠금 단위) 튜닝:
-
lru_max_age=600000 -
CPU 수를 기준으로 계산된
lru_size
-
-
클라이언트 캐시 제어:
max_cached_mb=64 -
RPC 제어:
-
OST
max_rpcs_in_flight=32 -
MDC
max_rpcs_in_flight=64 -
MDC
max_mod_rpcs_in_flight=50
-
# 7. Verify tunings
-
적용된 튜닝을 모두 확인합니다.
-
각 파라미터에 대해 성공 또는 경고를 보고합니다.
# 8. Setup persistence
-
이 섹션에서도 환경의 값을 조정해야 합니다.
-
OS 버전(AL2023)을 자동으로 감지하여 적용할
Systemd서비스를 결정합니다. -
시스템을 시작합니다.
-
Systemd가lustre-tunings서비스를 시작합니다(WantedBy=multi-user.target때문). -
서비스는 다음 작업을 수행하는
apply_lustre_tunings.sh를 실행합니다.-
파일 시스템이 탑재되었는지 확인합니다.
-
탑재되지 않은 경우 파일 시스템을 탑재합니다.
-
탑재가 성공할 때까지 기다립니다(최대 5분).
-
탑재 성공 후 튜닝 파라미터를 적용합니다.
-
-
설정은 재부팅할 때까지 활성 상태로 유지됩니다.
-
스크립트 완료 후 서비스가 종료됩니다.
-
Systemd는 서비스를 ‘활성(종료됨)’으로 표시합니다.
-
-
다음 재부팅 시 프로세스가 반복됩니다.
시작 템플릿 생성
-
https://console.aws.amazon.com/ec2/에서 Amazon EC2 콘솔을 엽니다.
-
시작 템플릿을 선택합니다.
-
Create launch template(시작 템플릿 생성)을 선택합니다.
-
고급 세부 정보에서 사용자 데이터 섹션을 찾습니다.
-
아래 스크립트를 붙여넣고 필요한 항목을 업데이트합니다.
중요
# 5. Mount FSx filesystem섹션에서 그리고# 8. Setup persistence섹션 내apply_lustre_tunings.sh의setup_persistence()함수에서 다음 값을 환경에 맞게 조정합니다.FSX_DNS="<your-fsx-filesystem-dns>" # Needs to be adjusted. MOUNT_NAME="<your-mount-name>" # Needs to be adjusted. MOUNT_POINT="</your/mount/point>" # Needs to be adjusted.MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="==MYBOUNDARY==" --==MYBOUNDARY== Content-Type: text/x-shellscript; charset="us-ascii" #!/bin/bash exec 1> >(logger -s -t $(basename $0)) 2>&1 # Function definitions check_success() { if [ $? -eq 0 ]; then echo "SUCCESS: $1" else echo "FAILED: $1" return 1 fi } apply_tunings() { local NUM_CPUS=$(nproc) local LRU_SIZE=$((100 * NUM_CPUS)) local params=( "ldlm.namespaces.*.lru_max_age=600000" "ldlm.namespaces.*.lru_size=$LRU_SIZE" "llite.*.max_cached_mb=64" "osc.*OST*.max_rpcs_in_flight=32" "mdc.*.max_rpcs_in_flight=64" "mdc.*.max_mod_rpcs_in_flight=50" ) for param in "${params[@]}"; do lctl set_param $param check_success "Set ${param%%=*}" done } verify_param() { local param=$1 local expected=$2 local actual=$3 if [ "$actual" == "$expected" ]; then echo "SUCCESS: $param is correctly set to $expected" else echo "WARNING: $param is set to $actual (expected $expected)" fi } verify_tunings() { local NUM_CPUS=$(nproc) local LRU_SIZE=$((100 * NUM_CPUS)) local params=( "ldlm.namespaces.*.lru_max_age:600000" "ldlm.namespaces.*.lru_size:$LRU_SIZE" "llite.*.max_cached_mb:64" "osc.*OST*.max_rpcs_in_flight:32" "mdc.*.max_rpcs_in_flight:64" "mdc.*.max_mod_rpcs_in_flight:50" ) echo "Verifying all parameters:" for param in "${params[@]}"; do name="${param%%:*}" expected="${param#*:}" actual=$(lctl get_param -n $name | head -1) verify_param "${name##*.}" "$expected" "$actual" done } setup_persistence() { # Create functions file cat << 'EOF' > /usr/local/bin/lustre_functions.sh #!/bin/bash apply_lustre_tunings() { local NUM_CPUS=$(nproc) local LRU_SIZE=$((100 * NUM_CPUS)) echo "Applying Lustre performance tunings..." lctl set_param ldlm.namespaces.*.lru_max_age=600000 lctl set_param ldlm.namespaces.*.lru_size=$LRU_SIZE lctl set_param llite.*.max_cached_mb=64 lctl set_param osc.*OST*.max_rpcs_in_flight=32 lctl set_param mdc.*.max_rpcs_in_flight=64 lctl set_param mdc.*.max_mod_rpcs_in_flight=50 } EOF # Create tuning script cat << 'EOF' > /usr/local/bin/apply_lustre_tunings.sh #!/bin/bash exec 1> >(logger -s -t $(basename $0)) 2>&1 # Source the functions source /usr/local/bin/lustre_functions.sh # FSx details FSX_DNS="<your-fsx-filesystem-dns>" # Needs to be adjusted. MOUNT_NAME="<your-mount-name>" # Needs to be adjusted. MOUNT_POINT="</your/mount/point>" # Needs to be adjusted. # Function to check if Lustre is mounted is_lustre_mounted() { mount | grep -q "type lustre" } # Function to mount Lustre mount_lustre() { echo "Mounting Lustre filesystem..." mkdir -p ${MOUNT_POINT} mount -t lustre ${FSX_DNS}@tcp:/${MOUNT_NAME} ${MOUNT_POINT} return $? } # Main execution # Try to mount if not already mounted if ! is_lustre_mounted; then echo "Lustre filesystem not mounted, attempting to mount..." mount_lustre fi # Wait for successful mount (up to 5 minutes) for i in {1..30}; do if is_lustre_mounted; then echo "Lustre filesystem mounted, applying tunings..." apply_lustre_tunings exit 0 fi echo "Waiting for Lustre filesystem to be mounted... (attempt $i/30)" sleep 10 done echo "Timeout waiting for Lustre filesystem mount" exit 1 EOF # Create systemd service cat << 'EOF' > /etc/systemd/system/lustre-tunings.service [Unit] Description=Apply Lustre Performance Tunings After=network.target remote-fs.target StartLimitIntervalSec=0 [Service] Type=oneshot ExecStart=/usr/local/bin/apply_lustre_tunings.sh RemainAfterExit=yes Restart=on-failure RestartSec=30 [Install] WantedBy=multi-user.target EOF chmod +x /usr/local/bin/lustre_functions.sh chmod +x /usr/local/bin/apply_lustre_tunings.sh systemctl enable lustre-tunings.service systemctl start lustre-tunings.service } echo "Starting FSx for Lustre configuration..." # 1. Install Lustre client if grep -q 'VERSION="2"' /etc/os-release; then amazon-linux-extras install -y lustre elif grep -q 'VERSION="2023"' /etc/os-release; then dnf install -y lustre-client fi check_success "Install Lustre client" # 2. Apply network and RPC tunings export PATH=$PATH:/usr/sbin echo "Applying network and RPC tunings..." if ! grep -q "options ptlrpc ptlrpcd_per_cpt_max" /etc/modprobe.d/modprobe.conf; then echo "options ptlrpc ptlrpcd_per_cpt_max=64" | tee -a /etc/modprobe.d/modprobe.conf echo "options ksocklnd credits=2560" | tee -a /etc/modprobe.d/modprobe.conf fi # 3. Load Lustre modules modprobe lustre check_success "Load Lustre modules" || exit 1 # 4. Lustre Network Initialization lctl network up check_success "Initialize Lustre networking" || exit 1 # 5. Mount FSx filesystem FSX_DNS="<your-fsx-filesystem-dns>" # Needs to be adjusted. MOUNT_NAME="<your-mount-name>" # Needs to be adjusted. MOUNT_POINT="</your/mount/point>" # Needs to be adjusted. if [ ! -z "$FSX_DNS" ] && [ ! -z "$MOUNT_NAME" ]; then mkdir -p $MOUNT_POINT mount -t lustre ${FSX_DNS}@tcp:/${MOUNT_NAME} ${MOUNT_POINT} check_success "Mount FSx filesystem" fi # 6. Apply tunings apply_tunings # 7. Verify tunings verify_tunings # 8. Setup persistence setup_persistence echo "FSx for Lustre configuration completed." --==MYBOUNDARY==-- -
Amazon EKS 노드 그룹을 생성할 때 이 시작 템플릿을 선택합니다. 자세한 내용은 클러스터에 대한 관리형 노드 그룹 생성 섹션을 참조하세요.