ZFS에서 ARC의 현재 크기를 어떻게 확인할 수 있으며 ARC는 여유 메모리 또는 캐시 메모리와 어떤 관련이 있습니까?

ZFS에서 ARC의 현재 크기를 어떻게 확인할 수 있으며 ARC는 여유 메모리 또는 캐시 메모리와 어떤 관련이 있습니까?

ZFS는 기존 Linux "캐시" 메모리 사용에서 고려되지 않은 ARC(적응형 교체 캐시)를 사용합니다. ZFS ARC의 현재 크기와 크기 경계를 어떻게 확인할 수 있으며, 이는 예를 들어 에서 보고한 여유 메모리 또는 캐시 메모리 양과 어떤 관련이 있습니까 free?

답변1

ZFS 코드는 procfs를 통해 다양한 통계를 보고합니다. ARC의 크기를 결정하려면 (관례적으로 procfs가 /proc에 마운트되어 있다고 가정), 특히 , 및 /proc/spl/kstat/zfs/arcstats의 값을 살펴보십시오 . (또한보십시오cc_maxsizeOracle 커뮤니티 포럼의 이 게시물. 대안인터넷 아카이브 사본Oracle 사이트를 사용할 수 없는 경우.)

  • c목표 크기ARC의 바이트 단위
  • c_max최대 크기ARC의 바이트 단위
  • size현재 크기ARC의 바이트 단위

ARC의 최대 크기는 modprobe를 통해 모듈 zfs_arc_max=N에 매개변수 를 전달하여 조정할 수 있습니다 . 여기서 는 최대 ARC 크기(바이트)이거나 새로운 최대 크기(바이트)를 즉시 기록하여 조정할 수 있습니다 .zfsN/sys/module/zfs/parameters/zfs_arc_max

어떻게 때문에Linux의 ZFS구현된 ARC 메모리행동하다캐시 메모리와 비슷하지만(예를 들어 시스템에 메모리 부족이 발생하면 제거됩니다)집계된커널에 의해 일반적인 메모리 할당으로 수행됩니다. 이는 시스템에 현재 시스템 작업 부하를 고려할 때 예상되는 것보다 훨씬 적은 여유 메모리가 있는 것처럼 보이지만 이는 정상적인 현상이므로 혼란을 초래할 수 있습니다.

ARC 크기를 메가바이트 단위로 얻으려면 다음과 같은 것을 사용할 수 있습니다 awk '/^size/ { print $1 " " $3 / 1048576 }' < /proc/spl/kstat/zfs/arcstats. (1,048,576은 메가바이트에 대한 바이트 수입니다.)

예를 들어, 내 시스템(ZFS를 거의 독점적으로 사용함)이 다음과 같이 보고할 수 있습니다.

$ free -m
             total       used       free     shared    buffers     cached
Mem:         32194      17948      14245          0        158        982
-/+ buffers/cache:      16808      15386
Swap:        49152          0      49152
$ awk '/^size/ { print $1 " " $3 / 1048576 }' < /proc/spl/kstat/zfs/arcstats
size 8138.73
$

이는 다음을 의미합니다.실제현재 상주하는 프로세스의 메모리 사용량은 약 8,669MB입니다(16,808MB에서 8,139MB로 감소).

답변2

Michael Kjörling의 답변을 바탕으로 다음을 사용할 수도 있습니다.arc_summary.py.

여기에서 ARC가 데스크탑 메모리의 절반을 어떻게 사용하고 있는지 확인할 수 있습니다.

루트@호스트:~# free -g
             캐시된 총 사용 가능한 공유 버퍼
기억: 62 56 6 1 1 5
-/+ 버퍼/캐시: 49 13
스왑: 7 0 7

root@host:~# arc_summary.py
------------------------------------- ---------
ZFS 하위 시스템 보고서 2017년 2월 24일 금요일 19:44:20
ARC 요약: (건강)
        메모리 조절 횟수: 0

ARC 기타:
        삭제된 길이: 1.33m
        뮤텍스 미스: 99
        퇴거 건너뛰기: 99

ARC 크기: 98.13% 30.80GiB
        대상 크기: (적응형) 100.00% 31.39 GiB
        최소 크기(하드 제한): 0.10% 32.00MiB
        최대 크기(고수): 1004:1 31.39 GiB

ARC 크기 분석:
        최근 사용된 캐시 크기: 84.25% 26.45GiB
        자주 사용되는 캐시 크기: 15.75% 4.95GiB

ARC 해시 분석:
        요소 최대: 1.11m
        현재 요소: 53.48% 592.56k
        충돌: 763.42k
        체인 최대: 4
        체인: 19.62k

ARC 총 액세스 수: 36.34m
        캐시 적중률: 87.02% 31.62m
        캐시 미스 비율: 12.98% 4.72m
        실제 적중률 : 84.78% 30.81m

        데이터 수요 효율성: 93.49% 24.22m
        데이터 프리페치 효율성: 2.57% 819.12k

        캐시 목록별 캐시 적중 횟수:
          익명으로 사용됨: 2.27% 716.60k
          가장 최근에 사용됨: 17.26% 5.46m
          가장 자주 사용되는 항목: 80.17% 25.35m
          가장 최근에 사용한 고스트: 0.19% 60.25k
          가장 자주 사용되는 고스트: 0.11% 35.37k

        데이터 유형별 캐시 적중:
          수요 데이터: 71.60% 22.64m
          프리페치 데이터: 0.07% 21.04k
          수요 메타데이터: 25.82% 816만
          프리페치 메타데이터: 2.51% 794.39k

        데이터 유형별 캐시 누락:
          수요 데이터: 33.44% 158만
          프리패치 데이터: 16.92% 798.09k
          수요 메타데이터: 48.90% 231만
          프리패치 메타데이터: 0.75% 35.27k


