-
Notifications
You must be signed in to change notification settings - Fork 24
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-578: decrease informers' memory consumption #317
Conversation
New image: ["quay.io/netobserv/flowlogs-pipeline:7314a97"]. It will expire after two weeks. |
@mariomac I haven't reviewed the code in deep, but remember the discussion we had about potential blocking calls and fact the cache seemed pre-loaded? Does this PR change anything in that regard / should we try to parallelize transformer processing? |
@jotak after working deeply with the informers' code, I can confirm that there aren't blocking calls (neither before nor now). The initial consideration about parallelizing workers was to share the big amount of memory that the informers' spent so we expected to minimize the overall memory usage by scaling vertically and downscaling horizontally. There are some reasons that changed my mind with respect to parallelizing (I'll annotate them also in the related JIRA to justify it):
Given the internal complexity of FLP, I'd say that the effort of reworking some internals to allow this parallelization won't worth the limited improvements we could achieve. |
if ownerReference.Kind == "ReplicaSet" { | ||
item, ok, err := k.replicaSetInformer.GetIndexer().GetByKey(info.Namespace + "/" + ownerReference.Name) | ||
if err != nil { | ||
panic(err) |
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.
never noticed this panic
.. that was abrupt!
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.
Code lgtm, smart rewrite! thanks @mariomac
I'll do a couple of more tests on my cluster before approving
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
I smoke-tested the enrichment end to end, everything seems fine
This PR adds a Transformer for each Kubernetes informer that converts the watched Pods, Services, and Nodes to
Info
instances, that are stored by the informers cache and contain only the data that is required for the decoration.This also alleviates the load on the Garbage Collector: before this patch, a new
Info
instance was created for each flow decoration. Now the same objects are reused onGetInfo
invocations for the same IP.In Flowlogs-Pipelines with mid-to-low loads, no improvements have been observed in terms of CPU and slight improvements in terms of memory. In the image below, the middle part corresponds to the new version of FLP.