cloudflare / pingora

A library for building fast, reliable and evolvable network services.
Apache License 2.0
20.28k stars 1.1k forks source link

Disk cache #210

Open lewisl9029 opened 2 months ago

lewisl9029 commented 2 months ago

What is the problem your feature solves, or the need it fulfills?

Looks like pingora already provides a memory-cache module, but I suspect memory caching may be cost prohibitive for a lot of folks currently using something like NGINX, which caches to disk by default.

Describe the solution you'd like

Would be great to see a disk-cache module in addition to the memory-cache module!

Describe alternatives you've considered

We could always implement custom disk caching modules in user-land since pingora is so extensible, and the fact that the current memory-cache module is already abstracted behind a generic interface probably makes this even easier. But having off-the-shelf disk-caching would make it a lot easier to migrate existing NGINX-based workloads and help accelerate adoption.

Additional context

The fact that there's no disk-cache module in pingora makes me super curious about how Cloudflare handling caching with pingora today. Is all caching done in-memory (sounds expensive!)? Or maybe you have dedicated disk caching services living outside of the pingora proxies themselves? Would love to learn more. May be a good blog post topic? :)