codebar / codebar/planner

SponsorsController#index still slow in production after #2803 caching (median 1.5s, render-bound)

Open
#2,883 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

performance
Dominant language
Ruby
Stars
104
Forks
205
Avg merge
1d 5h
Merged PRs (30d)
63

Description

Summary

Requests to /sponsors are chronically slow despite the fragment caching and table indexes merged in #2803. Measured from the canonical Rails logs (rails_semantic_logger process_action payload, collected via the production log drain) over a 3-hour window on 2026-09-16/17.

Measured (3h window, 123 requests)

Metric Value
median duration 1,474ms
p90 duration 2,891ms
max duration 21.3s
median view_runtime 1,337ms
median db_runtime 41ms
queries per request 5
avg allocations 2.5M per request (17.7M on the slowest)

The page is render-bound: 41ms of DB work across 5 queries, but 1.3s of view time. Fragment caching from #2803 does not appear to be effective in production.

Context

#2803 (merged 2026-08-31) split the sponsors partial for collection caching and added indexes. Local profiling at the time showed warm-cache partial allocations dropping ~80% (225k → 44k objects). Production medians are unchanged a month later.

Hypotheses

  1. Fragment cache misses in production — cache store may be unset or per-dyno memory store, flushed by restarts
  2. Cache key churn (sponsor updated_at touches) defeating reuse
  3. Render cost outside the cached fragments (page shell, other partials)

Next steps

  • Confirm the production cache store and measure the fragment hit rate
  • Reproduce with a production-sized sponsor list and profile allocations again
  • Decide on a caching strategy (longer-lived fragments, low-level caching, or both)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at SponsorsController#index and the caching changes from #2803. Confirm the production cache store and fragment hit rate, then reproduce the issue with a production-sized sponsor list while profiling allocations. Done means identifying whether cache configuration, key churn, or uncached rendering dominates and deciding on a caching strategy.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
backend, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.