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
Move the go-ipfix tag after adding performance fixes #2574
Conversation
3ad510f
to
39bd139
Compare
|
This pull request introduces 90 alerts when merging 39bd139 into fe4457f - view on LGTM.com new alerts:
|
39bd139
to
fd82de1
Compare
Codecov Report
@@ Coverage Diff @@
## main #2574 +/- ##
==========================================
+ Coverage 60.10% 60.18% +0.08%
==========================================
Files 282 282
Lines 22337 22345 +8
==========================================
+ Hits 13426 13449 +23
+ Misses 7491 7480 -11
+ Partials 1420 1416 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
8356d86
to
1323069
Compare
| @@ -548,13 +548,14 @@ func (exp *flowExporter) addRecordToSet(record flowexporter.FlowRecord) error { | |||
| case "flowType": | |||
| ie.Value = exp.findFlowType(record.Conn) | |||
| } | |||
| eL[i] = ie | |||
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 don't know if that makes a copy, but I image so and to be safe you should use:
for i := range eL {
ie := &eL[i]
// ...
}same comment for other loop below
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.
Any reference for this? Thanks.
I can confirm that all the e2e tests and unit tests covering this code are passing.
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.
it's not about correctness, but you are copying the element back into the list so it's slower for no reason
see this benchmark:
package main
import (
"testing"
)
// Without Big
// BenchmarkCopy-12 1000000 1151 ns/op
// BenchmarkRef-12 1000000 1027 ns/op
// With Big
// BenchmarkCopy-12 46578 23557 ns/op
// BenchmarkRef-12 869930 1425 ns/op
type Data struct {
A int64
B int64
C int64
D int64
Big [32]int64
}
func makeList(N int) []Data {
return make([]Data, N)
}
func iterCopy(l []Data) []Data {
for i, e := range l {
e.A += 1
e.B += 1
e.C += 1
e.D += 1
l[i] = e
}
return l
}
func iterRef(l []Data) []Data {
for i := range l {
e := &l[i]
e.A += 1
e.B += 1
e.C += 1
e.D += 1
}
return l
}
func BenchmarkCopy(b *testing.B) {
l := makeList(1000)
b.ResetTimer()
for i := 0; i < b.N; i++ {
iterCopy(l)
}
}
func BenchmarkRef(b *testing.B) {
l := makeList(1000)
b.ResetTimer()
for i := 0; i < b.N; i++ {
iterRef(l)
}
}The performance difference can vary significantly based on element size.
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 missed the performance reference in your comment.
Here the object is not big. It has a pointer and value of type interface. As you mentioned, better to be safe.
Thanks for the catch.
| @@ -388,7 +388,7 @@ func (exp *flowExporter) sendTemplateSet(isIPv6 bool) (int, error) { | |||
| if err := exp.ipfixSet.PrepareSet(ipfixentities.Template, templateID); err != nil { | |||
| return 0, err | |||
| } | |||
| err := exp.ipfixSet.AddRecord(elements, templateID) | |||
| err := exp.ipfixSet.AddRecord(elements, 0, templateID) | |||
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.
it would have been good (or it would be good if it's not too late) to define 2 different methods in go-ipfix: AddRecord and AddRecordWithExtraElements. It would avoid these cryptic changes in Antrea and it's probably good to keep backward compatibility for your library when you can...
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.
Good suggestion.
1323069
to
58af088
Compare
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.
there are several CI failures that need to be addressed
pkg/flowaggregator/flowaggregator.go
Outdated
| @@ -341,7 +342,7 @@ func (fa *flowAggregator) initExportingProcess() error { | |||
| CollectorProtocol: fa.externalFlowCollectorProto, | |||
| ObservationDomainID: fa.observationDomainID, | |||
| TempRefTimeout: 1800, | |||
| PathMTU: 0, | |||
| PathMTU: 1400, | |||
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.
this needs a comment...
it also seems unrelated to the rest of the PR
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.
Yes, it was not meant to be added. Removed it.
|
Thanks for the review @antoninbas |
58af088
to
5d42d19
Compare
Identified and fixed performance fixes. Moving the tag. Signed-off-by: Srikar Tati <stati@vmware.com>
5d42d19
to
7d758ef
Compare
|
/test-all |
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
| @@ -279,6 +279,7 @@ func (fa *flowAggregator) InitCollectingProcess() error { | |||
| IsEncrypted: false, | |||
| } | |||
| } | |||
| cpInput.NumExtraElements = len(antreaSourceStatsElementList) + len(antreaDestinationStatsElementList) + len(antreaLabelsElementList) | |||
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.
it's a bit strange that this doesn't match aggregationElements which is what I would expect. I guess I am not familiar enough with go-ipfix.
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.
aggregationElements contains all elements that needs an update as we receive flow record. The numExtraElements are the elements that are added newly after receiving the flow records.
|
/test-conformance |
Identified and fixed performance fixes. Moving the tag. Signed-off-by: Srikar Tati <stati@vmware.com>
Identified and fixed performance fixes. Moving the tag. Signed-off-by: Srikar Tati <stati@vmware.com>
Identified and fixed performance fixes. Moving the tag. Signed-off-by: Srikar Tati <stati@vmware.com>
Performance fixes for memory fragmentation issue in go-ipfix. Moving the release tag of go-ipfix.