Skip to main content

Aiven for PostgreSQL

Aiven for PostgreSQL agent setup

For an overview of how the DBtune agent works, see agent overview.

Prerequisites

Before starting the DBtune agent, ensure you have completed the database setup steps and agent prerequisites.

Setting up the agent

Run the DBtune agent using Docker with Aiven-specific configuration:

docker run --restart always --detach \
-e DBT_POSTGRESQL_CONNECTION_URL="postgresql://..." \
-e DBT_AIVEN_API_TOKEN=your-api-token \
-e DBT_AIVEN_PROJECT_NAME=your-project-name \
-e DBT_AIVEN_SERVICE_NAME=your-service-name \
-e DBT_DBTUNE_SERVER_URL=https://app.dbtune.com \
-e DBT_DBTUNE_API_KEY=your-dbtune-api-key \
-e DBT_DBTUNE_DATABASE_ID=your-dbtune-database-id \
public.ecr.aws/dbtune/dbtune/agent:latest --aiven

For information about common environment variables (DBT_DBTUNE_* and DBT_POSTGRESQL_*), see agent overview - common environment variables.

Aiven-specific environment variables

VariableDescription
DBT_AIVEN_API_TOKENThe token to call Aiven's API for your account.
DBT_AIVEN_PROJECT_NAMEName of the project within your service is running.
DBT_AIVEN_SERVICE_NAMEName of your Aiven PostgreSQL service.

Parameters tuned

DBtune supports multiple tuning modes that determine which parameters can be optimized. For a detailed explanation of tuning modes, see tuning modes.

note

More parameters will be tuned by DBtune when Aiven opens them through their APIs. Check this page regularly for updates.

Reload-only tuning mode

The following parameters are tuned in reload-only mode:

  1. work_mem
  2. bgwriter_delay
  3. bgwriter_lru_maxpages
  4. max_parallel_workers
  5. max_parallel_workers_per_gather

Restart tuning mode

The following parameter is tuned in restart mode, in addition to all reload-only parameters:

  1. shared_buffers
note

We use the Aiven API to modify parameters, which limits the set of available parameters that we would normally tune for restart tuning mode.

Aiven-specific monitoring details

Metrics are collected every 30 seconds, rather than the standard 5 seconds. This is due to Aiven's API limitations. DBtune gathers these metrics by reading from system tables, as well as calling the Aiven API.

DBtune queries system metrics to ensure production safety. For up-to-date details, you can refer to the open-source agent.