본문 바로가기

리눅스

dd 명령어로 사용자 체감 속도 기준 디스크 성능 테스트하기

반응형

dd 명령어로 사용자 체감 속도 기준 디스크 성능 테스트하기

리눅스 서버에서 저장장치 성능을 간단히 확인할 때 가장 많이 사용하는 도구 중 하나가 dd 명령어입니다.

하지만 많은 경우 측정값이 실제 체감 속도와 다르게 보일 수 있습니다. 이유는 운영체제(OS)의 페이지 캐시(Page Cache) 와 버퍼(Buffer Cache) 가 개입하기 때문입니다.

즉, 사용자가 파일을 복사하거나 서비스를 운영하면서 느끼는 속도는 순수 디스크 성능 + OS 캐시 효과가 반영된 체감 성능입니다.

1. 사용자 체감 쓰기 성능 테스트 (Write)

애플리케이션이 데이터를 저장할 때 OS는 먼저 메모리에 기록한 뒤 빠르게 응답합니다.

하지만 실제 디스크 반영 시간까지 포함하려면 fdatasync 옵션을 사용하는 것이 좋습니다.

dd if=/dev/zero of=~/speed_test_file bs=1M count=2048 conv=fdatasync status=progress

옵션 설명

  • if=/dev/zero : 0으로 채워진 데이터 생성
  • of=파일명 : 출력 파일
  • bs=1M : 블록 크기
  • 1MB count=2048 : 총 2GB 생성
  • conv=fdatasync : 종료 전 디스크 동기화
  • status=progress : 진행률 표시

2. 사용자 체감 읽기 성능 테스트 (Read)

읽기 성능은 두 가지로 나눠야 정확합니다.

A. 처음 읽는 속도 (Cold Read)

파일이 메모리에 없는 상태에서 읽는 성능입니다.

# 먼저 캐시를 비웁니다 (관리자 권한 필요)
sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"

# 읽기 테스트
dd if=~/speed_test_file of=/dev/null bs=1M status=progress

B. 다시 읽는 속도 (Hot Read)

이미 한 번 읽어서 RAM 캐시에 올라간 상태입니다.

# 캐시를 비우지 않고 곧바로 다시 읽기
dd if=~/speed_test_file of=/dev/null bs=1M status=progress
  • 결과 해석: 보통 GB/s 단위의 압도적인 속도가 나옵니다. 실제 운영 환경에서 반복적으로 접근하는 데이터의 속도라고 보시면 됩니다.

3. 정확한 테스트 팁

테스트 파일 크기

RAM보다 너무 작은 파일은 전부 캐시되므로 현실성이 떨어집니다.

 

권장

  • RAM 16GB → 테스트 파일
  • 8GB RAM 32GB → 테스트 파일 16GB

즉 메모리의 절반 정도 크기가 적절합니다.

테스트 후 파일 삭제

rm -f ~/speed_test_file
728x90

4. 실제 물리 디스크 성능 측정 (Direct I/O)

캐시 영향을 제거하고 디스크 자체 성능만 확인하려면 Direct I/O를 사용합니다.

 

물리 쓰기 성능(Write) 측정

dd if=/dev/zero of=/tmp/testfile bs=1G count=1 oflag=direct

물리 읽기 성능(Read) 측정

sync; echo 3 | sudo tee /proc/sys/vm/drop_caches
dd if=/tmp/testfile of=/dev/null bs=1G count=1 iflag=direct

서버별 성능 비교표

동일 샤시 : ProLiant DL360 Gen9

항목 서버 1 서버 2 서버 3
컨트롤러 Smart HBA H240ar Smart Array P440ar Smart HBA H240ar
디스크 SAS HDD SAS HDD SATA SSD
쓰기 (Write) 142 MB/s 446 MB/s 446 MB/s
읽기 (Cold) 175 MB/s 406 MB/s 845 MB/s
읽기 (Hot) 4.4 GB/s 4.4 GB/s 7.6 GB/s

테스트 명령어

# 체감 쓰기
dd if=/dev/zero of=~/speed_test_file bs=1M count=2048 conv=fdatasync

# 실제 읽기
sync; echo 3 > /proc/sys/vm/drop_caches
dd if=~/speed_test_file of=/dev/null bs=1M

# 캐시 읽기
dd if=~/speed_test_file of=/dev/null bs=1M
더보기

---

서버 1

$ dmidecode -t system | grep "Product Name"
	Product Name: ProLiant DL360 Gen9

$ ssacli ctrl all show config

Smart HBA H240ar in Slot 0 (Embedded) (RAID Mode)  (sn: --)

$ dd if=/dev/zero of=~/speed_test_file bs=1M count=2048 conv=fdatasync status=progress
2080374784 bytes (2.1 GB, 1.9 GiB) copied, 1 s, 2.1 GB/s
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 15.0991 s, 142 MB/s

$ sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
$ dd if=~/speed_test_file of=/dev/null bs=1M status=progress
2085617664 bytes (2.1 GB, 1.9 GiB) copied, 12 s, 174 MB/s
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 12.2839 s, 175 MB/s

$ dd if=~/speed_test_file of=/dev/null bs=1M status=progress
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 0.486127 s, 4.4 GB/s

서버 2

$ dmidecode -t system | grep "Product Name"
	Product Name: ProLiant DL360 Gen9

$ ssacli ctrl all show config

Smart Array P440ar in Slot 0 (Embedded)   (sn: --)

$ dd if=/dev/zero of=~/speed_test_file bs=1M count=2048 conv=fdatasync status=progress
2043674624 bytes (2.0 GB, 1.9 GiB) copied, 1 s, 2.0 GB/s
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 4.81932 s, 446 MB/s

$ sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
$ dd if=~/speed_test_file of=/dev/null bs=1M status=progress
1699741696 bytes (1.7 GB, 1.6 GiB) copied, 5 s, 340 MB/s
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 5.28722 s, 406 MB/s

$ dd if=~/speed_test_file of=/dev/null bs=1M status=progress
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 0.489472 s, 4.4 GB/s

서버 3

$ dmidecode -t system | grep "Product Name"
	Product Name: ProLiant DL360 Gen9

$ ssacli ctrl all show config

Smart HBA H240ar in Slot 0 (Embedded) (RAID Mode)  (sn: --)

$ dd if=/dev/zero of=~/speed_test_file bs=1M count=2048 conv=fdatasync status=progress
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 4.81845 s, 446 MB/s

$ sudo sh -c "sync; echo 3 > /proc/sys/vm/drop_caches"
$ dd if=~/speed_test_file of=/dev/null bs=1M status=progress
1685061632 bytes (1.7 GB, 1.6 GiB) copied, 2 s, 842 MB/s
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 2.54195 s, 845 MB/s

$ dd if=~/speed_test_file of=/dev/null bs=1M status=progress
2048+0 records in
2048+0 records out
2147483648 bytes (2.1 GB, 2.0 GiB) copied, 0.280739 s, 7.6 GB/s

---

dd 테스트 결과가 GB/s 로 나온다고 해서 디스크가 그 속도인 것은 아닙니다.

대부분은 OS 메모리 캐시 속도이며 이것 또한 실제 사용자 체감 속도에는 매우 중요합니다.

 

728x90
반응형