Skip to content
This repository has been archived by the owner on Apr 18, 2021. It is now read-only.

Support caching in memory? #21

Open
nottrobin opened this issue Mar 19, 2018 · 4 comments
Open

Support caching in memory? #21

nottrobin opened this issue Mar 19, 2018 · 4 comments

Comments

@nottrobin
Copy link

Static content will not see great benefits.

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.

@nicolasazrak
Copy link
Owner

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 😄

@nottrobin
Copy link
Author

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.

@ahoeg
Copy link

ahoeg commented Jun 21, 2019

Instead of cache to disk just mount tmpfs to that path?

@sillygod
Copy link

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).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants