Files
waf-platform/EdgeNode/build/configs/cache.template.yaml

71 lines
3.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GoEdge CDN 缓存优化配置文件模板
# 复制此文件为 cache.yaml 并根据实际情况修改配置
# TTL 缓存配置
ttl_cache:
# 分片配置
# pieces: 0 表示自动计算,> 0 表示手动指定分片数
# 自动计算规则:基础分片数 = CPU核心数 * 2根据系统内存调整
pieces: 0
min_pieces: 64 # 最小分片数
max_pieces: 1024 # 最大分片数
# GC 配置
gc:
base_interval: 2s # 基础 GC 间隔
min_interval: 1s # 最小 GC 间隔(过期率高时使用)
max_interval: 10s # 最大 GC 间隔(过期率低时使用)
adaptive: true # 是否启用自适应 GC根据过期率动态调整间隔
sample_size: 100 # 过期率采样大小(用于智能分片选择)
# 文件缓存配置
file_cache:
# SSD 检测配置
auto_detect_ssd: true # 是否自动检测 SSD通过 /sys/block/*/queue/rotational 或 lsblk
ssd_paths: [] # 手动指定 SSD 路径(可选,如:["/mnt/ssd1", "/mnt/ssd2"]
# 如果 auto_detect_ssd 为 false将使用此列表
# SSD 优化策略
# 热点数据将优先存储在 SSD 上
ssd:
hot_item_threshold: 100 # 访问次数超过此值视为热点数据
write_buffer_size: 128KB # 写入缓冲区大小SSD 随机写性能好,使用更大缓冲区)
read_ahead_size: 256KB # 预读大小SSD 使用更激进的预读策略)
sync_interval: 10s # 同步间隔SSD 不需要频繁同步,减少 fsync 频率)
open_file_cache_max: 10000 # 文件句柄缓存最大值SSD 可以缓存更多文件句柄)
# HDD 配置
# 传统机械硬盘的优化配置
hdd:
write_buffer_size: 64KB # 写入缓冲区大小
read_ahead_size: 128KB # 预读大小
sync_interval: 1s # 同步间隔HDD 需要更频繁的同步)
open_file_cache_max: 5000 # 文件句柄缓存最大值
# 内存缓存配置
# 内存缓存作为文件缓存的一级缓存,用于提升小文件访问性能
memory:
# 内存缓存容量(系统内存的百分比)
# 如果未设置,将根据系统内存自动计算:
# - 系统内存 < 32GB: 10%
# - 系统内存 >= 32GB: 15%
# - 系统内存 >= 64GB: 20%
# 限制范围:最小 512MB最大 32GB
capacity_percent: 15 # 默认 15%,可配置 10-30%
# 小文件阈值
small_file_threshold: 1MB # 1MB 以下视为小文件(强制使用内存缓存)
medium_file_threshold: 10MB # 10MB 以下视为中等文件(根据内存使用率决定)
# 小文件内存缓存策略
small_file_memory_cache: true # 小文件强制使用内存缓存(提升访问速度)
# 淘汰策略
eviction_policy: "lfu_lru" # 淘汰策略:
# - lfu: 最少使用频率Least Frequently Used
# - lru: 最近最少使用Least Recently Used
# - lfu_lru: 混合策略(保留热点和最近访问的数据)
preserve_hot_items: true # 保留热点数据(访问频率高的数据)
preserve_recent_items: true # 保留最近访问的数据(最近 1 小时内访问的数据)