Draft
Conversation
remove `moas_signature` parameter as it was not used in the current version of the `log_moas` function
the `moas_signature` struct changes from containing a static allocated int32 array of size 128 and a count integer, to a static array of size 4 and a dynamic array and a origins count. the dynamic array is allocated if there are more than 4 origins in the moas event and is assigned with a static 128 size. this commit is designed to reduce the memory consumption of the moas consumer by reducing the sizes of the moas signatures needed to be stored in memory.
every time we try to write to array location outside the current range, we expand the space by MAX_STATIC_ORIGINS
this simplifies the flow for extending the dynamic array size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains code changes to
bvc_moas.ctargeted to reduce the memory consumption of the MOAS consumer.The main change is that I changed the
moas_signaturestruct to use a combination of small static allocated array and a large dynamically allocated array, instead of always using max-size statically allocated array.For the most of the MOAS events, the number of origins within is less than 4 ASes (85 percentile at the time of PR). Therefore we use 4 as the size of the static array. If there are more than 4 origins in the event, we will allocate an array of size 128 to accommodate the extreme cases.
Room for further improvement: