No internet connection
  1. Home
  2. Documentation
  3. How To

How to add more Talkyard server RAM

By KajMagnus @KajMagnus2021-07-26 20:03:27.743Z

If you're self hosted, some day you might need to add more server memory (RAM), typically to the Talkyard application server.

How to add application server memory

Do this:

  1. Increase the amount of memory available to the server (e.g. a Virtual Private Server, VPS). E.g. edit the server config in your cloud provider's admin panel.

  2. As root, verify that there's more memory available:

    $ sudo -i
    # free -m   # -m means megabytes
  3. Edit /opt/talkyard/docker-compose.override.yml and tell the Talkyard application server to make use of this memory: (otherwise it'll think it's for PostgreSQL's file cache or ElasticSearch or something else)

          PLAY_HEAP_MEMORY_MB: NNNN  <—— change this
  4. Recreate the application server Docker container, to make the changes take effect: (this is easy to forget)

    docker-compose stop app     # stops the app server
    docker-compose rm -f app    # removes the app server container
    docker-compose up -d app    # recreates the container — with the new memory settings
    # And check that it starts up properly:
    docker-compose logs -f app

Now the app server has more memory.

Verify that it worked

If you'd like to check that the changes have indeed taken effect, you can, as root:

## jump into the app server container:
root# cd /opt/talkyard/
root# docker-compose exec app bash

## Now you're in a shell in the app server container.
## Check  the free memory — the 'total' column matches the total server RAM in MB:
bash-4.4# free -m
             total       used       free     shared    buffers     cached
Mem:          7962       4942       3019        140         69       1120
-/+ buffers/cache:       3752       4210
Swap:            0          0          0

And verify that the app server was started with the new memory configuration; -Xms2200m should match PLAY_HEAP_MEMORY_MB.

bash-4.4# ps aux  
    1 root      0:06 /usr/lib/jvm/java-1.8-openjdk/bin/java -Duser.dir=/opt/talkyard/app -Xms2200m -Xmx2200m ...
   78 root      0:00 bash
   89 root      0:00 ps aux

If -Xms ... is wrong, you might have forgotten step 3 or 4 above, i.e. to edit the config file, and to recreate the app server.

  • 0 replies