Skip to content

fix(performance): resolve OOM errors on the homepage#49

Open
paulswartz wants to merge 30 commits into
mainfrom
fix/homepage-oom-leak-18263362913045023417
Open

fix(performance): resolve OOM errors on the homepage#49
paulswartz wants to merge 30 commits into
mainfrom
fix/homepage-oom-leak-18263362913045023417

Conversation

@paulswartz

Copy link
Copy Markdown
Owner

This fixes an Out Of Memory (OOM) error that occurs when the homepage is under heavy load. The issue happens because the large conn struct (bloated by plug(:alerts) at the top of the file) was being captured in closures provided to async_assign_default.

In this patch:

  • Explicit assignments that run synchronously (banner, fares, promoted, and remainder) have been switched to assign instead of async_assign_default.
  • The async assignment closure for event_teasers no longer captures conn.assigns.date, relying instead on a variable pulled out synchronously before the pipeline starts.
  • Redundant alert assignment (async_assign_default(:alerts, ...) in index/2) has been removed, as the plug(:alerts) performs exactly this duty.

PR created automatically by Jules for task 18263362913045023417 started by @paulswartz

renovate Bot and others added 29 commits May 2, 2024 20:47
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…r ^7.11.0 (#7)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
The `conn` struct was inadvertently captured by asynchronous assignments
within the `PageController` logic, primarily for the event teasers
and previously for alerts. With alerts being fetched synchronously by the plug,
and async assignment for other tasks, the large `conn` size was causing
memory bloat and OOMs. This commit pulls `date` out before the closure,
and makes `banner` and other synchronous assignments explicitly use `assign`
rather than `async_assign_default`.

Co-authored-by: paulswartz <214921+paulswartz@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@paulswartz

Copy link
Copy Markdown
Owner Author

@jules rebase onto latest main

This fixes an Out Of Memory (OOM) error that occurs when the homepage is under heavy load. The issue happens because the large conn struct (bloated by plug(:alerts) at the top of the file) was being captured in closures provided to async_assign_default.

In this patch:
- Explicit assignments that run synchronously (banner, fares, promoted, and remainder) have been switched to assign instead of async_assign_default.
- The async assignment closure for event_teasers no longer captures conn.assigns.date, relying instead on a variable pulled out synchronously before the pipeline starts.
- Redundant alert assignment (async_assign_default(:alerts, ...) in index/2) has been removed, as the plug(:alerts) performs exactly this duty.

Also includes upgrading asdf-vm/actions/install to v3 to resolve CI error.

Co-authored-by: paulswartz <214921+paulswartz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant