You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
The coder server cache dir defaults to /tmp, should be ~/.cache #2534
Storing cache in /tmp is not ideal since it will be wiped on system restarts, as such I'm proposing we move it to ~/.cache as per Deans suggestion.
EDIT: We might also consider defaulting to ~/Library/Caches on macOS, otherwise XDG_CACHE_DIR if set. If there's an equivalent on Windows, consider using that.
cacheDir defaults to /tmp/ on my system. We should probably change that to not use /tmp at all and instead use ~/.cache so we're not dumping 300MB into RAM on startup
This would be great as Coder server averages around only 200MB of ram usage, but requires me to allocate 512MB on startup, which raises VM costs. Even something like coder server extract-cache would be useful for running during Docker builds instead of runtime.
Edit: unrelated but does the extracting of the .tar.zst leak? Memory usage hovered around 200MB after extracting, but if it was not extracted, it hovers around 90MB.
@kotx If you want a quick fix for changing the folder, you can set this in your Dockerfile today:
ENV CODER_CACHE_DIRECTORY=/data/cache
This would be great as Coder server averages around only 200MB of ram usage, but requires me to allocate 512MB on startup, which raises VM costs. Even something like coder server extract-cache would be useful for running during Docker builds instead of runtime.
It's not a bad idea, although it sounds like your scenario would benefit more from not using the full binary (that bundles binaries for all platforms). In the build process, we create binaries called "slim", you could use a slim binary for running coder server and manually place the slim binaries in /data/cache/site/bin/ (or whichever path you define).
Unfortunately, we currently don't have a slim bundle available for download as part of a release.
(PS. Feel free to open a ticket about this feature, or request slim binaries in releases, or both.)
Edit: unrelated but does the extracting of the .tar.zst leak? Memory usage hovered around 200MB after extracting, but if it was not extracted, it hovers around 90MB.
Edit: How are you measuring the memory usage, btw? I wonder if what you may be seeing is the systems filesystem cache being used?
Filesystem cache is definitely possible, I was just checking the memory usage metric on Fly.io which measure the whole VM. So there probably isn't a leak.
I occasionally lose my https://coder-access-url/bin/ folder when I update my Coder deployment (dpkg -i coder.deb && systemctl restart coder). @mafredri and I chatted and suspect this is the issue. I'll report back if changing the cache dir helped
Activity
kotx commentedon Aug 20, 2022
This would be great as Coder server averages around only 200MB of ram usage, but requires me to allocate 512MB on startup, which raises VM costs. Even something like
coder server extract-cachewould be useful for running during Docker builds instead of runtime.Edit: unrelated but does the extracting of the .tar.zst leak? Memory usage hovered around 200MB after extracting, but if it was not extracted, it hovers around 90MB.
mafredri commentedon Aug 20, 2022
@kotx If you want a quick fix for changing the folder, you can set this in your Dockerfile today:
It's not a bad idea, although it sounds like your scenario would benefit more from not using the full binary (that bundles binaries for all platforms). In the build process, we create binaries called "slim", you could use a slim binary for running
coder serverand manually place the slim binaries in/data/cache/site/bin/(or whichever path you define).Unfortunately, we currently don't have a slim bundle available for download as part of a release.
(PS. Feel free to open a ticket about this feature, or request slim binaries in releases, or both.)
I do get ~90MB even with extraction. The relevant code lives here https://github.com/coder/coder/blob/57f3410009201df2038f06a65c796e9690c2e617/site/site.go/#L583-L630 and I can't see anything that would cause a leak (assuming it's not in the library). Which platform are you running
coder serveron? (I tested in a docker container based on Alpine, running on amd64.)Edit: How are you measuring the memory usage, btw? I wonder if what you may be seeing is the systems filesystem cache being used?
kotx commentedon Aug 20, 2022
Filesystem cache is definitely possible, I was just checking the memory usage metric on Fly.io which measure the whole VM. So there probably isn't a leak.
kotx commentedon Aug 20, 2022
Yup, this is my workaround for now:
https://github.com/kotx/coder-fly/blob/master/make-cache.sh
It's not ideal, but it seems to have worked so far.
bpmct commentedon Aug 22, 2022
I occasionally lose my
https://coder-access-url/bin/folder when I update my Coder deployment (dpkg -i coder.deb && systemctl restart coder). @mafredri and I chatted and suspect this is the issue. I'll report back if changing the cache dir helpedfix: Update default cache directory
fix: Update default cache directory (#4175)