Azure HPC Cache 데이터 수집 - 수동 복사 방법

이 문서에서는 Azure HPC Cache와 함께 사용하기 위해 Blob Storage 컨테이너에 데이터를 수동으로 복사하는 방법에 대한 자세한 지침을 제공합니다. 다중 스레드 병렬 작업을 사용하여 복사 속도를 최적화합니다.

Azure HPC Cache에 대한 Blob Storage로 데이터를 이동하는 방법에 대한 자세한 내용은 Azure Blob Storage로 데이터 이동을 읽어보세요.

간단한 복사 예제

미리 정의된 파일 또는 경로 집합에 대해 백그라운드에서 한 번에 둘 이상의 복사 명령을 실행하여 클라이언트에서 다중 스레드 복사본을 수동으로 만들 수 있습니다.

Linux/UNIX cp 명령에는 소유권 및 mtime 메타데이터를 유지하는 인수 -p 가 포함됩니다. 아래 명령에 이 인수를 추가하는 것은 선택 사항입니다. 인수를 추가하면 메타데이터 수정을 위해 클라이언트에서 대상 파일 시스템으로 전송되는 파일 시스템 호출 수가 증가합니다.

이 간단한 예제에서는 두 파일을 병렬로 복사합니다.

cp /mnt/source/file1 /mnt/destination1/ & cp /mnt/source/file2 /mnt/destination1/ &

이 명령을 jobs 실행한 후 명령은 두 개의 스레드가 실행 중임을 표시합니다.

예측 가능한 파일 이름을 사용하여 데이터 복사

파일 이름을 예측할 수 있는 경우 식을 사용하여 병렬 복사 스레드를 만들 수 있습니다.

예를 들어 디렉터리에 순차적으로 00011000번호가 매겨진 1000개의 파일이 포함된 경우 다음 식을 사용하여 각각 100개의 파일을 복사하는 10개의 병렬 스레드를 만들 수 있습니다.

cp /mnt/source/file0* /mnt/destination1/ & \
cp /mnt/source/file1* /mnt/destination1/ & \
cp /mnt/source/file2* /mnt/destination1/ & \
cp /mnt/source/file3* /mnt/destination1/ & \
cp /mnt/source/file4* /mnt/destination1/ & \
cp /mnt/source/file5* /mnt/destination1/ & \
cp /mnt/source/file6* /mnt/destination1/ & \
cp /mnt/source/file7* /mnt/destination1/ & \
cp /mnt/source/file8* /mnt/destination1/ & \
cp /mnt/source/file9* /mnt/destination1/

구조화되지 않은 파일 이름을 사용하여 데이터 복사

파일 명명 구조를 예측할 수 없는 경우 디렉터리 이름으로 파일을 그룹화할 수 있습니다.

이 예제에서는 백그라운드 작업으로 실행되는 명령에 보낼 cp 전체 디렉터리를 수집합니다.

/root
|-/dir1
| |-/dir1a
| |-/dir1b
| |-/dir1c
   |-/dir1c1
|-/dir1d

파일이 수집된 후 병렬 복사 명령을 실행하여 하위 디렉터리와 모든 콘텐츠를 재귀적으로 복사할 수 있습니다.

