Skip to content

Commit

Permalink
Support large number of routing instances
Browse files Browse the repository at this point in the history
Following changes are implemented:

- Use bgp::ShowCommand task for neighbor introspect.  This makes the
  intropsect commands more responsive because they no longer have to
  run exclusively with db::DBTable tasks.
- Fix BgpServer::VisitBgpPeers to not iterate all routing instances.
  Instead we can simply go through the BgpPeerList in BgpServer.

Change-Id: I6557b5f6fb1d00cddbb5072ca97a331c3f9c30fa
Partial-Bug: 1596089
  • Loading branch information
Nischal Sheth committed Jun 25, 2016
1 parent 83cd836 commit f43128c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
9 changes: 3 additions & 6 deletions src/bgp/bgp_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -554,12 +554,9 @@ uint32_t BgpServer::num_down_static_routes() const {
}

void BgpServer::VisitBgpPeers(BgpServer::VisitorFn fn) const {
for (RoutingInstanceMgr::RoutingInstanceIterator rit = inst_mgr_->begin();
rit != inst_mgr_->end(); ++rit) {
BgpPeerKey key = BgpPeerKey();
while (BgpPeer *peer = rit->peer_manager()->NextPeer(key)) {
fn(peer);
}
for (BgpPeerList::const_iterator loc = peer_list_.begin();
loc != peer_list_.end(); ++loc) {
fn(loc->second);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/bgp/bgp_show_neighbor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ void BgpNeighborReq::HandleRequest() const {
RequestPipeline::StageSpec s1;
TaskScheduler *scheduler = TaskScheduler::GetInstance();

s1.taskId_ = scheduler->GetTaskId("bgp::PeerMembership");
s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
s1.cbFn_ = boost::bind(&BgpShowHandler<
BgpNeighborReq,
BgpNeighborReqIterate,
Expand All @@ -156,7 +156,7 @@ void BgpNeighborReqIterate::HandleRequest() const {
RequestPipeline::StageSpec s1;
TaskScheduler *scheduler = TaskScheduler::GetInstance();

s1.taskId_ = scheduler->GetTaskId("bgp::PeerMembership");
s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
s1.cbFn_ = boost::bind(&BgpShowHandler<
BgpNeighborReq,
BgpNeighborReqIterate,
Expand All @@ -180,7 +180,7 @@ void ShowBgpNeighborSummaryReq::HandleRequest() const {
RequestPipeline::StageSpec s1;
TaskScheduler *scheduler = TaskScheduler::GetInstance();

s1.taskId_ = scheduler->GetTaskId("bgp::PeerMembership");
s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
s1.cbFn_ = boost::bind(&BgpShowHandler<
ShowBgpNeighborSummaryReq,
ShowBgpNeighborSummaryReqIterate,
Expand All @@ -204,7 +204,7 @@ void ShowBgpNeighborSummaryReqIterate::HandleRequest() const {
RequestPipeline::StageSpec s1;
TaskScheduler *scheduler = TaskScheduler::GetInstance();

s1.taskId_ = scheduler->GetTaskId("bgp::PeerMembership");
s1.taskId_ = scheduler->GetTaskId("bgp::ShowCommand");
s1.cbFn_ = boost::bind(&BgpShowHandler<
ShowBgpNeighborSummaryReq,
ShowBgpNeighborSummaryReqIterate,
Expand Down
2 changes: 1 addition & 1 deletion src/bgp/scheduling_group.cc
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ bool SchedulingGroup::empty() const {
// Return true if the IPeer is in sync.
//
bool SchedulingGroup::PeerInSync(IPeerUpdate *peer) const {
CHECK_CONCURRENCY("bgp::PeerMembership");
CHECK_CONCURRENCY("bgp::PeerMembership", "bgp::ShowCommand");

PeerState *ps = peer_state_imap_.Find(peer);
return (ps) ? ps->in_sync() : false;
Expand Down

0 comments on commit f43128c

Please sign in to comment.