-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Simulator
Ben Manes edited this page Oct 12, 2015
·
43 revisions
The simulator includes a family of eviction policies and distribution generators. This allows developers to investigate which policy is best for their usage scenario.
The simulator is implemented using Akka where each policy is an actor. The default configuration can be overridden by system properties or an application.conf file. It can be run locally using,
# Run a simulation against a local trace file
gradlew simulator:run -Dcaffeine.simulator.source=file -Dcaffeine.simulator.file.path=trace.log
# Run a simulation against a generated data set
gradlew simulator:run -Dcaffeine.simulator.source=synthetic -Dcaffeine.simulator.synthetic.size=1000A report can be printed to the console or a file. The output lists the hit rate of the eviction policies that were evaluated, e.g.
╔══════════════════════╤══════════╤════════╤════════╤══════════╤═══════════╤══════════════════╤══════════╗
║ Policy │ Hit rate │ Hits │ Misses │ Requests │ Evictions │ Steps │ Time ║
╠══════════════════════╪══════════╪════════╪════════╪══════════╪═══════════╪══════════════════╪══════════╣
║ opt.Clairvoyant │ 58.79 % │ 9,323 │ 6,535 │ 15,858 │ 3,929 │ ? │ 278.0 ms ║
╟──────────────────────┼──────────┼────────┼────────┼──────────┼───────────┼──────────────────┼──────────╢
║ sketch.WindowTinyLfu │ 56.11 % │ 8,898 │ 6,960 │ 15,858 │ 6,460 │ 15,858 (100 %) │ 315.2 ms ║
╟──────────────────────┼──────────┼────────┼────────┼──────────┼───────────┼──────────────────┼──────────╢
║ irr.Lirs │ 55.97 % │ 8,876 │ 6,982 │ 15,858 │ 6,482 │ 27,689 (174 %) │ 311.0 ms ║
╟──────────────────────┼──────────┼────────┼────────┼──────────┼───────────┼──────────────────┼──────────╢
║ adaptive.Arc │ 49.39 % │ 7,833 │ 8,025 │ 15,858 │ 7,525 │ 15,858 (100 %) │ 166.3 ms ║
╟──────────────────────┼──────────┼────────┼────────┼──────────┼───────────┼──────────────────┼──────────╢
║ linked.Lru │ 46.51 % │ 7,375 │ 8,483 │ 15,858 │ 7,983 │ 15,858 (100 %) │ 128.2 ms ║
╟──────────────────────┼──────────┼────────┼────────┼──────────┼───────────┼──────────────────┼──────────╢
║ linked.Fifo │ 40.72 % │ 6,457 │ 9,401 │ 15,858 │ 8,901 │ 15,858 (100 %) │ 163.6 ms ║
╚══════════════════════╧══════════╧════════╧════════╧══════════╧═══════════╧══════════════════╧══════════╝

