Repository navigation
perf(controller): stop re-reading every definition every 5 s - #308
Conversation
The definition reconciler came back to every RD every five seconds, settled or not, and each pass read the RD, its replicas, its group and the nodes past the cache. On a field cluster with 180 definitions that is about 80 API requests a second and most of the 0.6 core the controller used with nothing happening. The requeue was a cache-warmup net from when the witness decision read replicas from the cache; it reads them uncached now. A settled RD now waits for its next event. What the decision reads that has no event of its own gets one: a node that joins, or whose type or AutoplaceTarget opt-out changes, brings the RDs back as a drain flag already did, and so does a group's creation. The two witness deadlines (the suppression after a witness delete and the keep-tiebreaker window) bring the RD back when they pass, and a witness create deferred because its candidate vanished asks for the next pass itself. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
An RD whose stack lacks a layer of its group's carries the unapplied-group annotation, and its own pass drops the annotation once the group is gone. The group watch filtered out deletes, counting on the five second requeue to read the group as gone; with that requeue removed the annotation stayed for good. REST refuses to delete a group that RDs name, but the CR can be deleted directly, so the group watch now passes deletes too. They are rare and map only to the RDs that name the group. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The RD pass stamps the resize-pending annotation on each replica whose usable size lags the definition, writing over the cached copy, so a conflict with the satellite's own write is common. The failure was logged as skipped, and the five second requeue tried again; with that requeue gone nothing did until the next event for the RD. A failed stamp now asks for the RD to come back after the same five seconds. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
The comment on the node map function still named the drain-flag predicate the node watch used before it also passed joining nodes and the fields the witness pick reads. Assisted-by: LLM Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Aleksei Sviridkin (lexfrei)
left a comment
There was a problem hiding this comment.
On main the pass reads nothing that lacks an event or a deadline. Replica spec goes through the Resource watch, and the node fields the witness pick reads go through witnessCandidacyChanged. The two witness deadlines requeue, and the deferred create and the failed resize stamp ask for a retry. Nothing blocking.
Two open PRs still lean on the 5 s requeue, and only one of them says so. #303's placement hold needs nextTiebreakerDeadline to read it, as its description notes. #307 skips a witness node while a survivor's kernel still holds the old connection, and comes back on the 5 s requeue once the survivor runs del-peer. That drop is a status-only Resource write, which resourceEventFilter does not pass, so after both merge the definition stays without a witness until the informer resync. Whichever of the two lands second needs an askRDRetry for that case.
What this fixes
On the test cluster the blockstor controller used about 0.6 core with nothing happening, at 180 resource definitions and 410 replicas. The definition reconciler came back to every RD every five seconds, settled or not, and each pass read the RD, its replicas, its group and the nodes past the informer cache. In a benchmark with the same shape (3 nodes, 115 definitions, 345 replicas) that is 90 API requests a second from the controller while nothing changes. LINSTOR's controller does nothing for a definition until something about it changes.
The five second requeue was a cache-warmup net from when the witness decision read the replicas from the cache, so a pass that came right after the second replica was created could miss it. The decision reads the replicas past the cache now, and the replica's creation is itself an event.
Changes
AutoplaceTargetopt-out changes, brings the RDs back, as a drain flag already did, so a 2-diskful RD still gains the witness a third node allows. A group's creation brings back the RDs that name it, so an RD created before its group is still pinned to the group's stack, and so does its deletion, so the RDs drop the unapplied-group annotation. REST refuses to delete a group RDs name, but the CR can be deleted directly.Behaviour notes
drbdadm sh-list-adjustabledrift check instead) and fix(satellite): read the GI from the kernel, not the backing device #305 (the observer reads a GI only while it can move). The three together take the idle cost to a few millicores, measured below.finishVolumeDefinitionDeletes(feat(vd)!: delete a volume definition on every replica, the way LINSTOR does #273) runs in the same pass; it depends on the replicas' deleted-volume status, which the Resource watch already passes, so it needs no requeue either.Testing
TestSettledRDAsksForNoRequeue: a 2-diskful RD gets its witness on the first pass and the second pass asks for no requeue. Fails with the five second requeue.TestDeferredWitnessComesBack: a witness create deferred on a vanished candidate asks to come back after five seconds, and the pass that then places the witness asks for nothing. Fails when the deferral does not ask.TestRDComesBackWhenAWitnessDeadlinePasses: both deadline annotations bring the RD back about 30 seconds later when set 30 seconds ahead, and a passed one does not. Fails when the deadline is ignored.TestWitnessCandidacyChangedFiresOnWhatThePickReads: a node joining or going, a drain flag, theAutoplaceTargetopt-out and a type change bring the RDs back; an unrelated prop edit does not. Fails when a joining node is ignored.TestGroupCreationBringsItsRDsBackandTestPinLayerStackWaitsForAGroupWithoutAStack(the second replaces the test that pinned the five second requeue for a group without a stack).TestGroupDeletionBringsItsRDsBack: a group's deletion passes the group watch. Fails when deletes are filtered out.TestFailedResizeStampAsksForARetry: a resize-pending stamp that meets a conflict asks the RD to come back after five seconds, and one that lands asks for nothing. Fails when the failure is only logged.TestIdleCostOfBusySatellites(integration, in fix(satellite): read the GI from the kernel, not the backing device #305, behindBURST_BENCH): three nodes with 115 replicas each, one idle minute, external tools charged at their field CPU cost with no CPU limit. On the alpha.10 tree: 381 to 394 millicores of tools per satellite, 7.5 API requests a second per satellite, 90.7 from the controller (GET resourcegroups 2720 a minute, GET resourcedefinitions 1360, GET resources 1360), and 283 millicores for the test process that runs the controller, the REST server and the three satellites. With this PR, fix(satellite): bring a rebooted node's resources up in parallel #295 and fix(satellite): read the GI from the kernel, not the backing device #305 on the same tree: 2 millicores of tools per satellite, no API request from any of them, and 24 millicores for the process. Seeding the 115 volumes also went from about 60 to 19 seconds.make lint-configandmake lint: 0 issues.go test ./...with envtest: green. On the alpha.10 tree with the three changes,go test ./internal/controller/ ./pkg/rest/...andgo test -tags=integration ./tests/integration/...: green.Not tested
AutoplaceTargetthat the witness pick might read in the future would need adding to the node watch; the pick reads only the flags, the type and that prop today.