mirror of
https://github.com/fatedier/frp.git
synced 2026-05-15 08:05:49 -06:00
[GH-ISSUE #2534] Low Bandwidth, Configurable TCP/IP KeepAlive for server and client code <-> in **golib** net and mux #2011
Labels
No labels
In Progress
WIP
WaitingForInfo
bug
doc
duplicate
easy
enhancement
future
help wanted
invalid
lifecycle/stale
need-issue-template
need-usage-help
no plan
proposal
pull-request
question
todo
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/frp#2011
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @adioanca on GitHub (Aug 18, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2534
The solution you want
Low Bandwidth, Configurable TCP/IP
KeepAlivefor server and client code <-> in golibnetandmuxAlternatives considered
Have previously played with options in frp[sc]-full.ini
there is a 15sec
TCP KeepAlive sequenceenabled by golang'snetmodule. This adds a lot, 4 packets on the wire every 15 seconds; tcp/http Keep-Alive(s) added on top.would like to keep idle bandwidth down, with TCP connections opened for minutes/hours/days
NOTE I'm a go beginner, would like some help in converting this into a feature, or a configurable option, or just disable TCP Keep-Alive. This a complete hack with some code I've found across the net.
Ref: https://stackoverflow.com/questions/46686360/difference-of-dialcontext-keepalive-and-transport-idletimeout-of-go-http-client?answertab=active#tab-top
Ref: https://thenotexpert.com/golang-tcp-keepalive/
Ref: some other place I can't find now
How to implement this function
with
in
vendor/github.com/fatedier/golib/net/proxy.gofor the clientand
with
in
vendor/github.com/fatedier/golib/net/mux/mux.gofor the serverApplication scenarios of this function
Need the entire frp solution to consume network bandwidth at a minimum. Fo example we'd like to test with heartbeats(as captured by
tcpdump) at 15min, 30m, 1h, 2h, 1d, etc. This would give as a compromise between network bangwidth consumption VS responsiveness.@fatedier commented on GitHub (Aug 18, 2021):
TCP KeepAlive package may only consume 64 byte traffic and will not be sent if there are already traffics in connections.
frp also has app-level heartbeat to ensure it works fine, you can specify heartbeat interval in configuretion file.
If you really care about traffic like 100KB, this project may be not suitable for your scenario.
@adioanca commented on GitHub (Aug 22, 2021):
3 days test looks great. under 30kb/day with hearbeat put at 3600 and TCP KeepAlive(s) back to OS default of 7200 sec.
Thank you for this project.
Let me know if want to see the changes that were done - in a nutshell: refatored the code from above and changed a couple hardcoded values in frp source code.
PS: do you foresee any problem if we bump the heartbeat interval from 3600 to 86400 sec? (will disable TCP KeepAlive of course) - this would be usefull in a closed (V)LAN/network
@fatedier commented on GitHub (Aug 23, 2021):
If you can make sure there will be no network error in your environment, any heartbeat interval is ok.
@adioanca commented on GitHub (Aug 23, 2021):
Cool. Thanks.
I'll close this issue, as the talk and changes from above, plus 3-4 days test with heartbeat @1h and TCP KeepAlives @7200 would get us under 30KB/day idle traffic and that fulfills the *low bandwidth" requirement.