Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Perf/libovsdb #1978

Merged
merged 31 commits into from
Mar 8, 2023
Merged

Perf/libovsdb #1978

merged 31 commits into from
Mar 8, 2023

Conversation

gugulee
Copy link
Contributor

@gugulee gugulee commented Oct 19, 2022

What type of this PR

Examples of user facing changes:

  • Features

Which issue(s) this PR fixes:

Fixes #1675

replace ovn-nbctl function call with libovsdb

Makefile Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
@@ -823,8 +831,6 @@ func (c *Controller) startWorkers(stopCh <-chan struct{}) {
go wait.Until(c.CheckNodePortGroup, time.Duration(c.config.NodePgProbeTime)*time.Minute, stopCh)
}

go wait.Until(c.syncVmLiveMigrationPort, 15*time.Second, stopCh)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this deleted?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syncVmLiveMigrationPort 函数的目的是当虚拟机 liveMigration 完成后,把原虚拟机的 mac 和 ip 地址给新虚拟机。

这个函数要和 CreatePort(新版本函数名变为 CreateLogicalSwitchPort) 一起看才有意义,具体分为两种场景(假设虚拟机名字为 test-vm,对应迁移前和迁移后 vm pod 名字分别为:test-vm-1-xxx 和 test-vm-2-xxx):

  1. keep-vm-ip = true(意味着要保留 vm 的 ip) 时,test-vm-1-xxx 和 test-vm-2-xxx 的 logical_switch_port 的名字都为 test-vm.namespace.providerName,意味着当 test-vm-2-xxx 创建时,同时存在两个 pod 拥有同一个 lsp(包括 mac 和 ip),经过热迁移测试,发现不需要设置 lsp liveMigration=1,然后再 syncVmLiveMigrationPort 处理。

  2. keep-vm-ip = false (意味着要不保留 vm 的 ip)时,test-vm-1-xxx 和 test-vm-2-xxx 分别拥有自己 ip 和 mac,和上述过程无关。

在新版 CreateLogicalSwitchPort 中,取消了设置 liveMigration=1,所以 syncVmLiveMigrationPort 函数也就不需要了。

pkg/util/net_test.go Outdated Show resolved Hide resolved
@zhangzujian
Copy link
Member

zhangzujian commented Oct 27, 2022

NAT outgoing for centralized subnets failed caused by missing logical router policy:

❯ kubectl ko nbctl lr-policy-list ovn-cluster
Routing Policies
     31000                            ip4.dst == 10.16.0.0/16           allow
     31000                           ip4.dst == 100.64.0.0/16           allow
     30000                              ip4.dst == 172.20.0.2         reroute                100.64.0.3
     30000                              ip4.dst == 172.20.0.3         reroute                100.64.0.2
# missing the following policy:
#    29000                              ip4.src == 10.16.0.0/16       reroute                100.64.0.3

kube-ovn-controller logs:

E1027 07:59:19.851029      10 node.go:983] get logical router policy: not found policy priority 29000 match ip4.src == 10.16.0.0/16 in logical router ovn-cluster
E1027 07:59:19.851044      10 node.go:993] failed to get policy route paras, not found policy priority 29000 match ip4.src == 10.16.0.0/16 in logical router ovn-cluster
E1027 07:59:19.851051      10 subnet.go:1615] check ecmp policy route exist for subnet ovn-default, error not found policy priority 29000 match ip4.src == 10.16.0.0/16 in logical router ovn-cluster

@zhangzujian zhangzujian added the performance Anything that can make Kube-OVN faster label Oct 27, 2022
@zhangzujian zhangzujian self-assigned this Oct 31, 2022
@zhangzujian
Copy link
Member

@oilbeater oilbeater added this to In progress in 2023-1 via automation Jan 3, 2023
@oilbeater oilbeater removed this from In progress in 2023-1 Jan 16, 2023
@gugulee gugulee force-pushed the perf/libovsdb branch 2 times, most recently from 9496769 to f764a92 Compare February 15, 2023 01:54
@zhangzujian zhangzujian force-pushed the perf/libovsdb branch 4 times, most recently from e32fdfa to ea14e91 Compare February 15, 2023 03:59
Comment on lines +74 to +80
if lb.Vips == nil {
lb.Vips = make(map[string]string)
}

for vip, backends := range vips {
lb.Vips[vip] = backends
}
Copy link
Member

@zhangzujian zhangzujian Feb 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if lb.Vips == nil {
lb.Vips = make(map[string]string)
}
for vip, backends := range vips {
lb.Vips[vip] = backends
}
updatedVips := make(map[string]string, len(lb.Vips)+len(vips))
for vip, backends := range lb.Vips {
updatedVips[vip] = backends
}
for vip, backends := range vips {
updatedVips[vip] = backends
}
lb.Vips = updatedVips

Updating the filed directly will cause unexpected result.

@zhangzujian zhangzujian merged commit 3259b91 into kubeovn:master Mar 8, 2023
@gugulee gugulee deleted the perf/libovsdb branch March 9, 2023 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Anything that can make Kube-OVN faster
Projects
No open projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

大量 POD 场景下 logical_switch_port 等资源查询,创建和删除操作性能优化
2 participants