mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 23:07:44 +00:00
ipn/{ipnlocal,localapi}, cli: add debug force-netmap-update
For loading testing & profiling the cost of full netmap updates. Updates #1909 Change-Id: I0afdf5de9967f8d95c7f81d5b531ed1c92c3208f Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
75dbd71f49
commit
04fabcd359
@ -138,6 +138,11 @@
|
||||
Exec: localAPIAction("break-derp-conns"),
|
||||
ShortHelp: "break any open DERP connections from the daemon",
|
||||
},
|
||||
{
|
||||
Name: "force-netmap-update",
|
||||
Exec: localAPIAction("force-netmap-update"),
|
||||
ShortHelp: "force a full no-op netmap update (for load testing)",
|
||||
},
|
||||
{
|
||||
Name: "control-knobs",
|
||||
Exec: debugControlKnobs,
|
||||
|
@ -2133,6 +2133,23 @@ func (b *LocalBackend) DebugNotify(n ipn.Notify) {
|
||||
b.send(n)
|
||||
}
|
||||
|
||||
// DebugForceNetmapUpdate forces a full no-op netmap update of the current
|
||||
// netmap in all the various subsystems (wireguard, magicsock, LocalBackend).
|
||||
//
|
||||
// It exists for load testing reasons (for issue 1909), doing what would happen
|
||||
// if a new MapResponse came in from the control server that couldn't be handled
|
||||
// incrementally.
|
||||
func (b *LocalBackend) DebugForceNetmapUpdate() {
|
||||
b.mu.Lock()
|
||||
defer b.mu.Unlock()
|
||||
nm := b.netMap
|
||||
b.e.SetNetworkMap(nm)
|
||||
if nm != nil {
|
||||
b.magicConn().SetDERPMap(nm.DERPMap)
|
||||
}
|
||||
b.setNetMapLocked(nm)
|
||||
}
|
||||
|
||||
// send delivers n to the connected frontend and any API watchers from
|
||||
// LocalBackend.WatchNotifications (via the LocalAPI).
|
||||
//
|
||||
|
@ -557,6 +557,8 @@ func (h *Handler) serveDebug(w http.ResponseWriter, r *http.Request) {
|
||||
err = h.b.DebugBreakTCPConns()
|
||||
case "break-derp-conns":
|
||||
err = h.b.DebugBreakDERPConns()
|
||||
case "force-netmap-update":
|
||||
h.b.DebugForceNetmapUpdate()
|
||||
case "control-knobs":
|
||||
k := h.b.ControlKnobs()
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
|
Loading…
x
Reference in New Issue
Block a user