title: Recommended RAM ratios for ELK with docker-compose
body: <p>I have a production server with 8GB RAM.  Im looking to host elastic,logstash and kibana on the server. Using docker compose.</p>
  
  <p>What would be the recommended java sizes memory sizes for each of the containers.  How might I configure this.</p>
  
  <p>My <code>docker-compose</code> looks like the following</p>
  
  <pre><code>---
  version: '3'
  services
  
    kibana:
      build:
        context: kibana/
      container_name: kibana
      volumes:
        - ./kibana/config/:/usr/share/kibana/config:ro
      networks: ['elk']
      depends_on:
        - elasticsearch
      restart: always
  
    elasticsearch:
      build:
        context: elasticsearch/
      container_name: elasticsearch
      networks: ['elk']
      volumes:
        - ./elastic-data:/usr/share/elasticsearch/data
        - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
      restart: always
      ulimits:
        memlock:
          soft: -1
          hard: -1
        nofile:
          soft: 65536
          hard: 65536
      environment:
        - cluster.name=es-docker
        - node.name=node1
        - bootstrap.memory_lock=true
  
    logstash:
        build:
          context: logstash/
        container_name: logstash
        volumes:
          - ./logstash/pipeline/logstash.conf:/usr/share/logstash/pipeline/logstash.conf:ro
        networks: ['elk']
        ports:
          - "5044:5044"
        depends_on:
          - elasticsearch
        restart: always
  
  networks: {elk: {}}
  </code></pre>
  
  <p>Now searching around on the elastic documentatino im seeting some settings like
  <code>- "ES_JAVA_OPTS=-Xms512m -Xmx512m"</code>  etc</p>
  
  <p>So what I would like to know..  For the above docker-compose what settings should I allow for java heap sizes / memory limit and how do I update the compose to include it.</p>
  
  <p>My thoughts are 
  4GB for elastic
  2GB for logstash
  1GB for Kibana</p>
  
  <p>1GB reserved for host</p>