Enable huge pages
AlloyDB Omni, just like PostgreSQL, supports the use of huge pages. This requires your machine to have huge pages enabled, and you also need to enable a database setting huge_pages.
Run the provided script to enable huge pages on your machine:
Docker
docker run --rm --privileged google/alloydbomni setup-host
Docker
docker run --rm --privileged google/alloydbomni setup-host
Podman
podman run --rm --privileged google/alloydbomni setup-host
Podman
podman run --rm --privileged google/alloydbomni setup-host
Add the following line to your
postgresql.confto enable huge pages:huge_pages=on
Enable swapping
Swapping in the operating system allows to extend available physical memory by moving inactive memory pages between random access memory (RAM) and the hard disk to free up RAM space for active processes. AlloyDB Omni uses swapping when it is under high load and requires extra memory.
To check how much swapping space is enabled on your system, run the following:
cat /proc/meminfo | grep SwapTotalThe output looks similar to the following:
SwapTotal: 165748732 kB
To enable swapping on your operating system if the output value is 0, see the following:
Enable core dumps
If AlloyDB Omni encounters an unrecoverable error and crashes, it is helpful to have a core dump for analysis. A core dump is a snapshot of the memory of the AlloyDB Omni process at the point of its crash.
To set up core dumps, set up kernel.core_pattern as follows:
- Use the
sysctlcommand to configure run time kernel parameters. To set the
kernel.core_patternimmediately, use:sysctl -w kernel.core_pattern="CORE_PATTERN"Replace
CORE_PATTERNwith a core filename pattern such as "%e-%t.core".For more information on core filename patterns, see How to set process core file names for details.
The systemd-coredump handler allows further configuration of your coredump settings. The tool is installed by default in RHEL. On Debian and Ubuntu systems, run
sudo apt install coredumpctlto install the tool.When you start AlloyDB Omni, ensure that you pass the
--ulimit=core:-1:-1argument in thedocker runcommand:Docker
docker run --name CONTAINER_NAME \ -e POSTGRES_PASSWORD=NEW_PASSWORD \ --ulimit=core:-1:-1 \ -p HOST_PORT:5432 -d google/alloydbomni
Docker
docker run --name CONTAINER_NAME \ -e POSTGRES_PASSWORD=NEW_PASSWORD \ --ulimit=core:-1:-1 \ -p HOST_PORT:5432 -d google/alloydbomni
Podman
podman run --name CONTAINER_NAME \ -e POSTGRES_PASSWORD=NEW_PASSWORD \ --ulimit=core:-1:-1 \ -p HOST_PORT:5432 -d google/alloydbomni
Podman
podman run --name CONTAINER_NAME \ -e POSTGRES_PASSWORD=NEW_PASSWORD \ --ulimit=core:-1:-1 \ -p HOST_PORT:5432 -d google/alloydbomni
Replace the following:
CONTAINER_NAME: the name of a new AlloyDB Omni container—for example,my-omni-1.NEW_PASSWORD: the password assigned to the new container'spostgresuser after the password creation.
Enable internal logging
AlloyDB Omni provides more messages in addition to regular PostgreSQL logs. These messages are intended for AlloyDB for PostgreSQL support because of their technical nature. However, additional information can assist in the debugging of database issues.
To enable internal logging, complete these steps:
Set the database parameter
enable_alloydb_internal_logtoon:ALTER SYSTEM SET enable_alloydb_internal_log=on;For more information about modifying AlloyDB Omni settings, see Configure AlloyDB Omni database parameters.
Restart to apply changes:
Docker
docker restart CONTAINER_NAME
Docker
docker restart CONTAINER_NAME
Podman
podman restart CONTAINER_NAME
Podman
podman restart CONTAINER_NAME
To customize internal logging such as configuring log file names and rotation policies further, use PostgreSQL parameters.
For example, the log_directory parameter specifies the directory where to save a log file and the log_filename parameter defines the name of the individual log file.
AlloyDB Omni combines the log_directory and log_filename parameters and saves internal logs as follows:
LOG_DIRECTORY/LOG_FILENAME.internal
Set up systemd units to run operations automatically
If you run AlloyDB Omni on a dedicated server, then you may want to configure certain operations to start automatically when the server boots up. One way to do this is through systemd units.
For example, the following steps configure systemd so that huge pages are enabled automatically whenever the server boots up.
Create a file in
/etc/systemd/system/alloydb-setup-env.service:[Unit] Description=Setup huge pages for AlloyDB Omni [Service] Type=oneshot ExecStart=/usr/bin/docker run --rm --privileged google/alloydbomni setup-host [Install] WantedBy=multi-user.targetEnable the service as follows:
sudo systemctl enable alloydb-setup-env.service