DMU 프리페치 효율성: 173.06m
        적중률 : 86.14% 149.07m
        미스 비율: 13.86% 23.99m



ZFS 조정 가능:
        Metaslab_debug_load 0
        zfs_arc_min_prefetch_lifespan 0
        zfetch_max_streams 8
        zfs_nopwrite_enabled 1
        zfetch_min_sec_reap 2
        zfs_dbgmsg_enable 0
        zfs_dirty_data_max_max_percent 25
        zfs_arc_p_aggressive_disable 1
        spa_load_verify_data 1
        zfs_zevent_cols 80
        zfs_dirty_data_max_percent 10
        zfs_sync_pass_dont_compress 5
        l2arc_write_max 8388608
        zfs_vdev_scrub_max_active 2
        zfs_vdev_sync_write_min_active 10
        zvol_prefetch_bytes 131072
        Metaslab_aliquot 524288
        zfs_no_scrub_prefetch 0
        zfs_arc_shrink_shift 0
        zfetch_block_cap 256
        zfs_txg_history 0
        zfs_delay_scale 500000
        zfs_vdev_async_write_active_min_dirty_percent 30
        Metaslab_debug_unload 0
        zfs_read_history 0
        zvol_max_discard_blocks 16384
        zfs_recover 0
        l2arc_headroom 2
        zfs_deadman_synctime_ms 1000000
        zfs_scan_idle 50
        zfs_free_min_time_ms 1000
        zfs_dirty_data_max 6741298790
        zfs_vdev_async_read_min_active 1
        zfs_mg_noalloc_threshold 0
        zfs_dedup_prefetch 0
        zfs_vdev_max_active 1000
        l2arc_write_boost 8388608
        zfs_resilver_min_time_ms 3000
        zfs_vdev_async_write_max_active 10
        zil_slog_limit 1048576
        zfs_prefetch_disable 0
        zfs_resilver_delay 2
        Metaslab_lba_weighting_enabled 1
        zfs_mg_fragmentation_threshold 85
        l2arc_feed_again 1
        zfs_zevent_console 0
        zfs_immediate_write_sz 32768
        zfs_dbgmsg_maxsize 4194304
        zfs_free_leak_on_eio 0
        zfs_deadman_enabled 1
        Metaslab_bias_enabled 1
        zfs_arc_p_dampener_disable 1
        zfs_object_mutex_size 64
        zfs_metaslab_fragmentation_threshold 70
        zfs_no_scrub_io 0
        Metaslabs_per_vdev 200
        zfs_dbuf_state_index 0
        zfs_vdev_sync_read_min_active 10
        Metaslab_fragmentation_factor_enabled 1
        zvol_inhibit_dev 0
        zfs_vdev_async_write_active_max_dirty_percent 60
        zfs_vdev_cache_size 0
        zfs_vdev_mirror_switch_us 10000
        zfs_dirty_data_sync 67108864
        spa_config_path /etc/zfs/zpool.cache
        zfs_dirty_data_max_max 16853246976
        zfs_arc_lotsfree_percent 10
        zfs_zevent_len_max 128
        zfs_scan_min_time_ms 1000
        zfs_arc_sys_free 0
        zfs_arc_meta_strategy 1
        zfs_vdev_cache_bshift 16
        zfs_arc_meta_adjust_restarts 4096
        zfs_max_recordsize 1048576
        zfs_vdev_scrub_min_active 1
        zfs_vdev_read_gap_limit 32768
        zfs_arc_meta_limit 0
        zfs_vdev_sync_write_max_active 10
        l2arc_norw 0
        zfs_arc_meta_prune 10000
        Metaslab_preload_enabled 1
        l2arc_nocompress 0
        zvol_major 230
        zfs_vdev_aggregation_limit 131072
        zfs_flags 0
        spa_asize_inflation 24
        zfs_admin_snapshot 0
        l2arc_feed_secs 1
        zio_taskq_batch_pct 75
        zfs_sync_pass_deferred_free 2
        zfs_disable_dup_eviction 0
        zfs_arc_grow_retry 0
        zfs_read_history_hits 0
        zfs_vdev_async_write_min_active 1
        zfs_vdev_async_read_max_active 3
        zfs_scrub_delay 4
        zfs_delay_min_dirty_percent 60
        zfs_free_max_blocks 100000
        zfs_vdev_cache_max 16384
        zio_delay_max 30000
        zfs_top_maxinflight 32
        ignore_hole_birth 1
        spa_slop_shift 5
        zfs_vdev_write_gap_limit 4096
        spa_load_verify_metadata 1
        spa_load_verify_maxinflight 10000
        l2arc_noprefetch 1
        zfs_vdev_scheduler noop
        zfs_expire_snapshot 300
        zfs_sync_pass_rewrite 2
        zil_replay_disable 0
        zfs_nocacheflush 0
        zfs_arc_max 0
        zfs_arc_min 0
        zfs_read_chunk_size 1048576
        zfs_txg_timeout 5
        zfs_pd_bytes_max 52428800
        l2arc_headroom_boost 200
        zfs_send_corrupt_data 0
        l2arc_feed_min_ms 200
        zfs_arc_meta_min 0
        zfs_arc_average_blocksize 8192
        zfetch_array_rd_sz 1048576
        zfs_autoimport_disable 1
        zfs_arc_p_min_shift 0
        zio_requeue_io_start_cut_in_line 1
        zfs_vdev_sync_read_max_active 10
        zfs_mdcomp_disable 0
        zfs_arc_num_sublists_per_state 8

관련 정보