Skip to content

Translate processor performance improvements#6093

Merged
san81 merged 9 commits into
opensearch-project:mainfrom
san81:translate-processor-improvements
Sep 23, 2025
Merged

Translate processor performance improvements#6093
san81 merged 9 commits into
opensearch-project:mainfrom
san81:translate-processor-improvements

Conversation

@san81

@san81 san81 commented Sep 19, 2025

Copy link
Copy Markdown
Collaborator

Description

Continuing the work of using EventKey in the place of String based keys #6020

Even though, PR looks huge, majority of them are just adding json files for testing scenarios. Primary code changes are just in TranslateProcessor EventKey caching. Rest of the changes are adding additional test coverage.

Issues Resolved

#6020

Due to the caching of the event, below JMH bechmark numbers may be really helpful to understand the impact but just keeping them here as an FYI.

jmh benchmark before this change


Benchmark                                                       Mode  Cnt          Score         Error  Units
TranslateProcessorBenchmark.benchmark_dynamic_key_translation  thrpt    6  124285135.602 ± 1418774.504  ops/s
TranslateProcessorBenchmark.benchmark_nested_path_translation  thrpt    6  275961895.249 ± 4261128.734  ops/s
TranslateProcessorBenchmark.benchmark_pattern_matching         thrpt    6   79327143.311 ± 1396818.087  ops/s
TranslateProcessorBenchmark.benchmark_static_key_translation   thrpt    6  124282297.525 ± 1948324.949  ops/s

jmh benchmark after this change




Benchmark                                                       Mode  Cnt           Score           Error  Units
TranslateProcessorBenchmark.benchmark_dynamic_key_translation  thrpt   10  1556663215.732 ±  15425311.375  ops/s
TranslateProcessorBenchmark.benchmark_nested_path_translation  thrpt   10  1535981591.007 ±  46548904.997  ops/s
TranslateProcessorBenchmark.benchmark_pattern_matching         thrpt   10  1505730352.975 ± 146716619.161  ops/s
TranslateProcessorBenchmark.benchmark_static_key_translation   thrpt   10  1550222201.638 ±  38707357.383  ops/s

Percentage change in each cateogry

Benchmark                                                       %change  
TranslateProcessorBenchmark.benchmark_dynamic_key_translation 1152%
TranslateProcessorBenchmark.benchmark_nested_path_translation  456%
TranslateProcessorBenchmark.benchmark_pattern_matching         1798%
TranslateProcessorBenchmark.benchmark_static_key_translation   1147%

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Signed-off-by: Santhosh Gandhe <1909520+san81@users.noreply.github.com>
Signed-off-by: Santhosh Gandhe <1909520+san81@users.noreply.github.com>
Signed-off-by: Santhosh Gandhe <1909520+san81@users.noreply.github.com>
Signed-off-by: Santhosh Gandhe <1909520+san81@users.noreply.github.com>
Signed-off-by: Santhosh Gandhe <1909520+san81@users.noreply.github.com>
/**
* KeyResolver implementation with ConcurrentHashMap-based caching.
*/
class CachingKeyResolver implements KeyResolver {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this? The EventKeyFactory already has a cache.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is caching the entire KeyInfo instances, that includes additional flags on the TranslateProcessor mapped keys. Otherwise, this logic will go into the Translate processor itself. That is another option. This is just to segregate that logic outside of that class.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this also includes some of the expression parsing I see. Thanks!

@DataPrepperPluginConstructor
public TranslateProcessor(PluginMetrics pluginMetrics, final TranslateProcessorConfig translateProcessorConfig, final ExpressionEvaluator expressionEvaluator) {
public TranslateProcessor(
PluginMetrics pluginMetrics,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the final modifier.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added 👍

Signed-off-by: Santhosh Gandhe <1909520+san81@users.noreply.github.com>
dlvenable
dlvenable previously approved these changes Sep 23, 2025
sb2k16
sb2k16 previously approved these changes Sep 23, 2025
Signed-off-by: Santhosh Gandhe <1909520+san81@users.noreply.github.com>
@san81 san81 dismissed stale reviews from sb2k16 and dlvenable via a957229 September 23, 2025 16:23
@san81 san81 merged commit 3438936 into opensearch-project:main Sep 23, 2025
45 of 47 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants