Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Workshop show pages allocate ~7.3k objects per request with no caching (28% of app allocations)

未关闭
#2,951 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
52/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
活跃
技术栈
rails, ruby

调研方向

Start by re-measuring current allocations for WorkshopsController#show in the Codebar requests dashboard or canonical logs. Read the show action, the EventCardComponent and chapters_sidebar caching patterns, and EventsController lines 12/19; inspect the sponsors, venue, organisers_grid, newsletter, and actions sections. Done means materially lower allocations, unchanged logged-in behaviour, and 304 responses for unchanged anonymous views.

由索引模型根据 Issue 内容生成。

描述

performance

Issue 2951: Workshop show pages allocate ~7.3k objects per request with no caching (28% of app allocations)

Summary

WorkshopsController#show is the app's top allocation consumer: 28% of all allocations over the last 7 days (2026-09-21..27), from 24,701 successful renders — 43% of all traffic. Every workshop page view rebuilds everything from scratch: the page has no caching at all, while sibling pages already use it (EventCardComponent fragment cache, chapters_sidebar fragment, fresh_when in EventsController).

Measured

7-day window 2026-09-21..27 (canonical logs, payload.allocations): 204.8M allocations across 24,701 x 200s (plus 179 404s). Per-request cost is extremely uniform: p50 7,348, p90 8,985, p95 12,913, median 8 queries, view p50 10ms — so this is per-render rendering cost, not a query or outlier problem. These numbers are stale by the time you read this — re-measure from current logs or the Codebar requests dashboard (allocations panel) before starting.

Per-render allocators, in rough order:

  • sanitize(@workshop.description) — the Rails HTML sanitizer is one of the heaviest single calls per render
  • shared/sponsors, shared/venue, members/organisers_grid, shared/newsletter partials and the layout re-render every request
  • no fragment caching anywhere on the page

Suggested directions

  1. HTTP caching for anonymous GETs — fresh_when with an etag on [@workshop.cache_key_with_version, ...], gated on !logged_in? (the actions partial is per-user). The pattern already exists at EventsController lines 12/19. Crawlers and repeat anonymous visits then get 304s with near-zero allocations.
  2. Fragment-cache the static sections (sponsors, venue, organisers grid) keyed on the workshop cache key — this also cuts allocations for logged-in views.
  3. Sanitize once on write (or cache the sanitized HTML) rather than per render.

Verify

payload.allocations p50 for WorkshopsController#show drops materially on the allocations panel; no visual or behavioural regression for logged-in members; conditional GETs return 304 for unchanged anonymous views.

Related: #2886-#2888 (same measurement method), #2891 (404 tail already resolved by the route constraint)

主要语言
Ruby
星标
104
派生
205
平均合并
1 天 2 小时
30 天内合并 PR
77

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codebar/planner 的其他 Issue

查看 codebar/planner 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。