update memory settings

You need to get the IP address(es) of the flex indexelastic service. Please refer to inventory operation guide to find them

Pre requisites

flex installation scripts

flex inventory

access to all flex hosts through ssh using an ssh key (you can use passwords too, please read ansible documentation for this)

## Important notice

Important

Updating memory on a local file is possible but you always need to ensure the ansible scripts are updated with the correct values. If you do NOT update the ansible script, on the next deployment your values will be overriden

Updating memory on a service.

remind

never forget

  • you must have mulitple instances of the container si you will need to perform the change multiple times
  • to have the change taken into account you will need to "rerun" (not restart) the container

Update through the deployment scripts (highly recommenced)

Use Dalet collection deployment scripts

Adjusting memory requires to add the below variables into the ansible variables.yml file

dalet_flex_services_custom:
  <service_name>:
    memory:
      standard: <value_memory>
    heap:
      standard: <value_heapspace>

where: dalet_flex_services_custom: is a fixed variable name. if it already exists, just continue using it. it contains one line per service to override

  • service_name is the name of the service you want to update (ex for jobasyncexecutory the variable name is jobasyncexecutor-service

  • value_memory is the amount of memory you want to allocate. it is either specific is megabytes to gigabytes (ex: 1024m to 1g )

  • value_heapspace is the amount ofheapspace you want to allocate. only applies to java containers. heapspace amount must alway by below memory_limit. Setting it at a value of 75% the memory limit is fine. it is either specific is megabytes to gigabytes (ex: 1024m to 1g )

  • note you can add other override settings, like version

Once you have set the correct values to the variables.yml you have 2 more steps to complete the change

  • run ansible playbook with an ansible tag to only update the docker compose file ansible-playbook dalet.flex.flex -t copy_docker_compose_file -D --ask-vault-pass

Note

We recommend to firstly run the command with the option --check (dry run) to ensure modification match your requirement

Once you have updated the docker-compose file on the hosts you need to connect to the hosts using ssh and run the below command:

cd /flex
docker compose up -d

Note

Always restart the service one by one and wait it reached the healthy state (can be seen using the docker ps command) prior to proceed with the other instances of the service

Use former ansible deployment scripts

Adjusting memory requires to add the below variables into the ansible variables.yml file

flex_<service_name>_memory_limit: <value_memory>
flex_<service_name>_heapspace: <value_heapspace>

where:

  • service_name is the name of the container you want to update (ex for jobasyncexecutory-service the variable name are flex_jobasyncexecutor_service_memory_limit and flex_jobasyncexecutor_service_heapspace)

Note

  • the dash - in the service name is replaced by an underscore _
  • value_memory is the amount of memory you want to allocate. it is either specific is megabytes to gigabytes (ex: 1024m to 1g )
  • value_heapspace is the amount ofheapspace you want to allocate. only applies to java containers. heapspace amount must alway by below memory_limit. Setting it at a value of 75% the memory limit is fine. it is either specific is megabytes to gigabytes (ex: 1024m to 1g )

Once you have set the correct values to the variables.yml you have 2 more steps to complete the change

  • run ansible playbook with an ansible tag to only update the docker compose file ansible-playbook flex.yml -t copy_docker_compose_file -D --ask-vault-pass

Note

We recommend to firstly run the command with the option --check (dry run) to ensure modification match your requirement

Once you have updated the docker-compose file on the hosts you need to connect to the hosts using ssh and run the below command:

cd /flex
docker compose up -d

Note

Always restart the service one by one and wait it reached the healthy state (can be seen using the docker ps command) prior to proceed with the other instances of the service

Update on the hosts

  • connect to the hosts running the service(s) through ssh. Please refer to inventory operation guide to find them

  • Edit the file

    • when using flex collection deployment scripts edit the below file vi /flex/docker-compose.services.yml

    • when using flex former deployment scripts edit the below file vi /flex/docker-compose.yml

  • find the section related to the service you want to update (see example below)

  flex-authorisation-service:
    image: registry.opscenter.cs.dalet.cloud/flex/flex/flex-authorisation-service:10.2.39
    container_name: flex-authorisation-service
    <<: *flex-java-defaults
    ports:
      - 18124:18124
      - 18224:18224
    environment:
      - CONSUL_TOKEN=********************
      - HEAPSPACE=768m
    volumes:
      - /flex/certificates/pki-afp-rootca-1.crt:/flex/certificates/pki-afp-rootca-1.crt
      - /flex/certificates/pki-afp-rootca-2.crt:/flex/certificates/pki-afp-rootca-2.crt
      - /flex/certificates/pki-afp-rootca-3.crt:/flex/certificates/pki-afp-rootca-3.crt
      - /flex/certificates/pki-afp-rootca-4.crt:/flex/certificates/pki-afp-rootca-4.crt
      - /flex/certificates/pki-afp-rootca-5.crt:/flex/certificates/pki-afp-rootca-5.crt
      - /flex/flex-authorisation-service/logs:/flex/logs
    mem_limit: 1g

and update the 2 memory limits:

  • mem_limit is the amount of memory you want to allocate. it is either specific is megabytes to gigabytes (ex: 1024m to 1g )

  • HEAPSPACE is the amount ofheapspace you want to allocate. only applies to java containers. heapspace amount must alway by below memory_limit. Setting it at a value of 75% the memory limit is fine. it is either specific is megabytes to gigabytes (ex: 1024m to 1g )

  • Once completed re run the container to apply the change

cd /flex
docker compose up -d

Important

Remember any manual change is not taken into account except you reflect the change in the ansible deployment scripts