Terraform Enterprise and Postgres Memory Utilization in External Service Installation
Terraform Enterprise offers a range of operational modes on the installation. With
External Services mode, storage components operate independently outside Terraform Enterprise usually in dedicated servers which are required to meet certain conditions. There are guidelines available on following pages for each infrastructure architecure:
The total number of database connections are allocated proportionally depending on number of CPU cores on Terraform Enterprise host machine. Total number of database connections may climb up to approximately 200 in short time. Terraform Enterprise will also cache SQL statements on each database connection, up to 1000 entries. This setup can lead to spikes in database memory usage without load on CPU utilization. In some scenarios where insufficient database memory is available, Terraform Enterprise can become unresponsive. This can be due to the database process crashing or running out of memory, users may experience this as error messages on the UI due to database connections dropping out.
The memory size of Postgres database instance should be allocated in accordance with number of CPU cores of Terraform Enterprise host machine as per the table below:
|TFE CPU Cores
NOTE: As the maximum number of connections is capped, it is not required to increase Postgres memory size above 32GB unless additional memory is required to handle extra workload.