# CPU and HEAP spiral out of control

**URL:** <https://discuss.elastic.co/t/cpu-and-heap-spiral-out-of-control/25346>\
**Category:** Elasticsearch\
**Created:** [July 10, 2015, 6:55pm UTC](https://discuss.elastic.co/t/cpu-and-heap-spiral-out-of-control/25346 "2015-07-10T18:55:10Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fei\_Yao](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@Fei\_Yao](https://discuss.elastic.co/u/Fei_Yao)\
**Post date:** [July 10, 2015, 6:55pm UTC](https://discuss.elastic.co/t/cpu-and-heap-spiral-out-of-control/25346/1 "2015-07-10T18:55:10Z")

</div>

We are a very large high tech organization, and we try to test out ES for one of our products. We are using ES v1.6, and elasticsearch-mapper-attachments v2.60. Using Highlight search we experienced very high CPU load initially and followed by very high HEAP. But if without Highlight it will be some what better. But not in 10s millisec level. I've updated one file 2MB in size for testing.

What I'm using?  
I'm using AWS EC2 t2.medium, and allocated 2GB memory (mlockall=true) with OpenJDK v1.7.0\_79. It's a 3 nodes cluster using elasticsearch-cloud-aws v2.6.0.

What the settings?

1. elasticsearch.config  
cluster.name: my\_cluster  
plugin.mandatory: mapper-attachments  
bootstrap.mlockall: true  
index.mapper.dynamic: false  
action.destructive\_requires\_name: true  
action.disable\_shutdown: true

cloud.aws.region: us-east  
discovery.zen.ping.multicast.enabled: false  
discovery.zen.minimum\_master\_nodes: 2  
discovery.type: ec2  
discovery.ec2.groups: dev-es-sg  
discovery.ec2.tag.Role: role-elasticsearch  
gateway.recover\_after\_nodes: 2  
gateway.recover\_after\_time: 5m  
gateway.expected\_nodes: 3  
action.auto\_create\_index: false

script.inline: on

document mapping  
{  
"my\_index": {  
"mappings": {  
"document": {  
"dynamic": "strict",  
"index\_analyzer": "index\_analyzer",  
"search\_analyzer": "search\_analyzer",  
"\_id": {  
"path": "id"  
},  
"properties": {  
"content": {  
"type": "attachment",  
"path": "full",  
"fields": {  
"content": {  
"type": "string",  
"store": true,  
"term\_vector": "with\_positions\_offsets"  
},  
"author": {  
"type": "string"  
},  
"title": {  
"type": "string"  
},  
"name": {  
"type": "string"  
},  
"date": {  
"type": "date",  
"format": "dateOptionalTime"  
},  
"keywords": {  
"type": "string"  
},  
"content\_type": {  
"type": "string"  
},  
"content\_length": {  
"type": "integer"  
},  
"language": {  
"type": "string"  
}  
}  
},  
"description": {  
"type": "string"  
}  
"fileName": {  
"type": "string"  
},  
"id": {  
"type": "string",  
"index": "not\_analyzed",  
"include\_in\_all": false  
},  
"tenantId": {  
"type": "string",  
"index": "not\_analyzed",  
"include\_in\_all": false  
},  
}  
}  
}  
}  
}  
index setting  
{  
"my\_index": {  
"settings": {  
"index": {  
"creation\_date": "1436454677044",  
"uuid": "C8bO\_Ef1QIC5L9yxIFz\_Hw",  
"analysis": {  
"analyzer": {  
"search\_analyzer": {  
"type": "custom",  
"filter": [  
"lowercase",  
"kstem"  
],  
"tokenizer": "standard"  
},  
"index\_analyzer": {  
"type": "custom",  
"char\_filter": [  
"html\_strip"  
],  
"filter": [  
"english\_possessive\_stemmer",  
"asciifolding",  
"word\_delimiter",  
"lowercase",  
"english\_stop",  
"kstem",  
"edgeNGram"  
],  
"tokenizer": "standard"  
}  
},  
"filter": {  
"english\_stop": {  
"type": "stop",  
"stopwords": "english"  
},  
"edgeNGram": {  
"max\_gram": "15",  
"min\_gram": "2",  
"type": "edgeNGram",  
"side": "front"  
},  
"english\_possessive\_stemmer": {  
"type": "stemmer",  
"language": "possessive\_english"  
},  
"word\_delimiter": {  
"preserve\_original": "true",  
"catenate\_words": "true",  
"type": "word\_delimiter",  
"catenate\_numbers": "true"  
}  
}  
},  
"number\_of\_replicas": "1",  
"number\_of\_shards": "3",  
"version": {  
"created": "1060099"  
}  
}  
}  
}  
}  
nodes stat  
{  
"cluster\_name": "my\_cluster",  
"nodes": {  
"VQR6nTK4R6yIBZwsLY\_Sdw": {  
"name": "Colleen Wing",  
"transport\_address": "inet[/10.178.115.30:9300]",  
"host": "ip-10-178-115-30",  
"ip": "10.178.115.30",  
"version": "1.6.0",  
"build": "cdd3ac4",  
"http\_address": "inet[/10.178.115.30:9200]",  
"process": {  
"refresh\_interval\_in\_millis": 1000,  
"id": 4690,  
"max\_file\_descriptors": 65535,  
"mlockall": true  
}  
},  
"FfjFnmLFS86xrR3HuaKYEw": {  
"name": "Salvo",  
"transport\_address": "inet[/10.178.115.52:9300]",  
"host": "ip-10-178-115-52",  
"ip": "10.178.115.52",  
"version": "1.6.0",  
"build": "cdd3ac4",  
"http\_address": "inet[/10.178.115.52:9200]",  
"process": {  
"refresh\_interval\_in\_millis": 1000,  
"id": 6682,  
"max\_file\_descriptors": 65535,  
"mlockall": true  
}  
},  
"mxKM02SeQgywR5V140tF3A": {  
"name": "Man-Eater",  
"transport\_address": "inet[/10.178.115.75:9300]",  
"host": "ip-10-178-115-75",  
"ip": "10.178.115.75",  
"version": "1.6.0",  
"build": "cdd3ac4",  
"http\_address": "inet[/10.178.115.75:9200]",  
"process": {  
"refresh\_interval\_in\_millis": 1000,  
"id": 6578,  
"max\_file\_descriptors": 65535,  
"mlockall": true  
}  
}  
}  
}  
query  
GET /documents/document/\_search  
{  
"query": {  
"filtered": {  
"query": {  
"match": {  
"\_all": "configu"  
}  
},  
"filter": {  
"term": {  
"tenantId": "123"  
}  
}  
}  
},  
"highlight": {  
"fields": {  
"\*": {}  
}  
}  
}

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 12, 2015, 8:45am UTC](https://discuss.elastic.co/t/cpu-and-heap-spiral-out-of-control/25346/2 "2015-07-12T08:45:01Z")

</div>

Highlighting is an intensive process so you have to expect some load on the system.

---

<div class="post-metadata">

**Author:** ![Fei\_Yao](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@Fei\_Yao](https://discuss.elastic.co/u/Fei_Yao)\
**Post date:** [July 12, 2015, 1:38pm UTC](https://discuss.elastic.co/t/cpu-and-heap-spiral-out-of-control/25346/3 "2015-07-12T13:38:51Z")

</div>

Mark,  
Thanks for your response. I moved away from Solr to ES recently for other reasons. The Rich Doc (using Tika) search using Highlight has dramatically different performance out-of-box. For Solr, I barely see any dent, but ES immediately chokes to the degree of the whole cluster is inoperable. They all use the same size of AWS EC2.

I wonder the performance tuning I need to make it run under a tolerable response time, and load?  
Thanks  
Fei

---

<div class="post-metadata">

**Author:** ![Fei\_Yao](https://avatars.discourse-cdn.com/v4/letter/f/85e7bf/32.png) [@Fei\_Yao](https://discuss.elastic.co/u/Fei_Yao)\
**Post date:** [July 14, 2015, 3:27am UTC](https://discuss.elastic.co/t/cpu-and-heap-spiral-out-of-control/25346/4 "2015-07-14T03:27:52Z")

</div>

Issue appears to be the elasticsearch-mapper-attachment plugin. We get rid of it, and extract text using Tika and everything becomes normal.

Thanks  
Fei

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 12:01am UTC](https://discuss.elastic.co/t/cpu-and-heap-spiral-out-of-control/25346/5 "2017-07-06T00:01:41Z")

</div>


