ZFS 使用 ARC(自适应替换缓存),传统 Linux“缓存”内存使用中没有考虑到这一点。如何确定 ZFS ARC 的当前大小以及大小边界,以及这些与例如由 报告的可用或缓存内存量free有何关系?
use*_*ser 29
ZFS 代码通过 procfs 报告各种统计信息。要确定 ARC 的大小,请查看/proc/spl/kstat/zfs/arcstats(假设 procfs 按照惯例安装在 /proc 上),特别是c,c_max和的值size。(另请参阅Oracle 社区论坛上的这篇文章。如果 Oracle 站点不可用,则可以选择Internet 存档副本。)
c是ARC的目标大小(以字节为单位)c_max是ARC的最大大小(以字节为单位)size是ARC的当前大小(以字节为单位)ARC 的最大大小可以通过将zfs_arc_max=N参数传递给zfs模块(通过 modprobe)来调整,其中NARC 的最大大小以字节为单位,或者通过将新的最大大小以字节为单位写入/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
$
Run Code Online (Sandbox Code Playgroud)
这意味着当前驻留进程的实际内存使用量约为 8,669 MB(16,808 MB 减少了 8,139 MB)。
111*_*181 20
要以 Michael Kjörling 的回答为基础,您还可以使用arc_summary.py。
在这里您可以看到 ARC 如何使用我桌面一半的内存:
root@host:~# 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.80 GiB
目标大小:(自适应)100.00% 31.39 GiB
最小大小(硬限制):0.10% 32.00 MiB
最大尺寸(高水位):1004:1 31.39 GiB
ARC 尺寸细分:
最近使用的缓存大小:84.25% 26.45 GiB
常用缓存大小:15.75% 4.95 GiB
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% 2422 万
数据预取效率:2.57% 819.12k
按缓存列表缓存命中:
匿名使用:2.27% 716.60k
最近使用:17.26% 5.46m
最常用:80.17% 25.35m
最近使用的 Ghost:0.19% 60.25k
最常用的幽灵:0.11% 35.37k
按数据类型缓存命中:
需求数据:71.60% 2264 万
预取数据:0.07% 21.04k
需求元数据:25.82% 816 万
预取元数据:2.51% 794.39k
按数据类型缓存未命中:
需求数据:33.44% 1.58m
预取数据:16.92% 798.09k
需求元数据:48.90% 2.31m
预取元数据:0.75% 35.27k
DMU 预取效率:173.06m
命中率:86.14% 149.07m
未命中率:13.86% 2399 万
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
第 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
| 归档时间: |
|
| 查看次数: |
32303 次 |
| 最近记录: |