Ubuntu 16.04LTS でZFSを試してみる(2)
さて、前回でUbuntu16.04LTSに ZFSを入れてみたわけですが、ZFSのモジュールがどうなってるか見てみましょう。
画面じゃわかりませんね。
modinfo zfsすると、いろいろ情報がわかります。licenseがCDDLになっていて、AuthorがOpenZFS on Linx ということが分かります。
root@smiyaza-VirtualBox:~# modinfo zfs filename: /lib/modules/4.4.0-21-generic/kernel/zfs/zfs/zfs.ko version: 0.6.5.6-0ubuntu3 license: CDDL author: OpenZFS on Linux description: ZFS srcversion: A87B4C0C518AC85BD042501 depends: spl,znvpair,zunicode,zcommon,zavl vermagic: 4.4.0-21-generic SMP mod_unload modversions parm: zvol_inhibit_dev:Do not create zvol device nodes (uint) parm: zvol_major:Major number for zvol device (uint) parm: zvol_max_discard_blocks:Max number of blocks to discard (ulong) parm: zvol_prefetch_bytes:Prefetch N bytes at zvol start+end (uint) parm: zio_delay_max:Max zio millisec delay before posting event (int) parm: zio_requeue_io_start_cut_in_line:Prioritize requeued I/O (int) parm: zfs_sync_pass_deferred_free:Defer frees starting in this pass (int) parm: zfs_sync_pass_dont_compress:Don't compress starting in this pass (int) parm: zfs_sync_pass_rewrite:Rewrite new bps starting in this pass (int) parm: zil_replay_disable:Disable intent logging replay (int) parm: zfs_nocacheflush:Disable cache flushes (int) parm: zil_slog_limit:Max commit bytes to separate log device (ulong) parm: zfs_object_mutex_size:Size of znode hold array (uint) parm: zfs_read_chunk_size:Bytes to read per chunk (long) parm: zfs_immediate_write_sz:Largest data block to write to zil (long) parm: zfs_dbgmsg_enable:Enable ZFS debug message log (int) parm: zfs_dbgmsg_maxsize:Maximum ZFS debug log size (int) parm: zfs_admin_snapshot:Enable mkdir/rmdir/mv in .zfs/snapshot (int) parm: zfs_expire_snapshot:Seconds to expire .zfs/snapshot (int) parm: zfs_vdev_aggregation_limit:Max vdev I/O aggregation size (int) parm: zfs_vdev_read_gap_limit:Aggregate read I/O over gap (int) parm: zfs_vdev_write_gap_limit:Aggregate write I/O over gap (int) parm: zfs_vdev_max_active:Maximum number of active I/Os per vdev (int) parm: zfs_vdev_async_write_active_max_dirty_percent:Async write concurrency max threshold (int) parm: zfs_vdev_async_write_active_min_dirty_percent:Async write concurrency min threshold (int) parm: zfs_vdev_async_read_max_active:Max active async read I/Os per vdev (int) parm: zfs_vdev_async_read_min_active:Min active async read I/Os per vdev (int) parm: zfs_vdev_async_write_max_active:Max active async write I/Os per vdev (int) parm: zfs_vdev_async_write_min_active:Min active async write I/Os per vdev (int) parm: zfs_vdev_scrub_max_active:Max active scrub I/Os per vdev (int) parm: zfs_vdev_scrub_min_active:Min active scrub I/Os per vdev (int) parm: zfs_vdev_sync_read_max_active:Max active sync read I/Os per vdev (int) parm: zfs_vdev_sync_read_min_active:Min active sync read I/Os per vdev (int) parm: zfs_vdev_sync_write_max_active:Max active sync write I/Os per vdev (int) parm: zfs_vdev_sync_write_min_active:Min active sync write I/Os per vdev (int) parm: zfs_vdev_mirror_switch_us:Switch mirrors every N usecs (int) parm: zfs_vdev_scheduler:I/O scheduler (charp) parm: zfs_vdev_cache_max:Inflate reads small than max (int) parm: zfs_vdev_cache_size:Total size of the per-disk cache (int) parm: zfs_vdev_cache_bshift:Shift size to inflate reads too (int) parm: metaslabs_per_vdev:Divide added vdev into approximately (but no more than) this number of metaslabs (int) parm: zfs_txg_timeout:Max seconds worth of delta per txg (int) parm: zfs_read_history:Historic statistics for the last N reads (int) parm: zfs_read_history_hits:Include cache hits in read history (int) parm: zfs_txg_history:Historic statistics for the last N txgs (int) parm: zfs_flags:Set additional debugging flags (uint) parm: zfs_recover:Set to attempt to recover from fatal errors (int) parm: zfs_free_leak_on_eio:Set to ignore IO errors during free and permanently leak the space (int) parm: zfs_deadman_synctime_ms:Expiration time in milliseconds (ulong) parm: zfs_deadman_enabled:Enable deadman timer (int) parm: spa_asize_inflation:SPA size estimate multiplication factor (int) parm: spa_slop_shift:Reserved free space in pool (int) parm: spa_config_path:SPA config file (/etc/zfs/zpool.cache) (charp) parm: zfs_autoimport_disable:Disable pool import at module load (int) parm: spa_load_verify_maxinflight:Max concurrent traversal I/Os while verifying pool during import -X (int) parm: spa_load_verify_metadata:Set to traverse metadata on pool import (int) parm: spa_load_verify_data:Set to traverse data on pool import (int) parm: zio_taskq_batch_pct:Percentage of CPUs to run an IO worker thread (uint) parm: metaslab_aliquot:allocation granularity (a.k.a. stripe size) (ulong) parm: metaslab_debug_load:load all metaslabs when pool is first opened (int) parm: metaslab_debug_unload:prevent metaslabs from being unloaded (int) parm: metaslab_preload_enabled:preload potential metaslabs during reassessment (int) parm: zfs_mg_noalloc_threshold:percentage of free space for metaslab group to allow allocation (int) parm: zfs_mg_fragmentation_threshold:fragmentation for metaslab group to allow allocation (int) parm: zfs_metaslab_fragmentation_threshold:fragmentation for metaslab to allow allocation (int) parm: metaslab_fragmentation_factor_enabled:use the fragmentation metric to prefer less fragmented metaslabs (int) parm: metaslab_lba_weighting_enabled:prefer metaslabs with lower LBAs (int) parm: metaslab_bias_enabled:enable metaslab group biasing (int) parm: zfs_zevent_len_max:Max event queue length (int) parm: zfs_zevent_cols:Max event column width (int) parm: zfs_zevent_console:Log events to the console (int) parm: zfs_top_maxinflight:Max I/Os per top-level (int) parm: zfs_resilver_delay:Number of ticks to delay resilver (int) parm: zfs_scrub_delay:Number of ticks to delay scrub (int) parm: zfs_scan_idle:Idle window in clock ticks (int) parm: zfs_scan_min_time_ms:Min millisecs to scrub per txg (int) parm: zfs_free_min_time_ms:Min millisecs to free per txg (int) parm: zfs_resilver_min_time_ms:Min millisecs to resilver per txg (int) parm: zfs_no_scrub_io:Set to disable scrub I/O (int) parm: zfs_no_scrub_prefetch:Set to disable scrub prefetching (int) parm: zfs_free_max_blocks:Max number of blocks freed in one txg (ulong) parm: zfs_dirty_data_max_percent:percent of ram can be dirty (int) parm: zfs_dirty_data_max_max_percent:zfs_dirty_data_max upper bound as % of RAM (int) parm: zfs_delay_min_dirty_percent:transaction delay threshold (int) parm: zfs_dirty_data_max:determines the dirty space limit (ulong) parm: zfs_dirty_data_max_max:zfs_dirty_data_max upper bound in bytes (ulong) parm: zfs_dirty_data_sync:sync txg when this much dirty data (ulong) parm: zfs_delay_scale:how quickly delay approaches infinity (ulong) parm: zfs_max_recordsize:Max allowed record size (int) parm: zfs_prefetch_disable:Disable all ZFS prefetching (int) parm: zfetch_max_streams:Max number of streams per zfetch (uint) parm: zfetch_min_sec_reap:Min time before stream reclaim (uint) parm: zfetch_block_cap:Max number of blocks to fetch at a time (uint) parm: zfetch_array_rd_sz:Number of bytes in a array_read (ulong) parm: zfs_pd_bytes_max:Max number of bytes to prefetch (int) parm: zfs_send_corrupt_data:Allow sending corrupt data (int) parm: zfs_mdcomp_disable:Disable meta data compression (int) parm: zfs_nopwrite_enabled:Enable NOP writes (int) parm: zfs_dedup_prefetch:Enable prefetching dedup-ed blks (int) parm: zfs_dbuf_state_index:Calculate arc header index (int) parm: zfs_arc_min:Min arc size (ulong) parm: zfs_arc_max:Max arc size (ulong) parm: zfs_arc_meta_limit:Meta limit for arc size (ulong) parm: zfs_arc_meta_min:Min arc metadata (ulong) parm: zfs_arc_meta_prune:Meta objects to scan for prune (int) parm: zfs_arc_meta_adjust_restarts:Limit number of restarts in arc_adjust_meta (int) parm: zfs_arc_meta_strategy:Meta reclaim strategy (int) parm: zfs_arc_grow_retry:Seconds before growing arc size (int) parm: zfs_arc_p_aggressive_disable:disable aggressive arc_p grow (int) parm: zfs_arc_p_dampener_disable:disable arc_p adapt dampener (int) parm: zfs_arc_shrink_shift:log2(fraction of arc to reclaim) (int) parm: zfs_arc_p_min_shift:arc_c shift to calc min/max arc_p (int) parm: zfs_disable_dup_eviction:disable duplicate buffer eviction (int) parm: zfs_arc_average_blocksize:Target average block size (int) parm: zfs_arc_min_prefetch_lifespan:Min life of prefetch block (int) parm: zfs_arc_num_sublists_per_state:Number of sublists used in each of the ARC state lists (int) parm: l2arc_write_max:Max write bytes per interval (ulong) parm: l2arc_write_boost:Extra write bytes during device warmup (ulong) parm: l2arc_headroom:Number of max device writes to precache (ulong) parm: l2arc_headroom_boost:Compressed l2arc_headroom multiplier (ulong) parm: l2arc_feed_secs:Seconds between L2ARC writing (ulong) parm: l2arc_feed_min_ms:Min feed interval in milliseconds (ulong) parm: l2arc_noprefetch:Skip caching prefetched buffers (int) parm: l2arc_nocompress:Skip compressing L2ARC buffers (int) parm: l2arc_feed_again:Turbo L2ARC warmup (int) parm: l2arc_norw:No reads during writes (int) parm: zfs_arc_lotsfree_percent:System free memory I/O throttle in bytes (int) parm: zfs_arc_sys_free:System free memory target size in bytes (ulong)
さて、気になるカーネルパラメータをチェックしましょう。
ZFSのカーネルパラメータは、/proc/spl/kstat/zfs にまとまっています。
気になるのはARC(Adaptice Repacement Cache)あたりですかね。
root@smiyaza-VirtualBox:~# ls -1F /proc/spl/kstat/zfs/ arcstats dbgmsg dbufs dmu_tx fm testpool/ vdev_cache_stats xuio_stats zfetchstats zil root@smiyaza-VirtualBox:~# cat /proc/spl/kstat/zfs/arcstats 6 1 0x01 91 4368 7680316308 4438954954082 name type data hits 4 49 misses 4 212 demand_data_hits 4 0 demand_data_misses 4 0 demand_metadata_hits 4 49 demand_metadata_misses 4 212 prefetch_data_hits 4 0 prefetch_data_misses 4 0 prefetch_metadata_hits 4 0 prefetch_metadata_misses 4 0 mru_hits 4 17 mru_ghost_hits 4 0 mfu_hits 4 32 mfu_ghost_hits 4 0 deleted 4 0 mutex_miss 4 0 evict_skip 4 0 evict_not_enough 4 0 evict_l2_cached 4 0 evict_l2_eligible 4 0 evict_l2_ineligible 4 0 evict_l2_skip 4 0 hash_elements 4 24 hash_elements_max 4 24 hash_collisions 4 0 hash_chains 4 0 hash_chain_max 4 0 p 4 260180992 c 4 520361984 c_min 4 33554432 c_max 4 520361984 size 4 474248 hdr_size 4 10600 data_size 4 0 metadata_size 4 401920 other_size 4 61728 anon_size 4 16384 anon_evictable_data 4 0 anon_evictable_metadata 4 0 mru_size 4 233984 mru_evictable_data 4 0 mru_evictable_metadata 4 199168 mru_ghost_size 4 0 mru_ghost_evictable_data 4 0 mru_ghost_evictable_metadata 4 0 mfu_size 4 151552 mfu_evictable_data 4 0 mfu_evictable_metadata 4 34816 mfu_ghost_size 4 0 mfu_ghost_evictable_data 4 0 mfu_ghost_evictable_metadata 4 0 l2_hits 4 0 l2_misses 4 0 l2_feeds 4 0 l2_rw_clash 4 0 l2_read_bytes 4 0 l2_write_bytes 4 0 l2_writes_sent 4 0 l2_writes_done 4 0 l2_writes_error 4 0 l2_writes_lock_retry 4 0 l2_evict_lock_retry 4 0 l2_evict_reading 4 0 l2_evict_l1cached 4 0 l2_free_on_write 4 0 l2_cdata_free_on_write 4 0 l2_abort_lowmem 4 0 l2_cksum_bad 4 0 l2_io_error 4 0 l2_size 4 0 l2_asize 4 0 l2_hdr_size 4 0 l2_compress_successes 4 0 l2_compress_zeros 4 0 l2_compress_failures 4 0 memory_throttle_count 4 0 duplicate_buffers 4 0 duplicate_buffers_size 4 0 duplicate_reads 4 0 memory_direct_count 4 0 memory_indirect_count 4 0 arc_no_grow 4 0 arc_tempreserve 4 0 arc_loaned_bytes 4 0 arc_prune 4 0 arc_meta_used 4 474248 arc_meta_limit 4 390271488 arc_meta_max 4 505504 arc_meta_min 4 16777216 arc_need_free 4 0 arc_sys_free 4 16261120 root@smiyaza-VirtualBox:~# free total used free shared buff/cache available Mem: 1016332 544316 53092 3080 418924 428156 Swap: 1046524 44488 1002036
OSのメモリが1GBなのに対してarcmaxが500MB。ちょっと多い感じ。事実swap使ってるし。
この辺のルールはもう少し調べましょう。arcmaxをどこで設定するかよくわからないし。
ということで、まだわからないことだらけですね。