Skip to content

TMS database connection limits

TODO write better about this!

Currently stable has max 1000 connections, which is shared with road. TMS currently is allowed to use 150 connections PER APPLICATION PER BACKEND! If we count backends and applications together, so: * seven (7) backends times: * tms-backend-3 * tms-backend-4 * tms-backend-5 * tms-backend-6 * tms-confidential-backend-1 * tms-confidential-backend-2 * tms-confidential-backend-3 * four (4) applications: * tms-booking, * tms-fleet, * tms-drivers, * tms-planner Equals 7 × 4 = 28, then we add in the connections limit: 28 × 150 = 4200 connections

Applications using disk-based application configs have their connection limits set like this:

{{  with secret "kv-v2/data/Application-name"  }}
database:
  host: {{ .Data.data.database_host }}
  username: {{ .Data.data.database_username }}
  database: db_name
  password: "{{ .Data.data.database_password }}"
  max_open_connections: 300
  max_idle_connections: 10

Applications reading application configs from Vault have their connection limits set like this: https://vault-hetzner.aholadigital.com https://vault-hetzner-nightly.aholadigital.com

  "database": {
    "database": "<hidden-by-miro>",
    "driver": "postgres",
    "host": "<hidden-by-miro>",
    "max_idle_connections": 10,
    "max_idle_time_connection": "1h0m0s",
    "max_lifetime_connection": "6h0m0s",
    "max_open_connections": 150,
    "password": "<hidden-by-miro>",
    "username": "<hidden-by-miro>"
  },

After making changes, you have to restart the affected applications. Vault secrets are read during application startup.