I have an efficient C# application that receives 80 bytes of data at a rate of 5k to 10k records per second on a multi threaded CPU.
I need to now set up a in memory-cache to detect and filter duplicate records so I can suppress them from travelling further in the pipeline.
Cache specs (maximum thresholds)
- 80 bytes of data
- 10,000 records / second
- 60 Seconds of cache = Key quantity = 60,000
- (sub total 48000000 bytes = 48Mb )
- Ideal cache size = 5 minutes (or 240Mb)
- Acceptable runtime cache size bloat = 1 GB
Question
What is the best way to set up an in-memory cache, dictionary, hashtable, array, etc that will allow the most efficient lookups, purging of old cache data, and prevent expiration of data that is hit.
I looked at ASP.Net Cache, System.Runtime.MemoryCache but think I need something more lightweight and customized to achieve correct throughput. I'm also looking at the System.Collections.Concurrent as an alternative and this related whitepaper.
Does anyone have suggestions on what the best approach would be?