Open nottrobin opened 6 years ago
I did it once, but after doing a simple benchmark, it didn't improve the performance a lot. It seems that the operating system keeps a lot of buffers in memory so when you read the same file it doesn't have to go to disk.
Creating a new storage shouldn't be that hard, there is an interface for it (https://github.com/nicolasazrak/caddy-cache/blob/master/storage/response_storage.go), but it has to be benchmarked to check it's working as expected and it performs as expected. PR are welcome 😄
Yep fair enough, I agree it should be benchmarked. I have never worked in go, so I don't see myself having time to work out how to submit a PR any time soon I'm afraid.
Instead of cache to disk just mount tmpfs to that path?
Recently, I revise this repo to be consistent with the caddy 2's structure and support in_memory. In my experiment, caching in memory is actually more efficient. Anyone is interested can see this (https://github.com/sillygod/cdp-cache#test-result).
Would it be possible to add an option to store the cache in memory instead of in disk? This could presumably improve performance so that you then would see performance improvements, even for static content.