kmesh icon indicating copy to clipboard operation
kmesh copied to clipboard

maintain cluster active connection counter for circuit breaker

Open Okabe-Rintarou-0 opened this issue 1 year ago • 16 comments

What type of PR is this? feature

What this PR does / why we need it:

Which issue(s) this PR fixes: Fixes #

Proposal here https://github.com/kmesh-net/kmesh/pull/397

Special notes for your reviewer:

Does this PR introduce a user-facing change?:


Okabe-Rintarou-0 avatar Jul 12 '24 14:07 Okabe-Rintarou-0

how should i get the cluster id? Using cluster name will exceed the stack size limit? may be extract hashName to a public package?

Okabe-Rintarou-0 avatar Jul 12 '24 14:07 Okabe-Rintarou-0

image It's quite confusing

Okabe-Rintarou-0 avatar Jul 13 '24 01:07 Okabe-Rintarou-0

Some files need to be updated, please run 'make gen' and include any changed files in your PR

LiZhenCheng9527 avatar Jul 13 '24 03:07 LiZhenCheng9527

Codecov Report

Attention: Patch coverage is 64.06250% with 23 lines in your changes missing coverage. Please review.

Project coverage is 49.54%. Comparing base (1902392) to head (e9af645). Report is 48 commits behind head on main.

Files with missing lines Patch % Lines
pkg/cache/v2/cluster.go 79.41% 5 Missing and 2 partials :warning:
pkg/bpf/bpf.go 0.00% 5 Missing :warning:
pkg/utils/hash_name.go 0.00% 4 Missing :warning:
pkg/controller/ads/cache.go 66.66% 3 Missing :warning:
pkg/controller/controller.go 0.00% 3 Missing :warning:
pkg/controller/workload/workload_processor.go 50.00% 1 Missing :warning:
Files with missing lines Coverage Δ
pkg/bpf/ads/loader.go 47.43% <100.00%> (+1.38%) :arrow_up:
pkg/bpf/workload/sock_connection.go 54.01% <ø> (ø)
pkg/bpf/workload/sock_ops.go 55.88% <ø> (ø)
pkg/bpf/workload/xdp.go 48.57% <ø> (ø)
pkg/controller/ads/ads_controller.go 80.70% <100.00%> (ø)
pkg/controller/ads/ads_processor.go 75.33% <100.00%> (ø)
pkg/controller/client.go 65.62% <100.00%> (ø)
pkg/controller/workload/workload_processor.go 61.67% <50.00%> (+2.51%) :arrow_up:
pkg/controller/ads/cache.go 48.67% <66.66%> (+0.16%) :arrow_up:
pkg/controller/controller.go 0.00% <0.00%> (ø)
... and 3 more

... and 10 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a4ca182...e9af645. Read the comment docs.

codecov[bot] avatar Jul 13 '24 06:07 codecov[bot]

/unhold

Okabe-Rintarou-0 avatar Jul 16 '24 03:07 Okabe-Rintarou-0

I use a special way to reject connection, plz check MARK_REJECTED macro.

Tested in oe23.03.

Okabe-Rintarou-0 avatar Jul 21 '24 02:07 Okabe-Rintarou-0

met some errors when using bpf_spin_lock:

has to have BTF in order to use bpf_spin_lock (98 line(s) omitted)

https://github.com/cilium/cilium/issues/29216

Okabe-Rintarou-0 avatar Jul 23 '24 10:07 Okabe-Rintarou-0

In kmesh we donot create bpf map within cilium lib. It is from c code.

Not sure https://blog.csdn.net/superbfly/article/details/128204317 can help

hzxuzhonghu avatar Jul 23 '24 12:07 hzxuzhonghu

In kmesh we donot create bpf map within cilium lib. It is from c code.

Not sure https://blog.csdn.net/superbfly/article/details/128204317 can help

tried it before, not work. I am using atomic apis now.

Okabe-Rintarou-0 avatar Jul 23 '24 12:07 Okabe-Rintarou-0

One last comment: we should delete map_of_cluster_stats when a cluster is removed, but i donot see this

ok, i will delete them in user space.

Okabe-Rintarou-0 avatar Jul 24 '24 06:07 Okabe-Rintarou-0

envoy also supports config for per-host max connection thresholds(host is namely endpoint). Do we need this?

Okabe-Rintarou-0 avatar Jul 26 '24 07:07 Okabe-Rintarou-0

Yes, but istio doesnot support it. And so we cannot get per host circuit breaker settings

hzxuzhonghu avatar Jul 26 '24 08:07 hzxuzhonghu

this pr needs another review :)

Okabe-Rintarou-0 avatar Aug 01 '24 02:08 Okabe-Rintarou-0

Please solve the conflicts

LiZhenCheng9527 avatar Aug 22 '24 01:08 LiZhenCheng9527

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment Approvers can cancel approval by writing /approve cancel in a comment

kmesh-bot avatar Oct 30 '24 09:10 kmesh-bot