August 23, 2025
How I made the app store 200-300x faster
My own App Store took 20 to 30 seconds to load. I was calling docker ps once per template, 128 times per page, plus reading 128 YAML files off disk every request.
The bug report that wasn't a bug

I was testing the HomelabARR App Store when I noticed the page took 20 to 30 seconds to load. Not "a bit slow." Twenty to thirty seconds of staring at a blank screen, long enough that I started filing bug reports against my own software because I assumed the API was broken.
It wasn't broken. It was doing exactly what I told it to do, in the worst possible way.
The root cause
Profiling told the story in one pass. Template loading was a couple of milliseconds and not the problem. The Docker status checks were the whole bill, twelve seconds of it.
The App Store had 128 Docker Compose templates, one per app you could install. To show which apps were installed and running, the server made a separate docker ps-style call for each template. 128 templates, 128 Docker API round trips, sequential, no parallelism, no caching. On top of that it re-read all 128 YAML files off disk on every single request, also uncached. Every page load was 128 file reads plus 128 Docker commands plus serialization. That is where the 20 to 30 seconds came from.
I had written this code. I wrote it the way you write things when you are learning and you just want the screen to show the right answer. It did show the right answer. It was just catastrophically slow getting there.
The fix
Two changes, both the kind I would have flagged on sight in someone else's PR.
First, cache the templates. The YAML files do not change between requests, so there is no reason to walk the tree and parse them every time. One cache, lazy-loaded on first hit, with a 5-minute TTL, guarded by a mutex so concurrent requests are safe. sync.Once does the first load exactly once, and an RWMutex lets every subsequent reader hit memory in parallel. Here is the shape of it:
// pkg/api/apps/templates.go (this pattern predates the repo split — it was
// already in place at the first eightly-os commit, ea0480c4, Sep 2025 — and
// is still the live code today)
var (
appTemplatesCache []AppTemplate
taxonomyCache map[string]TaxonomyGroup
repositoryCache []Repository
cacheOnce sync.Once
cacheMutex sync.RWMutex
lastCacheUpdate time.Time
cacheTTL = 5 * time.Minute
)
// GetCachedAppTemplates returns the template list, lazy-loading on the
// first call and re-scanning from disk only after the TTL expires.
func GetCachedAppTemplates() []AppTemplate {
cacheOnce.Do(func() {
cacheMutex.Lock()
defer cacheMutex.Unlock()
refreshCache() // the only disk scan
})
cacheMutex.RLock()
stale := time.Since(lastCacheUpdate) > cacheTTL
cacheMutex.RUnlock()
if stale {
cacheMutex.Lock()
if time.Since(lastCacheUpdate) > cacheTTL {
refreshCache()
}
cacheMutex.Unlock()
}
cacheMutex.RLock()
defer cacheMutex.RUnlock()
result := make([]AppTemplate, len(appTemplatesCache))
copy(result, appTemplatesCache)
return result
}
First request reads disk, every request after that reads memory until the TTL rolls over. The 128 file reads per request became zero.
Second, stop asking Docker about each app one at a time. Make one call, get every running container, build a set of their images in memory, then mark each template installed by matching against that set. One Docker call instead of 128:
// pkg/api/apps/handlers.go (eightly-os a546e780, PR #70 — landed as part of
// a dark-theme contrast fix, not a dedicated speed PR; superseded 2026-07-28
// by EOS-1040, which matches on compose project instead of image name)
// Build a set of running container images so we can mark templates
// as "installed" when their Docker image matches a running container.
installedImages := make(map[string]bool)
if containers, err := ah.containerManager.ListContainers(); err == nil {
for _, c := range containers {
img := strings.ToLower(c.Image)
installedImages[img] = true
// Also index without tag — "linuxserver/plex:latest" matches "linuxserver/plex"
if idx := strings.LastIndex(img, ":"); idx > 0 {
installedImages[img[:idx]] = true
}
}
}
// ... then per template, a map lookup instead of a Docker call:
"installed": installedImages[strings.ToLower(t.DockerImage)] ||
installedImages[strings.TrimSuffix(strings.ToLower(t.DockerImage), ":latest")],
The 128 Docker round trips collapsed into a single ListContainers() plus 128 map lookups, which are free by comparison.
The timing numbers behind the headline (template loading 2.7 ms, Docker checks 12,100 ms down to about 80 ms, total about 100 ms, the 200-300x) came from a profiling run on the HomelabARR Go monorepo.
The lesson
If you are a real developer you are rolling your eyes. Obviously you cache static data. Obviously you batch API calls. Yes. Obviously. But I was a project manager learning Go by building production software with an AI coding partner, and you make every beginner mistake when you learn this way. You just make them inside real software that real people use.
I did not learn about caching from a textbook. I learned it because my App Store was unusable and I had to find out why.
I also learned something about working with an AI. Claude wrote the original code that made 128 Docker calls, and Claude wrote the version that makes one. The difference was not the model. It was the ask. The first time I said "check if each app is installed." The second time I said "get all running containers once and match against the templates." Same tool, different requirement. The person who understands the system shapes the solution even when they are not the one typing the code.
I wrote up a proper RCA afterward, the kind I used to write for engineering teams at Neptune. Except this time I was the engineer, the PM, the QA tester, and the user who filed the bug report. One person, every hat.