-
Notifications
You must be signed in to change notification settings - Fork 883
The coder server cache dir defaults to /tmp
, should be ~/.cache
#2534
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
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 |
@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 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 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. |
Yup, this is my workaround for now: #!/bin/sh
echo "Generating coder server cache..."
set -euxo pipefail
if [ -z $CODER_CACHE_DIRECTORY ]; then
echo "CODER_CACHE_DIRECTORY unset, exiting..."
exit
fi
timeout 120 /opt/coder server >/dev/null 2>&1 &
until [ -d $CODER_CACHE_DIRECTORY/site ] || [ ! -d /proc/$! ]
do
echo "Waiting for $CODER_CACHE_DIRECTORY/site..."
sleep 5
done
echo "Detected coder server cache!"
sleep 2 It's not ideal, but it seems to have worked so far. |
I occasionally lose my |
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, otherwiseXDG_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 startupOriginally posted by @deansheather in #2533 (comment)
The text was updated successfully, but these errors were encountered: