iliana / before

🩸 Do you remember before? 🩸
https://before.sibr.dev
5 stars 5 forks source link

Write or migrate to a more optimal event stream cache implementation #18

Open iliana opened 3 years ago

iliana commented 3 years ago

Event stream caching is implemented through a Mutex<LruCache> (https://docs.rs/lru/0.6.6/lru/struct.LruCache.html). Ideally this would be an RwLock so that the cache is only locked when adding a new object, however LruCache::get takes &mut self in order to update the LRU list.

I think this might be leading to some lock contention under heavier load. We should replace the cache with something better fit for this purpose.