오늘은 VMFS Datastore의 동기화 처리를 위한 Locking Mechanism인 ATS에 대해서 알아보도록 하겠습니다.
ATS는 Atomic Test & Set의 약자로 VAAI(VMware vSphere® Storage APIs – Array Integration)에서 지원하는 기능 중 하나
ATS는 여러 ESXi Host가 동시에 접근 가능한 Clustered Filesystem인 VMFS의 Locking을 구현하는 기능으로 사용
예전에는 SCSI Reservation을 이용했으나, SCSI Reservation의 경우에는 전체 LUN에 Lock을 걸기 때문에 Contention Issue가 발생할 가능성이 높았기 때문에 ATS로 변경
ATS는 전체 LUN에 Lock을 걸지 않고 Sector 하나만 이용하기 때문에 Contention Issue가 발생할 가능성이 현저히 낮아짐
ATS는 SCSI T-10 표준으로 OpCode는 0x89를 사용하며 Locking 을 위해 Compare and Write 방식을 사용
ATS Locking Mechanism을 사용하는 경우,
- 특정 VMFS 에 on-disk lock을 획득하려고 하면
- Lock record를 Write 하려고 하는 block address를 읽어서
- Lock이 Free 상태이면, 해당 위치에 Lock record를 Write 하고,
- 만약 다른 Host가 이미 Lock을 획득하여 실패하는 경우 다시 시도
ATS 지원 여부 확인
아래 결과에서 VAAI ATS status가 1이면 Supported를 의미
# vsish -e get /storage/scsifw/devices/naa.60060160c0304e00b878416457b6d9a2/info Device information { owning plugin :NMP state : 0 -> on APD reason : 1 -> none device type : 0 -> Direct-Access partition table type : 2 -> gpt vendor :DGC model :VRAID revision :5003 capacity:info { logical block size :512 num of logical blocks :1048576000 physical block size :512 first aligned LBA over PBA :0 } Device Format: 1 -> 512n Max Transfer Number of blocks:32768 SCSI version:0x06 DevFS registration type: 1 -> Disk devfs registration is pseudo-device?:0 is device reserved?:0 is device removable?:0 is device local?:0 is device SSD?:0 is device NVME?:0 is LUN queue depth being throttled?:0 is Protocol Endpoint?:0 is Emulated DIF/DIX Enabled?:0 format progress %:4294967295 format result: 0 -> unknown Thin provisioning status: 1 -> yes device availability: 3 -> redundant availability # pending reservations:0 current open count:1 current schedQ count:112 VAAI clone status: 1 -> supported VAAI zero status: 1 -> supported VAAI delete status: 1 -> supported VAAI ATS status: 1 -> supported ### <-- PI:Protection info { Is protection enabled on this device:0 Is PI supported by the device:0 Is PI activated for the device:0 Protection Type:0 Protection Mask:0x00000000 Supported Guard: 0 -> NO GUARD SUPPORT Is DIX Enabled:0 DIX Guard: 0 -> NO GUARD SUPPORT } vsi SNRO:32 Ignore inquiry Cache?:0 pci vendor id:0 pci sub vendor id:0 is WEAR reservation supported?:0 VMFS header offset:0 is NVME multi namespace capable?:0 Number of NVME namespace configured:0 } |
VMFS가 지원하는 두 가지 Locking Mechanism
# esxcli storage vmfs lockmode list
- ATS Only
- VAAI를 지원하는 Storage 상에 생성된 VMFS는 기본적으로 ATS Only를 사용
- SCSI Reservation은 사용되지 않음
- ATS+SCSI
- VMFS는 ATS를 사용하는데, 만약 ATS 사용에 실패하는 경우 SCSI Reservation을 사용
How to turn off ATS
https://kb.vmware.com/s/article/2146451
- Disabling ATS Usage per ESXi host level
- esxcli system settings advanced set --int-value 0 --option /VMFS3/HardwareAcceleratedLocking
- Disabling ATS usage per VMFS datastore
- vmkfstools --configATSOnly 0 /vmfs/volumes/VMFS-volume-name
- esxcli storage vmfs lockmode set -s|--scsi -l|--volume-label= VMFS label -u|--volume-uuid= VMFS UUID
- Disabling ATS Usage only for VMFS heartbeats
- esxcli system settings advanced set -i 0 -o /VMFS3/UseATSForHBOnVMFS5
ATS Heartbeat Mechanism
https://kb.vmware.com/s/article/2136081
- The VMFS datastores are monitored through the heartbeats that are issued in the form of write operations approximately once in every 3 seconds to the VMFS volumes from the hosts.
- Each ESXi host accessing the VMFS datastores expects these heartbeat write I/O operations to complete within a 8 second window.
- If the heartbeat I/O does not complete within an 8 second window, the I/O is timed out and a subsequent heartbeat I/O is issued.
- If the total time of the heartbeat I/O does not complete within a 16 second window, the datastore is marked offline and a Lost access to volume log message is generated by hostd to reflect this behavior.
- After a VMFS datastore is marked in an offline state, ESXi issues heartbeat I/O to the datastore approximately every 1 second until connectivity is restored.
- If a heartbeat I/O completes, the datastore is marked back online and host I/O is allowed to continue.
Lock Contention
https://ikb.vmware.com/s/article/2040826
https://kb.vmware.com/s/article/2052862
vmkernel.log에 기록되는 아래 메시지 해석 방법
2012-11-13T13:01:11.753Z cpu7:760526)DLX: 3394: vol 'datastore1': [Req mode 2] Checking liveness of [type 10c00001 offset 88803328 v 16759, hb offset 3170304
gen 145, mode 1, owner 50826751-a15b82c0-437a-a4badb0d8125 mtime 478553 nHld 0 nOvf 0]
Message | Meaning |
760526 | 프로세스 ID |
vol 'datastore1' | 데이터스토어 이름 |
[Req mode 2] | 요청하는 Lock Mode 종류 |
Checking liveness | 다른 Host가 Lock을 소유하고 있는지 확인한다는 의미 |
type 10c00001 | Lock을 획득한 후 수정하려는 Datastore의 Object 종류 |
offset 88803328 | Disk에 위치한 Lock Offset |
hb offset 3170304 | Lock을 관리하는 Heartbeat Offset |
mode 1 | 현재 Lock Mode 종류 |
50826751-a15b82c0-437a-a4badb0d8125 | Lock Owner Node의 UUID |
[참고 자료]
VMware vSphere APIs: Array Integration (VAAI)
https://core.vmware.com/resource/vmware-vsphere-apis-array-integration-vaai
'Storage' 카테고리의 다른 글
How APD(All-Path Down) Works (4) | 2023.06.08 |
---|---|
vSAN Objects(vDisk, Home Namespace and etc) (0) | 2023.06.01 |
Locked Files (0) | 2023.04.25 |
SCSI Protocol(+SCSI Sense Code, Errors) (0) | 2023.04.24 |
vSAN UUID, Delete vSAN Object (0) | 2023.04.23 |