# High CPU and Memory Usage

**URL:** <https://discuss.elastic.co/t/high-cpu-and-memory-usage/265898>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [March 2, 2021, 5:29am UTC](https://discuss.elastic.co/t/high-cpu-and-memory-usage/265898 "2021-03-02T05:29:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![duck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/duck/32/84668_2.png) [@duck](https://discuss.elastic.co/u/duck)\
**Post date:** [March 2, 2021, 5:29am UTC](https://discuss.elastic.co/t/high-cpu-and-memory-usage/265898/1 "2021-03-02T05:29:18Z")

</div>

Hi,

I've setup Elasticsearch and Kibana on Docker. For testing purpose, I've used "eCommerce Dashboard" example from Kibana(which has one index and almost 5,000 documents.). My Ubuntu server shows me Elasticsearch uses arange 20% to 200% CPU and 25% to 75% memory.

We've used Elasticsearch and like it. If it's possible, we'd like to stick with Elasticsearch and not searching another solution. Since it's a Java application, it might use memory but I do not think it use that much for only one index and 5,000 documents.

**System** (It's a virtualbox server.)

- Ubuntu Server 20.04
- 2 CPU
- 4 GB Ram
- 50 GB HDD

**Versions**

- Elasticsearch 7.11.1
- Kibana 7.11.1
- Docker 19.03

**Tests**

- When I open Kibana dashboard, its CPU usage increases between 100-250%
- When it's stable(There is no operation, no write/queriying), it uses 50% memory and 5-50% CPU
- I've deleted all indices and dashboards but Elasticsearch uses stabil 2-20% CPU and 30-35% RAM. It doesn't make sense...

**Health Check**

```auto
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
172.19.0.2 45 80 18 0.71 0.67 0.54 cdhilmrstw * hex-es-node1

```

```auto
{
  "cluster_name" : "hex-es-cluster1",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 7,
  "active_shards" : 7,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}

```

**Docker Compose File**

```auto
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.11.1
    container_name: elasticsearch-server
    ports:
      - 9200:9200
      - 9300:9300
    environment:
      cluster.name: "hex-es-cluster1"
      node.name: "hex-es-node1"
      discovery.type: single-node
      xpack.security.enabled: "false"
    networks:
      - monitoring-network
    volumes:
      - elasticsearch-data:/usr/share/elasticsearch/data
  kibana:
    image: docker.elastic.co/kibana/kibana:7.11.1
    container_name: kibana-server
    ports:
      - 5601:5601
    environment:
      ELASTICSEARCH_HOSTS: http://elasticsearch-server:9200
    networks:
      - monitoring-network
    depends_on:
      - elasticsearch

```

---

<div class="post-metadata">

**Author:** ![xeraa](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/xeraa/32/48181_2.png) [@xeraa](https://discuss.elastic.co/u/xeraa)\
**Post date:** [March 2, 2021, 7:10pm UTC](https://discuss.elastic.co/t/high-cpu-and-memory-usage/265898/2 "2021-03-02T19:10:25Z")

</div>

Some monitoring would probably be helpful here — it's built into the Elasticsearch and Kibana. In the Kibana menu, you have a heart-like icon where you can enable monitoring (additional docs: [Collecting monitoring data using legacy collectors | Elasticsearch Reference [7.11] | Elastic](https://www.elastic.co/guide/en/elasticsearch/reference/7.11/collecting-monitoring-data.html)).

If you enable that and share the results, we should be able to get a better idea what is going on with the cluster and where it's actually spending CPU and memory.

---

<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:** [March 30, 2021, 7:11pm UTC](https://discuss.elastic.co/t/high-cpu-and-memory-usage/265898/3 "2021-03-30T19:11:01Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
