Skip to content

Commit

Permalink
performance optimalizations + avoid memory usage increasing infinitely
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Lenco committed Jan 2, 2019
1 parent 54d3c45 commit 4d57d41
Show file tree
Hide file tree
Showing 36 changed files with 1,668 additions and 809 deletions.
5 changes: 5 additions & 0 deletions k8s/contiv-vpp-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ data:
dump-go-routines-count: 5
linux-l3plugin.conf: |
dump-go-routines-count: 5
kvscheduler.conf: |
record-transaction-history: true
transaction-history-age-limit: 1440
---

Expand Down Expand Up @@ -414,6 +417,8 @@ spec:
value: "/etc/vpp-agent/linux-ifplugin.conf"
- name: LINUX_L3PLUGIN_CONFIG
value: "/etc/vpp-agent/linux-l3plugin.conf"
- name: KVSCHEDULER_CONFIG
value: "/etc/vpp-agent/kvscheduler.conf"
volumeMounts:
- name: var-bolt
mountPath: /var/bolt
Expand Down
5 changes: 5 additions & 0 deletions k8s/contiv-vpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ data:
dump-go-routines-count: 5
linux-l3plugin.conf: |
dump-go-routines-count: 5
kvscheduler.conf: |
record-transaction-history: true
transaction-history-age-limit: 1440
---

Expand Down Expand Up @@ -412,6 +415,8 @@ spec:
value: "/etc/vpp-agent/linux-ifplugin.conf"
- name: LINUX_L3PLUGIN_CONFIG
value: "/etc/vpp-agent/linux-l3plugin.conf"
- name: KVSCHEDULER_CONFIG
value: "/etc/vpp-agent/kvscheduler.conf"
volumeMounts:
- name: var-bolt
mountPath: /var/bolt
Expand Down
5 changes: 5 additions & 0 deletions k8s/contiv-vpp/templates/vpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ data:
dump-go-routines-count: 5
linux-l3plugin.conf: |
dump-go-routines-count: 5
kvscheduler.conf: |
record-transaction-history: {{ .Values.controller.recordEventHistory }}
transaction-history-age-limit: {{ .Values.controller.eventHistoryAgeLimit }}
---

Expand Down Expand Up @@ -705,6 +708,8 @@ spec:
value: "/etc/vpp-agent/linux-ifplugin.conf"
- name: LINUX_L3PLUGIN_CONFIG
value: "/etc/vpp-agent/linux-l3plugin.conf"
- name: KVSCHEDULER_CONFIG
value: "/etc/vpp-agent/kvscheduler.conf"
volumeMounts:
- name: var-bolt
mountPath: /var/bolt
Expand Down
6 changes: 3 additions & 3 deletions mock/localclient/controller/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

// MockControllerTxn is a mock implementation of the Transaction interface from Controller.
type MockControllerTxn struct {
seqNum int
seqNum uint64
Values controller.KeyValuePairs
commitFunc CommitFunc
}
Expand All @@ -24,7 +24,7 @@ type MockControllerTxn struct {
type CommitFunc = func(values map[string]proto.Message) error

// NewMockControllerTxn is a constructor for mock Controller Txn.
func NewMockControllerTxn(seqNum int, commitFunc CommitFunc) *MockControllerTxn {
func NewMockControllerTxn(seqNum uint64, commitFunc CommitFunc) *MockControllerTxn {
return &MockControllerTxn{
seqNum: seqNum,
Values: make(controller.KeyValuePairs),
Expand All @@ -33,7 +33,7 @@ func NewMockControllerTxn(seqNum int, commitFunc CommitFunc) *MockControllerTxn
}

// Commit applies the requested transaction changes.
func (m *MockControllerTxn) Commit(ctx context.Context) (seqNum int, err error) {
func (m *MockControllerTxn) Commit(ctx context.Context) (seqNum uint64, err error) {
resyncType, _ := scheduler_api.IsResync(ctx)
isResync := resyncType != scheduler_api.NotResync
description, withDescription := scheduler_api.IsWithDescription(ctx)
Expand Down
2 changes: 1 addition & 1 deletion mock/localclient/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type TxnTracker struct {
// lock allows to use the same mock localclient from multiple go routines.
lock sync.Mutex
// next transaction sequence number
txnSeqNum int
txnSeqNum uint64
// LatestRevisions maintains the map of keys & values with revision.
LatestRevisions *syncbase.PrevRevisions
// CommittedTxns is a list finalized transaction in the order as they were
Expand Down
2 changes: 1 addition & 1 deletion plugins/controller/api/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type Transaction interface {
UpdateOperations

// Commit applies the requested transaction changes.
Commit(ctx context.Context) (seqNum int, err error)
Commit(ctx context.Context) (seqNum uint64, err error)
}

// ResyncOperations lists operations needed to build transaction for Resync-type events.
Expand Down
8 changes: 5 additions & 3 deletions plugins/controller/plugin_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ func (c *Controller) eventLoop() {
break
}
}
c.eventHistory = c.eventHistory[i:]
if i > 0 {
c.eventHistory = c.eventHistory[i:]
}
c.historyLock.Unlock()
}
}
Expand Down Expand Up @@ -742,8 +744,8 @@ func (c *Controller) processEvent(qe *QueuedEvent) error {
}

// append transaction to the event record
if txnSeqNum != -1 {
evRecord.Txn = c.Scheduler.GetRecordedTransaction(uint(txnSeqNum))
if txnSeqNum != ^uint64(0) {
evRecord.Txn = c.Scheduler.GetRecordedTransaction(txnSeqNum)
}

// update Controller's view of internal configuration
Expand Down
2 changes: 1 addition & 1 deletion plugins/controller/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func newTransaction(kvScheduler scheduler_api.KVScheduler) *kvSchedulerTxn {
}

// Commit applies the requested transaction changes.
func (txn *kvSchedulerTxn) Commit(ctx context.Context) (seqNum int, err error) {
func (txn *kvSchedulerTxn) Commit(ctx context.Context) (seqNum uint64, err error) {
schedTxn := txn.kvScheduler.StartNBTransaction()
for key, value := range txn.values {
if value != nil {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4d57d41

Please sign in to comment.