redpanda-data / redpanda-data/connect
Add random jitter for cache ttl
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 8.8k
- Forks
- 969
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 64
Description
I am currently using the leveled cache feature to build a 2 level cache with memory and sql cache.
As all my messages comes at a fixed rate, the access to the cache entries are at the same rateas well, resulting all the in memory cache entries expire all toegtehr at the same time and hence sending requests to sql server at the same time.
This create a spike traffic to the database, which is not favorable due to performance issues.
It can be solved to add random jitters for the ttl. I tried to add it in the ttl option in cache processor with random values created in bloblang, but it seems like this option does not work for entries set automatically by the read through mechanism using theleveled cache.
Extend the function of default_ttl can be a solution, we can add an option like default_ttl_jitter to randomize the ttl created by leveled cache.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the leveled cache read-through path and how the cache processor applies default_ttl; the issue names no source files or tests. Done means automatically created entries can receive randomized TTLs through a new default_ttl_jitter-style option, preventing synchronized expiration and database traffic spikes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100