Select a documentation version: <button class="button button-with-icon cloud-select-dropdown__button button-primary" aria-haspopup="true">18.4.0</button>

- [Current (18.4.0)](https://docs.cloud.google.com/alloydb/omni/linux/current/docs/configure-omni.md.txt)
- [18.4.0](https://docs.cloud.google.com/alloydb/omni/linux/18.4.0/docs/configure-omni.md.txt)
- [18.3.0](https://docs.cloud.google.com/alloydb/omni/linux/18.3.0/docs/configure-omni.md.txt)
- [18.1.0](https://docs.cloud.google.com/alloydb/omni/linux/18.1.0/docs/configure-omni.md.txt)

<br />

This page shows common settings when using AlloyDB Omni for production workloads.

<br />

## 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`.

To enable huge pages on your Linux machine, run the following command:

```bash
sudo /usr/lib/postgresql/MAJOR_VERSION/bin/alloydbomniMAJOR_VERSION-setup-host
```
Add the following line to your `postgresql.conf` to enable huge pages:

<br />

```bash
   huge_pages=on
```

## Enable swapping

Swapping in the operating system lets you 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:

```bash
   cat /proc/meminfo | grep SwapTotal
```

The 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:
- [Red Hat Enterprise Linux 9](https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/managing_storage_devices/getting-started-with-swap_managing-storage-devices#creating-an-lvm2-logical-volume-for-swap_getting-started-with-swap)

## 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:
  1. Use the `sysctl` command to configure run time kernel parameters.
  2. To set the `kernel.core_pattern` immediately, use:

     ```bash
     sysctl -w kernel.core_pattern="CORE_PATTERN"
     ```

     Replace `CORE_PATTERN` with a core filename pattern such as "%e-%t.core".

     For more information on core filename patterns, see
     [How to set process core file names](https://access.redhat.com/solutions/901293#:%7E:text=an%20unknown%20key-,Resolution,-In%20current%20linux%22)
     for details.

     The [systemd-coredump handler](https://systemd.io/COREDUMP/) allows further
     configuration of your coredump settings. The tool is installed by default in
     RHEL.
- To ensure the AlloyDB Omni process can generate full core dumps without any size limitations, configure the systemd service by adding `LimitCORE=infinity` to the `[Service]` section of your `alloydbomniMAJOR_VERSION.service` file.
  1. Create an override file for `alloydbomniMAJOR_VERSION.service`
     in `/etc/systemd/system/alloydbomniMAJOR_VERSION.service.d/override.conf`.
     Add the following to the `override.conf` file:

     ```ini
       [Service]
       LimitCORE=infinity
     ```
  2. Reload the systemd daemon to apply the changes:

     ```bash
       sudo systemctl daemon-reload
     ```
  3. Restart the AlloyDB Omni service:

     ```bash
       sudo systemctl restart alloydb-omniMAJOR_VERSION
     ```

## Enable internal logging

- AlloyDB Omni provides more messages in addition to regular [PostgreSQL logs](https://www.postgresql.org/docs/current/runtime-config-logging.html). 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:
  1. Set the database parameter `enable_alloydb_internal_log` to `on`:

     ```sql
     ALTER SYSTEM SET enable_alloydb_internal_log=on;
     ```

     For more information about modifying AlloyDB Omni settings, see
     [Configure AlloyDB Omni database parameters](https://docs.cloud.google.com/alloydb/omni/linux/current/docs/configure-database-flags.md.txt).
  2. Restart the AlloyDB Omni service:

```bash
   sudo systemctl restart alloydb-omniMAJOR_VERSION
```
- To customize internal logging such as configuring log file names and rotation policies further, use [PostgreSQL parameters](https://www.postgresql.org/docs/current/runtime-config-logging.html).
- 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`:

```ini
   [Unit]
   Description=Setup huge pages for AlloyDB Omni

   [Service]
   Type=oneshot

   ExecStart=/usr/lib/postgresql/MAJOR_VERSION/bin/alloydbomniMAJOR_VERSION-setup-host

   [Install]
   WantedBy=multi-user.target
```
- Enable the service as follows:

```bash
   sudo systemctl enable alloydb-setup-env.service
```

## What's next

  - [Protect your data using Barman](https://docs.cloud.google.com/alloydb/omni/linux/current/docs/install-configure-barman.md.txt).

  - [Create a read-only replica in Linux](https://docs.cloud.google.com/alloydb/omni/linux/current/docs/set-up-read-replica.md.txt).