Skip to content

feat(peer): atomic peer counters#3309

Closed
nplanelcisco wants to merge 1 commit intoosrg:masterfrom
nplanelcisco:nplanel/peer-atomic-counters
Closed

feat(peer): atomic peer counters#3309
nplanelcisco wants to merge 1 commit intoosrg:masterfrom
nplanelcisco:nplanel/peer-atomic-counters

Conversation

@nplanelcisco
Copy link
Copy Markdown
Contributor

Avoiding a peer.config.ReadCopy() per message

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) on fsm, updated on message processing.
  • Populate oc.Neighbor.State.Messages and Timers.State.UpdateRecvTime in BgpServer.toConfig() via atomic loads from the FSM instead of relying on pConf state 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.

Comment thread pkg/server/server.go
Comment thread pkg/server/fsm.go
@nplanelcisco nplanelcisco force-pushed the nplanel/peer-atomic-counters branch from e9aa173 to f379574 Compare February 12, 2026 09:44
@nplanelcisco
Copy link
Copy Markdown
Contributor Author

nplanelcisco commented Feb 12, 2026

/copilot

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/server/fsm_test.go Outdated
Comment thread pkg/server/fsm_test.go Outdated
Comment thread pkg/server/fsm_test.go Outdated
Comment thread pkg/server/fsm_test.go Outdated
Comment thread pkg/server/fsm_test.go Outdated
Comment thread pkg/server/fsm_test.go
Comment thread pkg/server/fsm.go
Avoiding a peer.config.ReadCopy() per message
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@fujita
Copy link
Copy Markdown
Member

fujita commented Feb 17, 2026

Good improvement! Pushed, thanks.

@fujita fujita closed this Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants