-
Notifications
You must be signed in to change notification settings - Fork 34
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
NETOBSERV-617: split big payloads in GRPC exporter #81
Conversation
entries := make([]*pbflow.Record, 0, len(inputRecords)) | ||
for _, record := range inputRecords { | ||
entries = append(entries, flowToPB(record)) | ||
} | ||
return &pbflow.Records{ | ||
Entries: entries, | ||
var records []*pbflow.Records |
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 it be better done in one pass rather than 2 passes?
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'll do it despite I'm afraid it will look a bit less readable. Also consider that in the second step we aren't copying arrays but just creating references to subslices pointing to the data in the original "entries" slice, so the impact in performance shouldn't be really high (saving the original "entries" reference, which is about 24 bytes, plus the control of the second loop, which will be usually few iterations).
But anyway let me do the change and then decide which one do you prefer.
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.
no no, that's fine, you can leave it as it is
I though it involved copying slices
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.
thanks btw for the info!
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, just wondering if a small perf improvement is possible when creating flow slices
Only for GRPC exporter, payloads with more than 10000 flows (default configurable value) are split in multiple messages that are submitted sequentially.