Donal McBreen - Solid Cache: A disk backed Rails cache - Rails World 2023

Discover Solid Cache: a disk-backed Rails cache solution that reduces memory usage, increases cache size, and achieves 50-50 slower operation speed compared to Redis and Memcache.

Key takeaways
  • Disk-backed cache: Developed a cache that stores data on disk to reduce memory usage and increase cache size.
  • Simple to install: Aimed for a plug-and-play experience with minimal infrastructure requirements.
  • Database agnostic: Designed to work with multiple databases, including MySQL, PostgreSQL, and SQLite.
  • Cache size and fragmentation: Developed a strategy to estimate cache size and avoid fragmentation.
  • Expire data: Implemented a probabilistic least recently used algorithm to expire data from the cache.
  • Efficiency: Achieved a 50-50 slower operation speed compared to Redis and Memcache.
  • Performance: Reported a 10-fold increase in cache performance on Basecamp, with a miss rate of 7.5%.
  • Override: Allows overriding of cache expiration to prioritize certain items.
  • Querying: Utilizes database indexing to quickly locate cache data.
  • Encryption: Supports encryption for secure data storage.
  • Monitoring: Provides monitoring capabilities to track cache performance and optimize cache size.
  • Sharding: Supports sharding to distribute cache data across multiple databases.
  • Conclusion: Concluded that a disk-backed cache can be a viable alternative to in-memory caches like Redis and Memcache, providing a simpler and more cost-effective solution.