Skip to content

Add cache size for unknown requests in consensus handler - #770

Merged
yashnevatia merged 2 commits into
mainfrom
add-cache-size-for-unknown-req
Sep 21, 2026
Merged

yashnevatia merged 2 commits into
mainfrom
add-cache-size-for-unknown-req

Conversation

@yashnevatia

@yashnevatia yashnevatia commented Sep 16, 2026

Copy link
Copy Markdown
Contributor
  • Add max cache size to unknownRequest cache
  • Earlier we had a very short TTL, hence this was not required
  • Now we have a TTL based on average capability requestTimeout
  • So, in addition to time based eviction, we are adding space limits

pavel-raykov
pavel-raykov previously approved these changes Sep 16, 2026
request := s.requests.Get(id)
if request == nil {
if s.maxUnknownRequestsCacheSize > 0 && len(s.unknownRequestsResultByID) >= s.maxUnknownRequestsCacheSize {
if oldest := s.unknownRequestsOrderedByTimeout.Front(); oldest != nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It would be nice to have visibility into the size of the unknown requests cache.
I'm ok with logging on evictiond due to overflow or a metric

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added log line

@cl-sonarqube-production

Copy link
Copy Markdown

@yashnevatia
yashnevatia added this pull request to the merge queue Sep 21, 2026
Merged via the queue into main with commit 662b57d Sep 21, 2026
20 checks passed
@yashnevatia
yashnevatia deleted the add-cache-size-for-unknown-req branch September 21, 2026 13:46
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.

4 participants