-
Notifications
You must be signed in to change notification settings - Fork 5
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
Use mbuffer to smooth things out #16
Conversation
Thanks for this. Could you elaborate about the problem this is solving? I'm not keen on adding external dependencies unless the benefit is substantial and |
Sure. I don't know about Linux, but you're right that its not part of the FreeBSD base. The notion is that is helps keep the network stream as fast as possible, while reading from/to storage can ebb and flow. Its not uncommon for a TCP stream, once it slows down due to congestion, to never (or very slowly) ramp back up. This is less noticeable on fast local networks but is very noticeable over more latent connections such as internet. |
While I am sure using mbuffer can greatly improve the transfer, I think one should test whether it exists or not before using it, so it does not become a hard dependency. |
Sorry for the delay. Adding a check to see if mbuffer is installed and then optionally using it sounds like a reasonable approach. Package maintainers can then choose to add mbuffer as a dependency. I could make it an option for the FreeBSD port. I'm swamped with a few things, but will get to this soon. Thanks, Joe |
I still have concerns. mbuffer has to be installed on both the sender and receiver and the memory usage must be tuned. When testing, mbuffer warned me about using half of my available memory.
Apologies for the delay. I created a branch with optional mbuffer support. https://github.com/Jehops/zap/compare/mbuffer?expand=1 I'm still on the fence due to the concerns expressed in the commit log. Do you have suggestions for tuning the memory usage? |
What about a : ${MBUFFER_OPTS:='-s 128k -m 1G'} so the user can easily override it. |
Can't we simplify the whole thing by providing some variables and a mbuf=$(command -v mbuffer)
mbuf_pipe=
if [ -n "$mbuf" ]; then
: ${MBUFFER_OPTS:='-s 128k -m 1G -q'}
mbuf_pipe="mbuffer $MBUFFER_OPTS | "
fi
zfs_send() {
if [ -n "$mbuf" ]; then
zfs send "$@" | mbuffer $MBUFFER_OPTS
else
zfs send "$@"
fi
} then use ssh "$sshto" "sh -c '${mbuf_pipe}zfs recv -Fu $v_opt -d $rloc'" as well as in all echo "zfs send -Lep $C_opt $lsnap | ${mbuf_pipe}ssh $sshto \"sh -c '${mbuf_pipe}zfs recv -Fu |
I like this. Probably what I should've submitted in the first place.
|
IMHO computing values using current free memory amount should be let to the user. Wiith The default |
I'll give this a shot hopefully over the weekend. I had a conversation about this with a colleague, @wahjava, and he had another good suggestion. We could make it even more generic to allow the user to choose any filter. He mentioned |
For example, users can set the environment variable ZAP_FILTER="mbuffer -s 128k -m 10M" and zap will filter 'zfs send' and 'zfs receive' through mbuffer.
Hello both, Does the implementation in the filter branch meet your needs? https://github.com/Jehops/zap/compare/filter?expand=1 Any testing you can do would be appreciated. Joe |
I'm good with this. |
Same here, thanks! |
Thanks both. I will merge the filter branch after a few days of running it through my backups with different filters. |
For example, users can set the environment variable ZAP_FILTER="mbuffer -s 128k -m 10M" and zap will filter 'zfs send' and 'zfs receive' through mbuffer.
Wrap the transfer in buffers to make it less bursty