Skip to content

Commit

Permalink
ct sync optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
TrekkieCoder committed Aug 20, 2023
1 parent 9aaceca commit e26215b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion loxilb-ebpf
13 changes: 7 additions & 6 deletions loxinet/dpebpf_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ const (
const (
DpEbpfLinuxTiVal = 10
ctiDeleteSyncRetries = 4
blkCtiMaxLen = 4096
mapNotifierChLen = 131072
)

// ebpf table related defines in go
Expand Down Expand Up @@ -281,7 +283,7 @@ func DpEbpfInit(clusterEn bool, nodeNum int, rssEn bool, egrHooks bool, logLevel

ne := new(DpEbpfH)
ne.tDone = make(chan bool)
ne.ToMapCh = make(chan interface{}, 65536)
ne.ToMapCh = make(chan interface{}, mapNotifierChLen)
ne.ToFinCh = make(chan int)
ne.ctBcast = make(chan bool)
ne.ticker = time.NewTicker(DpEbpfLinuxTiVal * time.Second)
Expand Down Expand Up @@ -1718,7 +1720,7 @@ func dpCTMapChkUpdates() {
fd := C.llb_map2fd(C.LL_DP_CT_MAP)

if len(mh.dpEbpf.ctMap) > 0 {
tk.LogIt(tk.LogDebug, "[CT] Map size %d\n", len(mh.dpEbpf.ctMap))
tk.LogIt(tk.LogInfo, "[CT] Map size %d\n", len(mh.dpEbpf.ctMap))
}

for _, cti := range mh.dpEbpf.ctMap {
Expand Down Expand Up @@ -1821,7 +1823,7 @@ func dpCTMapChkUpdates() {
}
}

if len(blkCti) > 2048 {
if len(blkCti) > blkCtiMaxLen {
tk.LogIt(tk.LogDebug, "[CT] Block Add Sync - \n")
tc1 := time.Now()
mh.dp.DpXsyncRPC(DpSyncAdd, blkCti)
Expand All @@ -1830,7 +1832,7 @@ func dpCTMapChkUpdates() {
blkCti = nil
}

if len(blkDelCti) > 2048 {
if len(blkDelCti) > blkCtiMaxLen {
tk.LogIt(tk.LogDebug, "[CT] Block Del Sync - \n")
mh.dp.DpXsyncRPC(DpSyncDelete, blkDelCti)
blkDelCti = nil
Expand Down Expand Up @@ -1861,7 +1863,7 @@ func dpMapNotifierWorker(f chan int, ch chan interface{}) {
}()

for {
for n := 0; n < DpWorkQLen; n++ {
for {
select {
case m := <-ch:
switch mq := m.(type) {
Expand All @@ -1874,7 +1876,6 @@ func dpMapNotifierWorker(f chan int, ch chan interface{}) {
continue
}
}
time.Sleep(2000 * time.Millisecond)
}
}

Expand Down

0 comments on commit e26215b

Please sign in to comment.