feat(peer): atomic peer counters#3309
Conversation
There was a problem hiding this comment.
Pull request overview
This PR optimizes peer message/timer statistic tracking by avoiding a pConf.ReadCopy() + pConf.Update() on every message, instead keeping counters in atomic fields on the FSM and snapshotting them when building the neighbor config view.
Changes:
- Introduce atomic-backed message counters (
counterStats) and timer state (timerStats) onfsm, updated on message processing. - Populate
oc.Neighbor.State.MessagesandTimers.State.UpdateRecvTimeinBgpServer.toConfig()via atomic loads from the FSM instead of relying onpConfstate updates.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/server/server.go | Snapshots peer message/timer stats via atomic loads when building a neighbor config/state view. |
| pkg/server/fsm.go | Adds atomic-backed message counters/timer state to fsm and updates them per message/stat event. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e9aa173 to
f379574
Compare
|
/copilot |
f379574 to
5fbf8b8
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Avoiding a peer.config.ReadCopy() per message
5fbf8b8 to
2e9cee6
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Good improvement! Pushed, thanks. |
Avoiding a peer.config.ReadCopy() per message