Skip to content

Conversation

@pierreln-dd
Copy link
Contributor

@pierreln-dd pierreln-dd commented Jan 16, 2026

What does this PR do?

Address memory issues affecting customers monitoring multiple PostgreSQL instances.
Changes implemented based on profiler data showing top memory consumers.

Changes:

  • Add LRU cache to degeneralise_tag
  • Strip query text from _previous_statements cache
  • Set num_workers=1 in ConnectionPool to reduce thread overhead

Motivation

Customer-reported Memory increase issue

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.
  • If you need to backport this PR to another branch, you can add the backport/<branch-name> label to the PR and it will automatically open a backport PR once this one is merged

pierreln-dd and others added 2 commits January 16, 2026 11:58
Address memory issues affecting customers with 200+ PostgreSQL instances.
Based on profiler data showing top memory consumers.

Changes:
- Add LRU cache to degeneralise_tag (was #1 consumer at ~890 MiB)
- Strip query text from _previous_statements cache (~376 MiB savings)
- Set num_workers=1 in ConnectionPool to reduce thread overhead

Test results (60 instances, 1GB limit, 33 min):
- Memory: 964 MiB → 726 MiB (-25%)
- Threads: 220 → 164 (-25%)
- Stable memory vs creeping baseline

Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add tests to verify the LRU caching behavior of degeneralise_tag:
- Caching returns consistent results for same inputs
- Cache key includes check name to prevent collisions
- Tags without values are handled correctly
- Cache statistics are available and functioning

Co-Authored-By: Claude Opus 4.5 <[email protected]>
@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.01%. Comparing base (3d4cf86) to head (859ca37).

Additional details and impacted files
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants