-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
High RAM usage when proxying WebDAV (& possibly normal traffic as well) #1310
Comments
@coderobe I'm not familiar with WebDAV but I guess those 50GB of data you tried to proxy where within a single request right? Edit: See #1314 |
@lhecker this sounds amazing 👍 |
@lhecker Nice work! However i'm not sure how the davfs driver on linux bundles requests, if at all - and i think it does one request per file - my issue appeared with lots of files from 1 to 50 MB in size each |
The 2GB for a 50GB file transfer are cute, for me, caddy goes up 14GB RAM usage and crashes, after 8.6GB of a 11.2GB file. Not really what I want :D |
@jcgruenhage @coderobe Do you have the ability to build from source? Would love it if you could try the PR linked above and see if it resolves the issue. |
I should be able to figure that out, I'll see when I find time to try that. |
|
You might need -u to update it if you already had it downloaded. Make sure
to check out the branch with the PR.
|
after checking out the branch,
As soon as I switch back to master, it works (go get, not getting the binary from the source code of the PR) again. Am I doing something wrong? Could you just send me a linux x64 binary? |
After you check out the branch, you should not need to run go get - once you've run |
ahhh my bad I was on dynamic-proxy and not unbuffered_proxy. No wonder it did not work :D |
Okay, I still can not complete the upload, but only because there is another caddy instance I can not update (I tried to copy the binary into the docker container, but it won't start up afterwards) in between the uploading computer and nextcloud. The local caddy proxy stays at 0.1% RAM usage. |
I don't know about Docker but maybe setting the env var CGO_ENABLED=0 and re-compiling will help? 🤷♂️ Anyway, it sounds like it has helped though? |
Yes, it helped :) |
When I add |
Not sure -- but you'd want that env variable set when you compile Caddy, not when you run it. |
installing |
Just switched to the new container, I can now confirm, that caddy uses just about 9.4 MB of RAM during the transfer. Thanks for the PR @lhecker ! Edit: should anyone be interested in the container, you can find the it under https://hub.docker.com/r/jcgruenhage/docker-source-caddy/ with the tag unbuffered_proxy, latest and v0.9.4 will use v0.9.4, and I will update latest to newer caddy releases when they come out. While there are containers that are smaller, I think 50MB (20MB when compressed) is small enough :D |
Glad to hear it's working for you as well, @jcgruenhage! |
1. What version of Caddy are you running (
caddy -version
)?Caddy 0.9.4
2. What are you trying to do?
Proxy an entire (sub)domain through to another server (which mostly handles WebDAV)
3. What is your entire Caddyfile?
4. How did you run Caddy (give the full command and describe the execution environment)?
I'm using systemd to start Caddy & the command the systemd unit executes is
/usr/bin/caddy -log stdout -agree=true -conf=/srv/www/Caddyfile -root=/var/tmp -email hostmaster@example.com -quic
5. What did you expect to see?
Caddy serving/proxying the service as usual
6. What did you see instead (give full error messages and/or log)?
High RAM usage
In Idle state, caddy uses about 100M of RAM,
After starting a big WebDAV operation that was going through the proxy it jumped to about 1G,
10 minutes later it was at 2G and shortly after the (successfully) proxied operation finished the memory usage went back down to about 100M again.
7. How can someone who is starting from scratch reproduce this behavior as minimally as possible?
Although this can probably be reproduced easier, my setup was:
nginx serving a (fresh) Nextcloud instance on 10.10.10.10:81 (lan) (http (no TLS)),
Caddy proxying the connection as shown in the Caddyfile,
Then i mounted the Nextcloud instance locally using WebDAV & pushed about 50G through (with a gbit uplink)
IIRC the memory usage started jumping high after a few gigs already
The text was updated successfully, but these errors were encountered: