-
Notifications
You must be signed in to change notification settings - Fork 77
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
[patch] Test/internal/tcp #501
Conversation
"github.com/vdaas/vald/internal/errors" | ||
"github.com/vdaas/vald/internal/net" | ||
|
||
"go.uber.org/goleak" | ||
) | ||
|
||
var ( | ||
goleakIgnoreOptions = []goleak.Option{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golangci] reported by reviewdog 🐶
goleakIgnoreOptions
is a global variable (gochecknoglobals)
return !(x == nil && y != nil) || !(y == nil && x != nil) | ||
}), | ||
cmp.Comparer(func(x, y tls.Config) bool { | ||
return reflect.DeepEqual(x, y) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golangci] reported by reviewdog 🐶
copylocks: call of reflect.DeepEqual copies lock value: crypto/tls.Config contains sync.Once contains sync.Mutex (govet)
Codecov Report
@@ Coverage Diff @@
## master #501 +/- ##
==========================================
+ Coverage 11.08% 11.69% +0.60%
==========================================
Files 403 404 +1
Lines 20930 20928 -2
==========================================
+ Hits 2321 2448 +127
+ Misses 18340 18213 -127
+ Partials 269 267 -2
Continue to review full report at Codecov.
|
/rebase |
[REBASE] Rebase triggered by kevindiu for branch: test/internal/tcp |
452eb3e
to
805e0de
Compare
/rebase |
[REBASE] Rebase triggered by kevindiu for branch: test/internal/tcp |
b67df85
to
ebe6016
Compare
2c04349
to
d73185f
Compare
/rebase |
[REBASE] Rebase triggered by kevindiu for branch: test/internal/tcp |
02b1741
to
65ea3eb
Compare
/rebase |
[REBASE] Rebase triggered by kevindiu for branch: test/internal/tcp |
65ea3eb
to
6918cb5
Compare
I think no. It decrease 0.5% searching performance but increase 5% insert performance
I have updated the description for more details.Please tell me if you have more questions :) |
@rinx thank you! |
/rebase |
[REBASE] Rebase triggered by kevindiu for branch: test/internal/tcp |
[REBASE] Failed to rebase. |
internal/net/tcp/dialer_test.go
Outdated
}(), | ||
func() test { | ||
tc := &tls.Config{ | ||
InsecureSkipVerify: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[golangci] reported by reviewdog 🐶
G402: TLS InsecureSkipVerify set true. (gosec)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
internal/net/tcp/dialer.go
Outdated
|
||
func (d *dialer) cacheExpireHook(ctx context.Context, addr string) { | ||
if err := safety.RecoverFunc(func() error { | ||
_, err1 := d.lookup(ctx, addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please do not use numbering variable
_, err1 := d.lookup(ctx, addr) | |
_, err1 := d.lookup(ctx, addr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
internal/net/tcp/dialer.go
Outdated
if err := safety.RecoverFunc(func() error { | ||
_, err1 := d.lookup(ctx, addr) | ||
return err1 | ||
_, lerr := d.lookup(ctx, addr) | ||
return lerr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use named return lerr looks dirty
internal/net/tcp/dialer.go
Outdated
|
||
// GetIP returns the next cached IP address in round robin order. | ||
// It starts getting the index 1 cache instead of index 0 cache. | ||
func (d *dialerCache) GetIP() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please change function naming to IP()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed :)
internal/net/tcp/dialer.go
Outdated
if d.dnsCache && !isIP { | ||
if dc, err := d.lookup(dctx, host); err == nil { | ||
for i := uint32(0); i < dc.Len(); i++ { | ||
if conn, err := d.dial(dctx, network, fmt.Sprintf("%s:%d", dc.IP(), port)); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fmt.Sprintf is slow is there any plan to improve performance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think strconv.FormatInt is better than Sprint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed! thank you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Author review required!!!!
Maybe performance test required before merging.
Description:
Sorry for this PR become so huge :(
This PR includes the following changes:
cachedDialer()
is IP addressThe test coverage is over 90% in internal/net/tcp package.
When I working on this PR, I found a bug about sharing cache. and I created a PR for this bug fix. #560
Performance result:
Gateway replicas: 10
Agent replicas: 30
Dataset: random-786-100000
Concurrency: 32
Batch size: 100
Insert mode (100000 random vectors)
Nightly branch (20200713)
Average VPS for each run:
Variance
Total Average: 6279.9408957
PR-501
Average VPS for each run:
Variance
Total Average: 6621.9206604 (+ 5.4455 % )
Search Mode
Nightly branch (20200714)
Average VPS for each run:
Variance
Total Average: 55164.2019226
PR501
Average VPS for each run:
Variance
Total Average: 54876.591151 (- 0.521372124%)
Search Mode (with 20000 random data & 3 index replica)
Nightly branch (20200715):
Average VPS for each run:
Variance
Total Average: 54687.5482939
PR 501:
Average VPS for each run:
Variance
Total Average: 54854.2164888 (+ 3%)
Related Issue:
How Has This Been Tested?:
Environment:
Types of changes:
Changes to Core Features:
Checklist: