Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elasticsearch service taking too much memory [Maybe only Question] #1787

Open
luislard opened this issue Apr 22, 2024 · 1 comment
Open

Elasticsearch service taking too much memory [Maybe only Question] #1787

luislard opened this issue Apr 22, 2024 · 1 comment
Assignees
Labels
[Status] Needs Docs The feature or update requires an update to our public VIP Documentation [Type] Question Extra attention is needed

Comments

@luislard
Copy link

Expected/Desired Behavior

Currently when starting an environment with elasticsearch the ES container takes too much memory.

Dont know if it is a known issue or if there should be documentation on how to change the config for this.

Actual Behavior

See docker stats output:
image

Steps to Reproduce the Problem

OS: Linux Ubuntu 22.04
VIP CLI: 2.39.0

➜  ~ docker -v
Docker version 26.0.0, build 2ae903e
➜  ~ docker-compose -v
Docker Compose version v2.26.1-desktop.1
➜  ~ docker context ls
NAME                TYPE                DESCRIPTION                               DOCKER ENDPOINT                                     KUBERNETES ENDPOINT   ORCHESTRATOR
default *           moby                Current DOCKER_HOST based configuration   unix:///var/run/docker.sock                                               
desktop-linux       moby                Docker Desktop                            unix:///home/johndoe/.docker/desktop/docker.sock                         

With docker using default context (not docker desktop) and the following parameters

vip dev-env create --app-code="./vip" --slug="acme-website" \
  --title="Acme Website" --php="8.2" \
  --wordpress="6.5" \
  --mu-plugins="demo" \
  --multisite=subdirectory \
  --xdebug \
  --mailpit \
  --phpmyadmin \
  --elasticsearch \
  --photon

And then running

vip dev-env start --slug=acme-website

The container is getting too much memory.

(Optional) Additional notes

Tried this:

docker update --memory "6g" --memory-swap "6g" <container_id>

But kills the ES container.

@sjinks
Copy link
Member

sjinks commented May 6, 2024

Out of the box, Elasticsearch's default settings automatically size your JVM heap based on node role and total memory; by default, it is up to half of the physical RAM, capping at 32GB.

However, it is possible to limit ES's appetites by setting the ES_JAVA_OPTS environment variable.

What you need to do:

  1. Locate the directory where the dev env configuration is located (LOCATION in the output of vip dev-env start)
  2. In that directory, create a .lando.local.yml file with the following content:
services:
  elasticsearch:
    type: compose
    services:
      environment:
        ES_JAVA_OPTS: "-Xms512m -Xmx512m"

You must set the appropriate values for -Xms (the initial size of total heap space) and -Xmx (the maximum size of total heap space).
3. Restart your dev environment; ES should consume less memory now.

Please let me know if that helps.

@sjinks sjinks self-assigned this May 6, 2024
@sjinks sjinks added the [Type] Question Extra attention is needed label May 6, 2024
@rinatkhaziev rinatkhaziev added the [Status] Needs Docs The feature or update requires an update to our public VIP Documentation label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Docs The feature or update requires an update to our public VIP Documentation [Type] Question Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants