Speed up addition of fields to forwarded EVE-JSON #83
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.
We found that specifying many fields in the
add-fields
section offever.yaml
slows down the processing pipeline a lot. This is due to the fact that each addition needs to parse and refresh the JSON string again, since there is no pre-processed state to work from. This is repeated for each field and event to be processed, reducing the throughput from >100K ev/s to ~25K ev/s for four extra fields.We circumvent this issue by radically simplifying this mechanism: the set of extra fields is preprocessed (i.e. escaped and formatted as key-value pairs) into a top-level JSON snippet which is then simply inserted at the end of the JSON line carried through the
Entry
. This will not update existing fields, so a user will need to take care not to create duplicate fields, but this approach will greatly increase throughput even with many added fields.