Scale the tablebase cache to ~100k entries (#24)

* Slim the cached tablebase value to the fields the trainer reads (#20)

* Sample for LFU eviction instead of scanning the cache (#21)

* Make cache size configurable and back up daily off-peak (#22)

* Document the cache design in the glossary and an ADR (#23)

* Address cache-scaling code review findings
This commit is contained in:
2026-11-02 23:02:01 +01:00
committed by GitHub
parent fa71783e55
commit a5bb1cb670
16 changed files with 695 additions and 120 deletions
+4 -1
View File
@@ -7,6 +7,8 @@ defmodule Chesstrainer.Application do
@impl true
def start(_type, _args) do
cache_opts = Application.get_env(:chesstrainer, Chesstrainer.Cache, [])
children = [
ChesstrainerWeb.Telemetry,
Chesstrainer.Repo,
@@ -17,7 +19,8 @@ defmodule Chesstrainer.Application do
# Start to serve requests, typically the last entry
ChesstrainerWeb.Endpoint,
{Registry, keys: :unique, name: Chesstrainer.CacheRegistry},
{Chesstrainer.Cache, :tablebase}
{Task.Supervisor, name: Chesstrainer.Cache.BackupSupervisor},
{Chesstrainer.Cache, {:tablebase, cache_opts}}
]
# See https://elixir.hexdocs.pm/Supervisor.html