AlloyDB Omni, seperti PostgreSQL, mendukung penggunaan halaman besar. Hal ini mengharuskan mesin Anda mengaktifkan halaman besar, dan Anda juga perlu mengaktifkan setelan database huge_pages.
Jalankan skrip yang disediakan untuk mengaktifkan huge page di mesin Anda:
Tambahkan baris berikut ke postgresql.conf Anda untuk mengaktifkan huge page:
huge_pages=on
Mengaktifkan penukaran
Proses swapping di sistem operasi memungkinkan perluasan memori fisik yang tersedia dengan memindahkan halaman memori yang tidak aktif antara memori akses acak (RAM) dan hard disk untuk mengosongkan ruang RAM bagi proses aktif. AlloyDB Omni menggunakan pertukaran saat berada di bawah beban tinggi dan memerlukan memori tambahan.
Untuk memeriksa seberapa banyak ruang swap yang diaktifkan di sistem Anda, jalankan perintah berikut:
cat/proc/meminfo|grepSwapTotal
Outputnya terlihat mirip dengan yang berikut ini:
SwapTotal: 165748732 kB
Untuk mengaktifkan pertukaran di sistem operasi Anda jika nilai outputnya adalah 0, lihat berikut:
Jika AlloyDB Omni mengalami error yang tidak dapat dipulihkan dan mengalami error, akan sangat membantu jika ada core dump untuk dianalisis. Core dump adalah snapshot memori proses AlloyDB Omni pada saat error.
Untuk menyiapkan core dump, siapkan kernel.core_pattern sebagai berikut:
Gunakan perintah sysctl untuk mengonfigurasi parameter kernel run time.
Untuk segera menyetel kernel.core_pattern, gunakan:
posix-terminal
sysctl -w kernel.core_pattern="CORE_PATTERN"
Ganti CORE_PATTERN dengan pola nama file inti seperti "%e-%t.core".
Untuk mengetahui informasi selengkapnya tentang pola nama file inti, lihat Cara menetapkan nama file inti proses untuk mengetahui detailnya.
Handler systemd-coredump memungkinkan konfigurasi lebih lanjut setelan coredump Anda. Alat ini diinstal secara default di RHEL. Di sistem Debian dan Ubuntu, jalankan sudo apt install coredumpctl untuk menginstal alat.
Saat memulai AlloyDB Omni, pastikan Anda meneruskan argumen --ulimit=core:-1:-1 dalam perintah docker run:
posix-terminal
docker run --name CONTAINER_NAME \
-e POSTGRES_PASSWORD=NEW_PASSWORD \
--ulimit=core:-1:-1 \
-p HOST_PORT:5432 -d google/alloydbomni
Ganti yang berikut:
CONTAINER_NAME: nama container AlloyDB Omni baru—misalnya, my-omni-1.
<code>NEW_PASSWORD: sandi yang ditetapkan untuk pengguna postgres penampung baru setelah pembuatannya.
Menyiapkan unit systemd untuk menjalankan operasi secara otomatis
Jika menjalankan AlloyDB Omni di server khusus, Anda mungkin ingin mengonfigurasi operasi tertentu agar dimulai secara otomatis saat server di-boot. Salah satu cara untuk melakukannya adalah melalui unit systemd.
Misalnya, langkah-langkah berikut mengonfigurasi systemd sehingga huge page diaktifkan secara otomatis setiap kali server di-boot.
Buat file di /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.target
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-03 UTC."],[[["\u003cp\u003eThis page provides essential settings for optimizing AlloyDB Omni for production environments, focusing on single-server configurations.\u003c/p\u003e\n"],["\u003cp\u003eEnabling huge pages enhances performance, requiring both machine configuration via a script and setting \u003ccode\u003ehuge_pages=on\u003c/code\u003e in \u003ccode\u003epostgresql.conf\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eSwapping is supported to extend available memory, and you should verify and enable sufficient swap space on your OS to allow the database to have additional memory to use.\u003c/p\u003e\n"],["\u003cp\u003eCore dumps, essential for debugging crashes, can be enabled by setting \u003ccode\u003ekernel.core_pattern\u003c/code\u003e and passing the \u003ccode\u003e--ulimit=core:-1:-1\u003c/code\u003e argument when starting the container.\u003c/p\u003e\n"],["\u003cp\u003eFor dedicated servers, systemd units can automate operations like enabling huge pages upon server boot.\u003c/p\u003e\n"]]],[],null,["# Set up AlloyDB Omni for production\n\nSelect a documentation version: 15.5.4keyboard_arrow_down\n\n- [Current (16.8.0)](/alloydb/omni/current/docs/configure-omni)\n- [16.8.0](/alloydb/omni/16.8.0/docs/configure-omni)\n- [16.3.0](/alloydb/omni/16.3.0/docs/configure-omni)\n- [15.12.0](/alloydb/omni/15.12.0/docs/configure-omni)\n- [15.7.1](/alloydb/omni/15.7.1/docs/configure-omni)\n- [15.7.0](/alloydb/omni/15.7.0/docs/configure-omni)\n- [15.5.5](/alloydb/omni/15.5.5/docs/configure-omni)\n- [15.5.4](/alloydb/omni/15.5.4/docs/configure-omni)\n- [15.5.2](/alloydb/omni/15.5.2/docs/configure-omni)\n\n\u003cbr /\u003e\n\nThis page shows common settings when using AlloyDB Omni for production workloads.\n\n\u003cbr /\u003e\n\n### Single-server\n\nEnable huge pages\n-----------------\n\nAlloyDB 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`.\n\n1. Run the provided script to enable huge pages on your machine:\n\n docker run --rm --privileged google/alloydbomni setup-host\n\n2. Add the following line to your `postgresql.conf` to enable huge pages:\n\n huge_pages=on\n\nEnable swapping\n---------------\n\nSwapping 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.\n\nTo check how much swapping space is enabled on your system, run the following: \n\n cat /proc/meminfo | grep SwapTotal\n\nThe output looks similar to the following: \n\n SwapTotal: 165748732 kB\n\nTo enable swapping on your operating system if the output value is `0`, see the following:\n\n- [Debian](https://wiki.debian.org/Swap)\n- [Ubuntu](https://help.ubuntu.com/community/SwapFaq)\n- [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)\n\nEnable core dumps\n-----------------\n\nIf 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.\n\nTo set up core dumps, set up `kernel.core_pattern` as follows:\n\n1. Use the `sysctl` command to configure run time kernel parameters.\n2. To set the `kernel.core_pattern` immediately, use: `posix-terminal\n sysctl -w kernel.core_pattern=\"`\u003cvar translate=\"no\"\u003eCORE_PATTERN\u003c/var\u003e`\"` Replace \u003cvar translate=\"no\"\u003eCORE_PATTERN\u003c/var\u003e 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. On Debian and Ubuntu systems, run `sudo apt install coredumpctl` to install the tool. When you start AlloyDB Omni, ensure that you pass the `--ulimit=core:-1:-1` argument in the `docker run` command: `posix-terminal\n docker run --name `\u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e` \\\n -e POSTGRES_PASSWORD=`\u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e` \\\n --ulimit=core:-1:-1 \\\n -p HOST_PORT:5432 -d google/alloydbomni` Replace the following:\n\n- \u003cvar translate=\"no\"\u003eCONTAINER_NAME\u003c/var\u003e: the name of a new AlloyDB Omni container---for example, `my-omni-1`.\n- `\u003ccode\u003e`\u003cvar translate=\"no\"\u003eNEW_PASSWORD\u003c/var\u003e: the password assigned to new container's `postgres` user after its creation.\n\nSet up systemd units to run operations automatically\n----------------------------------------------------\n\nIf 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.\n\nFor example, the following steps configure `systemd` so that huge pages are enabled automatically whenever the server boots up.\n\n1. Create a file in `/etc/systemd/system/alloydb-setup-env.service`:\n\n [Unit]\n Description=Setup huge pages for AlloyDB Omni\n\n [Service]\n Type=oneshot\n\n ExecStart=/usr/bin/docker run --rm --privileged google/alloydbomni setup-host\n\n [Install]\n WantedBy=multi-user.target\n\n2. Enable the service as follows:\n\n sudo systemctl enable alloydb-setup-env.service\n\nWhat's next\n-----------\n\n- [Run and connect to AlloyDB Omni](/alloydb/omni/15.5.4/docs/run-connect)\n\n- [Manage AlloyDB Omni](/alloydb/omni/15.5.4/docs/manage)\n\n- [Create a read-only replica](/alloydb/omni/15.5.4/docs/set-up-read-replica)\n\n- [Manage backup and restore](/alloydb/omni/15.5.4/docs/backup-kubernetes)\n\n- [Create read pool instance in Kubernetes](/alloydb/omni/15.5.4/docs/kubernetes-read-pool)\n\n- [Use a sidecar container in Kubernetes](/alloydb/omni/15.5.4/docs/kubernetes-sidecar-container)"]]