Context
I write rails applications by caching a fragment of a page in production (saving the html result of a certain fragment to avoid rebuilding it).
The usual way to do this is to save the fragment in memcache or redis. The default caching option in rails is to use FS caching (saving a fragment as a file), since it has the advantage of having no dependencies (you do not need to configure memcache or redis). This is a less popular option because it is slower than memory caching, and you must clear your cache manually, while you can rely on old keys that will be automatically cleared using memcache or properly configured redis.
Question
After using dockers for some time, I understand that clearing previous cache files is no longer a problem: when deploying, a new container starts, automatically discarding all previous cache files. This is probably slower than memory usage, of course, but it has the advantage of not requiring any configuration, which is pretty cool when loading fast side projects.
But then I ask myself: does fs actually write to fs in the container, or does it write to RAM instead? This is troubling, as it will mean that using it can very quickly saturate RAM, especially with many projects on the same server.
source share