elastic / elastic/endpoint-package

Optimization: use the 'params' option for the script processor

Open
#372 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
33
Forks
20
Avg merge
2d 16h
Merged PRs (30d)
5

Description

A small (but real!) optimization would be to extract the 'typeMap' from this script and use the `params` option of the `script` processor to pass that same information to the script instead:

https://github.com/elastic/endpoint-package/blob/b52f3bec29742f490b2b304a3ed7256662839471/package/endpoint/data_stream/network/elasticsearch/ingest_pipeline/default.yml#L72-L96

As written, the script processor builds that map from scratch every time for every document, but if you switch to the params pattern, then the map would be constructed just once and passed into the script processor for every document.

/cc @pzl

-----

I noticed this while processing flamegraphs to see where this pipeline was spending its time, you can see here that the vast majority of the time spent by this script processor is just in building up the map for processing, rather than actually doing the real work it's there to do:

bad map every invocation 2

edit: Note, however, it's still just a fraction of the time spent in any processor at all. While this change will speed up the `script` processor in question quite a bit, I don't want you to think it's going to improve the performance of the whole pipeline enormously (but every couple of percents count, right?).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.