cp /mnt/source/* /mnt/destination/
mkdir -p /mnt/destination/dir1 && cp /mnt/source/dir1/* mnt/destination/dir1/ &
cp -R /mnt/source/dir1/dir1a /mnt/destination/dir1/ &
cp -R /mnt/source/dir1/dir1b /mnt/destination/dir1/ &
cp -R /mnt/source/dir1/dir1c /mnt/destination/dir1/ & # this command copies dir1c1 via recursion
cp -R /mnt/source/dir1/dir1d /mnt/destination/dir1/ &

탑재 지점을 추가하는 경우

단일 대상 파일 시스템 탑재 지점에 대해 충분한 병렬 스레드가 있으면 스레드를 더 추가해도 처리량이 늘어나지 않는 지점이 있습니다. (처리량은 데이터 형식에 따라 파일/초 또는 바이트/초로 측정됩니다.) 또는 설상가상으로, 오버 스레딩은 때때로 처리량 저하를 일으킬 수 있습니다.

이 경우 동일한 원격 파일 시스템 탑재 경로를 사용하여 클라이언트 쪽 탑재 지점을 다른 Azure HPC Cache 탑재 주소에 추가할 수 있습니다.

10.1.0.100:/nfs on /mnt/sourcetype nfs (rw,vers=3,proto=tcp,addr=10.1.0.100)
10.1.1.101:/nfs on /mnt/destination1type nfs (rw,vers=3,proto=tcp,addr=10.1.1.101)
10.1.1.102:/nfs on /mnt/destination2type nfs (rw,vers=3,proto=tcp,addr=10.1.1.102)
10.1.1.103:/nfs on /mnt/destination3type nfs (rw,vers=3,proto=tcp,addr=10.1.1.103)

클라이언트 측 탑재 지점을 추가하면 추가 탑재 지점으로 복제 명령을 분할하여 /mnt/destination[1-3] 병렬 처리를 더욱 향상시킬 수 있습니다.

예를 들어 파일이 매우 큰 경우 복사 명령을 정의하여 고유한 대상 경로를 사용하여 복사를 수행하는 클라이언트와 병렬로 더 많은 명령을 보낼 수 있습니다.

cp /mnt/source/file0* /mnt/destination1/ & \
cp /mnt/source/file1* /mnt/destination2/ & \
cp /mnt/source/file2* /mnt/destination3/ & \
cp /mnt/source/file3* /mnt/destination1/ & \
cp /mnt/source/file4* /mnt/destination2/ & \
cp /mnt/source/file5* /mnt/destination3/ & \
cp /mnt/source/file6* /mnt/destination1/ & \
cp /mnt/source/file7* /mnt/destination2/ & \
cp /mnt/source/file8* /mnt/destination3/ & \

위의 예제에서 세 대상 탑재 지점은 모두 클라이언트 파일 복사 프로세스의 대상이 되고 있습니다.

클라이언트를 추가하는 경우

마지막으로 클라이언트의 기능에 도달하면 더 많은 복사 스레드 또는 추가 탑재 지점을 추가해도 추가 파일/초 또는 바이트/초 증가가 발생하지 않습니다. 이 경우 자체 파일 복사 프로세스 집합을 실행하는 동일한 탑재 지점 집합을 사용하여 다른 클라이언트를 배포할 수 있습니다.

Example:

Client1: cp -R /mnt/source/dir1/dir1a /mnt/destination/dir1/ &
Client1: cp -R /mnt/source/dir2/dir2a /mnt/destination/dir2/ &
Client1: cp -R /mnt/source/dir3/dir3a /mnt/destination/dir3/ &

Client2: cp -R /mnt/source/dir1/dir1b /mnt/destination/dir1/ &
Client2: cp -R /mnt/source/dir2/dir2b /mnt/destination/dir2/ &
Client2: cp -R /mnt/source/dir3/dir3b /mnt/destination/dir3/ &

Client3: cp -R /mnt/source/dir1/dir1c /mnt/destination/dir1/ &
Client3: cp -R /mnt/source/dir2/dir2c /mnt/destination/dir2/ &
Client3: cp -R /mnt/source/dir3/dir3c /mnt/destination/dir3/ &

Client4: cp -R /mnt/source/dir1/dir1d /mnt/destination/dir1/ &
Client4: cp -R /mnt/source/dir2/dir2d /mnt/destination/dir2/ &
Client4: cp -R /mnt/source/dir3/dir3d /mnt/destination/dir3/ &

파일 매니페스트 만들기

위의 접근 방식(대상당 여러 복사 스레드, 클라이언트당 여러 대상, 네트워크에 액세스할 수 있는 원본 파일 시스템당 여러 클라이언트)을 이해한 후 다음 권장 사항을 고려합니다. 파일 매니페스트를 빌드한 다음 여러 클라이언트에서 복사 명령과 함께 사용합니다.

이 시나리오에서는 UNIX find 명령을 사용하여 파일 또는 디렉터리 매니페스트를 만듭니다.

user@build:/mnt/source > find . -mindepth 4 -maxdepth 4 -type d
./atj5b55c53be6-01/support/gsi/2018-07-22T21:12:06EDT
./atj5b55c53be6-01/support/pcap/2018-07-23T01:34:57UTC
./atj5b55c53be6-01/support/trace/rolling
./atj5b55c53be6-03/support/gsi/2018-07-22T21:12:06EDT
./atj5b55c53be6-03/support/pcap/2018-07-23T01:34:57UTC
./atj5b55c53be6-03/support/trace/rolling
./atj5b55c53be6-02/support/gsi/2018-07-22T21:12:06EDT
./atj5b55c53be6-02/support/pcap/2018-07-23T01:34:57UTC
./atj5b55c53be6-02/support/trace/rolling

이 결과를 파일로 리디렉션합니다. find . -mindepth 4 -maxdepth 4 -type d > /tmp/foo

그런 다음 BASH 명령을 사용하여 매니페스트를 반복하여 파일 수를 계산하고 하위 디렉터리의 크기를 확인할 수 있습니다.

ben@xlcycl1:/sps/internal/atj5b5ab44b7f > for i in $(cat /tmp/foo); do echo " `find ${i} |wc -l` `du -sh ${i}`"; done
244    3.5M    ./atj5b5ab44b7f-02/support/gsi/2018-07-18T00:07:03EDT
9      172K    ./atj5b5ab44b7f-02/support/gsi/stats_2018-07-18T05:01:00UTC
124    5.8M    ./atj5b5ab44b7f-02/support/gsi/stats_2018-07-19T01:01:01UTC
152    15M     ./atj5b5ab44b7f-02/support/gsi/stats_2018-07-20T01:01:00UTC
131    13M     ./atj5b5ab44b7f-02/support/gsi/stats_2018-07-20T21:59:41UTC_partial
789    6.2M    ./atj5b5ab44b7f-02/support/gsi/2018-07-20T21:59:41UTC
134    12M     ./atj5b5ab44b7f-02/support/gsi/stats_2018-07-20T22:22:55UTC_hpccache_catchup
7      16K     ./atj5b5ab44b7f-02/support/pcap/2018-07-18T17:12:19UTC
8      83K     ./atj5b5ab44b7f-02/support/pcap/2018-07-18T17:17:17UTC
575    7.7M    ./atj5b5ab44b7f-02/support/cores/armada_main.2000.1531980253.gsi
33     4.4G    ./atj5b5ab44b7f-02/support/trace/rolling
281    6.6M    ./atj5b5ab44b7f-01/support/gsi/2018-07-18T00:07:03EDT
15     182K    ./atj5b5ab44b7f-01/support/gsi/stats_2018-07-18T05:01:00UTC
244    17M     ./atj5b5ab44b7f-01/support/gsi/stats_2018-07-19T01:01:01UTC
299    31M     ./atj5b5ab44b7f-01/support/gsi/stats_2018-07-20T01:01:00UTC
256    29M     ./atj5b5ab44b7f-01/support/gsi/stats_2018-07-20T21:59:41UTC_partial
889    7.7M    ./atj5b5ab44b7f-01/support/gsi/2018-07-20T21:59:41UTC
262    29M     ./atj5b5ab44b7f-01/support/gsi/stats_2018-07-20T22:22:55UTC_hpccache_catchup
11     248K    ./atj5b5ab44b7f-01/support/pcap/2018-07-18T17:12:19UTC
11     88K     ./atj5b5ab44b7f-01/support/pcap/2018-07-18T17:17:17UTC
645    11M     ./atj5b5ab44b7f-01/support/cores/armada_main.2019.1531980253.gsi
33     4.0G    ./atj5b5ab44b7f-01/support/trace/rolling
244    2.1M    ./atj5b5ab44b7f-03/support/gsi/2018-07-18T00:07:03EDT
9      158K    ./atj5b5ab44b7f-03/support/gsi/stats_2018-07-18T05:01:00UTC
124    5.3M    ./atj5b5ab44b7f-03/support/gsi/stats_2018-07-19T01:01:01UTC
152    15M     ./atj5b5ab44b7f-03/support/gsi/stats_2018-07-20T01:01:00UTC
131    12M     ./atj5b5ab44b7f-03/support/gsi/stats_2018-07-20T21:59:41UTC_partial
789    8.4M    ./atj5b5ab44b7f-03/support/gsi/2018-07-20T21:59:41UTC
134    14M     ./atj5b5ab44b7f-03/support/gsi/stats_2018-07-20T22:25:58UTC_hpccache_catchup
7      159K    ./atj5b5ab44b7f-03/support/pcap/2018-07-18T17:12:19UTC
7      157K    ./atj5b5ab44b7f-03/support/pcap/2018-07-18T17:17:17UTC
576    12M     ./atj5b5ab44b7f-03/support/cores/armada_main.2013.1531980253.gsi
33     2.8G    ./atj5b5ab44b7f-03/support/trace/rolling

마지막으로 클라이언트에 실제 파일 복사 명령을 작성해야 합니다.

4개의 클라이언트가 있는 경우 다음 명령을 사용합니다.

for i in 1 2 3 4 ; do sed -n ${i}~4p /tmp/foo > /tmp/client${i}; done

5개의 클라이언트가 있는 경우 다음과 같이 사용합니다.

for i in 1 2 3 4 5; do sed -n ${i}~5p /tmp/foo > /tmp/client${i}; done

그리고 여섯 .... 필요에 따라 추정합니다.

for i in 1 2 3 4 5 6; do sed -n ${i}~6p /tmp/foo > /tmp/client${i}; done

N개의 결과 파일을 얻으며, 이는 N개의 클라이언트 각각에 대해 제공됩니다. 이러한 파일은 명령 find의 출력의 일부로 얻은 수준 4 디렉터리의 경로 이름을 포함하고 있습니다.

각 파일을 사용하여 복사 명령을 빌드합니다.

for i in 1 2 3 4 5 6; do for j in $(cat /tmp/client${i}); do echo "cp -p -R /mnt/source/${j} /mnt/destination/${j}" >> /tmp/client${i}_copy_commands ; done; done

위의 내용은 클라이언트에서 BASH 스크립트로 실행할 수 있는 줄당 복사 명령이 있는 N 파일을 제공합니다.

목표는 여러 클라이언트에서 동시에 클라이언트당 이러한 스크립트의 여러 스레드를 동시에 실행하는 것입니다.