Skip to content

Concept - Unpopular cache items don't forward propagate #53

Description

@Turnerj

https://blog.cloudflare.com/why-we-started-putting-unpopular-assets-in-memory/

For Cloudflare, they wanted to prevent unnecessary writes to SSDs to keep them around longer so they didn't want to have unpopular cache items in their SSD cache. On top of the lifetime benefits, it also increased overall performance as writes-while-reading slows down individual chips on an SSD.

While CacheTower is unaware of the storage medium, it would be interesting to implement a similar approach. If we track how often an item in the cache is hit, we can track whether we should even back populate it from in-memory to whatever other cache layers are configured.

This can prevent unnecessary writing and storage for "one-hit-wonders" in deeper layers of the cache stack. If you are using Redis, it would take pressure off the Redis server. If you are using Disk, it would take pressure off the disk.

At minimum we would need:

  • To track every cache access (As a uint perhaps?)
  • Update back populate logic to check if cache access is often or not

Considerations:

  • Does this only work for in-memory cache?
  • If not, does this work just for the first cache layer?

Activity

  1. added this to the v1.0 milestone on May 12, 2020
  2. Turnerj commented on May 14, 2020

    @Turnerj
    MemberAuthor

    As an aside to this, potentially establishing an Least Recently Used (LRU) eviction strategy. While I can't measure the memory used in the cache (I don't serialize it, I just reference it), maybe there is some backend API I can use to gauge memory usage? Or just do it dumbly by the number of items?

  3. changed the title [-]Concept - Unpopular cache items don't back populate[/-] [+]Concept - Unpopular cache items don't forward propagate[/+] on May 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions