Skip to content

"Lockless" RIB design#255

Merged
vincentbernat merged 3 commits into
mainfrom
fix/lockless-rib
Nov 13, 2022
Merged

"Lockless" RIB design#255
vincentbernat merged 3 commits into
mainfrom
fix/lockless-rib

Conversation

@vincentbernat

Copy link
Copy Markdown
Member

RIB updates are handled by a single goroutine accepting update requests
through a channel receiving functions to execute on the state (RIB +
peer state).

For lookups, we have 3 options (better to lower performance, higher to
lower memory usage):

  1. have a read-only copy updated "atomically" at regular interval,
  2. have a read-only copy updated behind a lock at regular interval,
  3. handle lookups by the worker through a high priority channel.

This PR implements option 1 and 3. Option 3 may be a regression in latency compared to the previous design because long updates (flushing peers) may prevent answering lookup requests. Option 2 has not been implemented because it may make the code more complex for little gain. There is no guarantee that the garbage collector will reuse the memory just freed for the new RIB clone.

Fix #253

RIB updates are handled by a single goroutine accepting update requests
through a channel receiving functions to execute on the state (RIB +
peer state).

For lookups, we have 3 options (better to lower performance, higher to
lower memory usage):

1. have a read-only copy updated "atomically" at regular interval,
2. have a read-only copy updated behind a lock at regular interval,
3. handle lookups by the worker through a high priority channel.

This commit implements option 3. It may be a regression in latency
compared to the previous design because long updates (flushing peers)
may prevent answering lookup requests. This will be addressed in the
next commit.
It can be queries without needing any lock. The user can choose between
this mode and the previous one with `rib-mode`. The default value,
`memory` is the previous mode. The new one can be selected with
`performance`.
@vincentbernat vincentbernat changed the title Lockless RIB design "Lockless" RIB design Nov 12, 2022
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.

Optimize BMP module, notably when removing a peer

1 participant