Query cache does not clean and causes memory leak
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
In my case i`m executed dynamic generated queries uses Dapper. In production my service uses a lot of memory (~9 GB). I took a memory dump of the process and saw that dapper saved more than a million requests in the query cache. Based on this dump, I calculated the statistics of the number of objects depending on the hitCount https://gist.github.com/denisenko93/9155653319c43b846ace302d6aa3581c
I suggest using MemoryCache as a query cache and making the cache lifetime a dapper setting. Or make the COLLECT_HIT_COUNT_MIN constant available for user change
Contributor guide
No contributing guide indexed for this repository
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
The issue names no files or tests. Start by locating Dapper's query-cache implementation and the COLLECT_HIT_COUNT_MIN constant, then compare the current retention behavior with the proposed MemoryCache and configurable-lifetime alternatives. Done should include a decided eviction policy and evidence that dynamically generated queries no longer cause unbounded cache growth.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100