Skip to content

XContentBuilder.ensureNoSelfReferences has an impact on performance #26907

@jgq2008303393

Description

@jgq2008303393

Hi, all.
When using pipeline to parse log, I found that XContentBuilder.ensureNoSelfReferences has an impact on performance. This method cost about 17.36% of the total CPU resource.

My ES version is 5.5.2. The jstack result is as follows:
elasticsearch[1505480279000001809][bulk][T#19]" #255 daemon prio=5 os_prio=0 tid=0x00007fdd6c012800 nid=0xa86 runnable [0x00007fe823238000]
   java.lang.Thread.State: RUNNABLE
        at java.lang.System.identityHashCode(Native Method)
        at java.util.IdentityHashMap.hash(IdentityHashMap.java:294)
        at java.util.IdentityHashMap.put(IdentityHashMap.java:425)
        at java.util.Collections$SetFromMap.add(Collections.java:5461)
        at org.elasticsearch.common.xcontent.XContentBuilder.ensureNoSelfReferences(XContentBuilder.java:1088)
        at org.elasticsearch.common.xcontent.XContentBuilder.ensureNoSelfReferences(XContentBuilder.java:1071)
        at org.elasticsearch.common.xcontent.XContentBuilder.map(XContentBuilder.java:872)
        at org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:375)
        at org.elasticsearch.action.index.IndexRequest.source(IndexRequest.java:364)
        at org.elasticsearch.ingest.PipelineExecutionService.innerExecute(PipelineExecutionService.java:179)
        at org.elasticsearch.ingest.PipelineExecutionService.access$000(PipelineExecutionService.java:41)
        at org.elasticsearch.ingest.PipelineExecutionService$2.doRun(PipelineExecutionService.java:88)
        at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:638)
        at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Core/Infra/CoreCore issues without another label:PerformanceAll issues related to Elasticsearch performance including regressions and investigations>enhancementTeam:Core/InfraMeta label for core/infra teamTeam:PerformanceMeta label for performance team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions