Skip to main content

描述

包含所有文件系统缓存设置的相关信息

  • cache_name (String) — 缓存名称
  • path (String) — 缓存目录路径
  • max_size (UInt64) — 缓存最大大小
  • max_elements (UInt64) — 缓存元素最大数量,例如 File 段 (限制文件系统上的文件数量)
  • max_file_segment_size (UInt64) — 单个 File 段的最大大小
  • boundary_alignment (UInt64) — File 段对齐方式
  • cache_on_write_operations (UInt8) — 启用直写缓存 (在 INSERT 和 MERGE 时写入缓存)
  • cache_policy (String) — 缓存驱逐策略
  • slru_size_ratio (Float64) — SLRU 缓存策略中受保护元素与试用元素的大小比例
  • background_download_threads (UInt64) — 后台下载线程数。值为 0 时禁用后台下载
  • background_download_queue_size_limit (UInt64) — 后台下载队列大小。值为 0 时禁用后台下载
  • background_download_max_file_segment_size (UInt64) — 后台下载可下载的最大大小
  • load_metadata_threads (UInt64) — 服务器启动时用于加载缓存元数据的最大线程数
  • load_metadata_asynchronously (UInt8) — 启用在服务器启动时异步加载元数据
  • keep_free_space_size_ratio (Float64) — 缓存在后台尽力维持的可用空间比例
  • keep_free_space_elements_ratio (Float64) — 缓存在后台尽力维持的空闲元素比例
  • keep_free_space_remove_batch (UInt64) — 后台线程为维持可用空间/元素比例而移除缓存元素时的批次大小
  • invalidated_entries_cleanup_interval_ms (UInt64) — 后台任务清理已失效 (延迟移除) 的优先队列条目时的空闲间隔,单位为毫秒
  • invalidated_entries_cleanup_threshold (UInt64) — 累积的已失效优先队列条目数量,达到该值时会触发后台移除
  • invalidated_entries_cleanup_remove_batch (UInt64) — 每次后台迭代中,在单次写锁下移除的已失效优先队列条目的最大数量
  • enable_filesystem_query_cache_limit (UInt8) — 启用对单个查询可写入缓存的最大大小的限制
  • cache_hits_threshold (UInt64) — 已弃用设置
  • enable_bypass_cache_with_threshold (UInt8) — 未记录。不建议使用
  • bypass_cache_threshold (UInt64) — 未记录。不建议使用
  • write_cache_per_user_id_directory (UInt8) — ClickHouse Cloud 内部设置
  • allow_dynamic_cache_resize (UInt8) — 允许动态调整文件系统缓存大小
  • max_size_ratio_to_total_space (Float64) — max_size 与磁盘总空间的比率
  • skip_cache_on_disk_failure (UInt8) — 如果为 true,则在发生磁盘 IO 错误时静默跳过文件系统缓存操作。如果为 false (默认) ,则磁盘 IO 错误会作为启动失败向上传递。
  • use_split_cache (UInt8) — 使用将文件分为 system/data 的缓存方式。
  • split_cache_ratio (Float64) — 在 split_cache 中,system 分段占缓存总大小的比率。
  • overcommit_eviction_evict_step (UInt64) — overcommit 驱逐策略中以字节为单位的驱逐步长。用于 keep_free_space_*_ratio 设置
  • check_cache_probability (Float64) — 仅适用于 Debug 或 sanitizer 构建。通过遍历整个缓存并检查每个缓存元素的状态来验证缓存的正确性
  • expose_prometheus_eviction_metrics (UInt8) — 公开文件系统缓存驱逐活动的 Prometheus 指标 (如 filesystem_cache_evictions_total) 。默认关闭。可在运行时通过 SYSTEM RELOAD CONFIG 切换。
  • expose_prometheus_eviction_metrics_per_user (UInt8) — 额外公开按 user-id 统计的驱逐指标。需要 expose_prometheus_eviction_metrics。其基数会随发生驱逐的不同用户数量增加而增长。
  • is_initialized (UInt8) — 指示缓存是否已成功初始化
  • current_size (UInt64) — 当前缓存大小
  • current_elements_num (UInt64) — 当前缓存元素 (File 段) 数量
最后修改于 2026年7月23日