Repository navigation
net/netmon: Allow excluding custom interfaces - #14575
Open
craciunoiuc wants to merge 2 commits into
Open
craciunoiuc wants to merge 2 commits into
craciunoiuc wants to merge 2 commits into
Conversation
Iterating interfaces happens unrelated to the previous problematic interface check. Check here also to save time on initialization. Updates tailscale#1552 Signed-off-by: Cezar Craciunoiu <[email protected]>
Providing a regex env variable ensures that any other specific interface that interferes with tailscale can be disabled on startup. Updates: tailscale#1552 Signed-off-by: Cezar Craciunoiu <[email protected]>
craciunoiuc
force-pushed
the
craciunoiuc/no-query-ifs-regex
branch
from
January 8, 2025 15:37
ea00478 to
bc5bb1d
Compare
|
Any updates on this? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In order to be able to exclude interfaces currently you need to hardcode the name of the interface like in https://github.com/tailscale/tailscale/blob/main/net/netmon/state.go#L37 or do tricks denying IP addresses through
systemdReasoning
As the code that does this runs on
initand does not have access directly to the config, the only way to provide input there is through an environmental variable. This variable should be a regex such that people can catch complex interface patterns.Personal Use Case
We are running Tailscale on a server which has several tens of thousands of active interfaces. These are correctly filtered out by tailscale, but in order for Tailscale to build state when first started, it requires 10+ minutes and multiple GBs of RAM.
A quick experiment with 2000 created interfaces gave the following results:
Memory
2.2GB in use memory. Out of which:
1GB - message buffers from interfaces
0.3GB - interfaces list
48.6GB allocated memory. Out of which:
2.6GB - List of interfaces
8GB - Interfaces state
7.7GB - Interface ip/gateways
CPU Time
1 minute CPU time (10 minutes total since start):
19% time - Getting interface state
18% time - Getting interface ip/gateway mappings
46% time - Getting endpoints of interfaces
Flamegraph of Tailscale before applying the patch:

Flamegraph of Tailscale after applying the patch:

CPU Time reduced on boot from 66 seconds to 0.5 seconds.
Related Work
There were several other attempts at excluding interfaces [1], which can all be seen in the issue tracking everything #1552
Let me know what you think, thanks 🙏
[1] #8682