Skip to content

Simulator zh CN

Ben Manes edited this page Sep 14, 2024 · 19 revisions

模拟器中包含一系列的驱逐策略和数据分发生成器。这将帮助我们了解各个驱逐策略是否适合使用场景。

使用方法

在配置完所需要的 配置之后,在IDE中运行模拟器。或者也可以选择在命令行中使用:

# Single run, displays ascii table by default
gradlew simulator:run -q

# Multiple runs, writes a combined report, and renders a chart
gradlew simulator:simulate -q \
  --maximumSize=<comma separated list; supports _ numeric literal> \
  --theme=<light, dark> \
  --title=<optional>

# In both, additional configuration may be supplied as system properties
  -Dcaffeine.simulator.files.paths.0=multi3.trace.gz
# and custom jvm arguments can be provided
  -PjvmArgs=-Xmx6g

命令。支持以下几种追踪格式:

仓库 位置 仓库 位置
AdaptSize author's simulator Address (UCSD) git repository
ARC git repository Baleen project's homepage
Cache2k git repository Cachelib project's homepage
CameLab project's homepage Corda git repository
GL-Cache project's homepage Gradle git repository
Kaggle project's homepage libCacheSim author's simulator
LIRS git repository LRB author's simulator
Scarab git repository SNIA project's homepage
Tragen project's homepage Twitter project's homepage
UMass project's homepage WikiBench project's homepage

Rewriter

重写器实用程序将跟踪从一种格式转换为另一种格式。这对于比较用不支持跟踪格式的替代模拟器编写的策略很有帮助。

gradlew :simulator:rewrite -q \
  --inputFormat=<trace format> \
  --inputFiles=<comma separated paths> \
  --outputFormat=<trace format> \
  --outputFile=<path>

采样报告

由于批处理和数据广播的原因,时间指标只有在独立运行各个策略的时候才有比较的价值。

╔══════════════════════╤══════════╤════════════╤════════════╤════════════╤════════════╤═══════════╗
║ Policy               │ Hit Rate │ Hits       │ Misses     │ Requests   │ Evictions  │ Time      ║
╠══════════════════════╪══════════╪════════════╪════════════╪════════════╪════════════╪═══════════╣
║ opt.Clairvoyant      │ 48.09 %  │ 21,019,597 │ 22,685,382 │ 43,704,979 │ 18,685,382 │ 2.301 min ║
╟──────────────────────┼──────────┼────────────┼────────────┼────────────┼────────────┼───────────╢
║ sketch.WindowTinyLfu │ 45.25 %  │ 19,775,085 │ 23,929,894 │ 43,704,979 │ 19,929,894 │ 1.460 min ║
╟──────────────────────┼──────────┼────────────┼────────────┼────────────┼────────────┼───────────╢
║ irr.Lirs             │ 38.14 %  │ 16,668,577 │ 27,036,402 │ 43,704,979 │ 23,036,402 │ 1.319 min ║
╟──────────────────────┼──────────┼────────────┼────────────┼────────────┼────────────┼───────────╢
║ adaptive.Arc         │ 29.60 %  │ 12,938,241 │ 30,766,738 │ 43,704,979 │ 26,766,738 │ 1.249 min ║
╟──────────────────────┼──────────┼────────────┼────────────┼────────────┼────────────┼───────────╢
║ linked.Lru           │ 20.24 %  │  8,847,982 │ 34,856,997 │ 43,704,979 │ 30,856,997 │ 1.218 min ║
╚══════════════════════╧══════════╧════════════╧════════════╧════════════╧════════════╧═══════════╝

Clone this wiki locally