Skip to content

Conversation

@odesenfans
Copy link
Collaborator

@odesenfans odesenfans commented Oct 28, 2025

Counting matching messages slows down queries /messages by several seconds because the messages table is too large. This PR mitigates the problem by adding a cache in front of DB queries in order to reduce the average load on CCNs while keeping exact message counts.

The default cache TTL is 5 minutes but can be configured through the new perf.message_count_cache_ttl config value.

Counting matching messages slows down queries /messages by several
seconds because the messages table is too large.
This PR mitigates the problem by adding a cache in front of DB
queries in order to reduce the average load on CCNs while keeping
exact message counts.

The default cache TTL is 5 minutes but can be configured through
the new perf.message_count_cache_ttl config value.
@odesenfans odesenfans changed the title perf: use estimated counts for /messages perf: cache message count queries Oct 29, 2025
@odesenfans odesenfans force-pushed the od/perf-count-queries-in-messages branch from f2408fd to ef8edb9 Compare October 29, 2025 11:20
Copy link
Collaborator

@amalcaraz amalcaraz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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.

3 participants