summaryrefslogtreecommitdiffhomepage
path: root/server/server.go
diff options
context:
space:
mode:
authorISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-01-13 12:14:45 +0900
committerISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>2016-01-16 18:22:13 +0900
commit40ce51137a1bc3733d36ea045daae067eef735f0 (patch)
tree0fdb1519f42b4fea6f8793b31dc0202326fe872b /server/server.go
parentb344eb3777e5088f0a97d585e81e546363ea4101 (diff)
table: remove unnecessary copy of path attributes
the result of memory profile (500 route-server-clients each of them advertises 100 routes) before: (pprof) top5 9330.48MB of 9367.53MB total (99.60%) Dropped 157 nodes (cum <= 46.84MB) Showing top 10 nodes out of 17 (cum >= 9334.17MB) flat flat% sum% cum cum% 6163.04MB 65.79% 65.79% 6163.04MB 65.79% github.com/osrg/gobgp/table.NewPath 1155.05MB 12.33% 78.12% 7302.59MB 77.96% github.com/osrg/gobgp/table.(*Path).Clone 986.31MB 10.53% 88.65% 1388.81MB 14.83% github.com/osrg/gobgp/table.(*AdjRib).Update 402.51MB 4.30% 92.95% 402.51MB 4.30% fmt.Sprintf 402.51MB 4.30% 97.24% 402.51MB 4.30% net.parseIPv4 after: (pprof) top 3913.02MB of 3978.69MB total (98.35%) Dropped 148 nodes (cum <= 19.89MB) Showing top 10 nodes out of 11 (cum >= 21MB) flat flat% sum% cum cum% 2970.30MB 74.66% 74.66% 2975.80MB 74.79% github.com/osrg/gobgp/server.filterpath 810.09MB 20.36% 95.02% 810.59MB 20.37% github.com/osrg/gobgp/table.(*AdjRib).Update 115.60MB 2.91% 97.92% 119.10MB 2.99% github.com/osrg/gobgp/table.createUpdateMsgFromPath 10MB 0.25% 98.17% 1878.02MB 47.20% github.com/osrg/gobgp/server.(*BgpServer).propagateUpdate 4.50MB 0.11% 98.29% 144.60MB 3.63% github.com/osrg/gobgp/table.CreateUpdateMsgFromPaths Signed-off-by: ISHIDA Wataru <ishida.wataru@lab.ntt.co.jp>
Diffstat (limited to 'server/server.go')
-rw-r--r--server/server.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/server.go b/server/server.go
index 817c7d05..4a198e49 100644
--- a/server/server.go
+++ b/server/server.go
@@ -556,7 +556,7 @@ func filterpath(peer *Peer, path *table.Path) *table.Path {
if !peer.isRouteServerClient() && isASLoop(peer, path) {
return nil
}
- return path.Clone(net.ParseIP(remoteAddr), path.IsWithdraw)
+ return path.Clone(peer.fsm.peerInfo.Address, path.IsWithdraw)
}
func (server *BgpServer) dropPeerAllRoutes(peer *Peer) []*SenderMsg {
@@ -643,7 +643,7 @@ func (server *BgpServer) broadcastValidationResults(results []*api.ROAResult) {
func (server *BgpServer) broadcastBests(bests []*table.Path) {
for _, path := range bests {
- if !path.IsFromZebra {
+ if !path.IsFromZebra() {
z := newBroadcastZapiBestMsg(server.zclient, path)
if z != nil {
server.broadcastMsgs = append(server.broadcastMsgs, z)
@@ -1268,7 +1268,7 @@ func (server *BgpServer) handleModPathRequest(grpcReq *GrpcRequest) []*table.Pat
path := func() *table.Path {
for _, rf := range server.globalRib.GetRFlist() {
for _, path := range server.globalRib.GetPathList(table.GLOBAL_RIB_NAME, rf) {
- if len(path.Uuid) > 0 && bytes.Equal(path.Uuid, arg.Uuid) {
+ if len(path.UUID()) > 0 && bytes.Equal(path.UUID(), arg.Uuid) {
return path
}
}
@@ -1289,7 +1289,7 @@ func (server *BgpServer) handleModPathRequest(grpcReq *GrpcRequest) []*table.Pat
if err == nil {
u := uuid.NewV4()
uuidBytes = u.Bytes()
- paths[0].Uuid = uuidBytes
+ paths[0].SetUUID(uuidBytes)
}
}
}