Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uCcW8-00HX8D-Qp for pgsql-general@arkaria.postgresql.org; Wed, 07 May 2025 11:00:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uCcW7-00DYkn-T0 for pgsql-general@arkaria.postgresql.org; Wed, 07 May 2025 11:00:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uCcW7-00DYkF-HU for pgsql-general@lists.postgresql.org; Wed, 07 May 2025 11:00:47 +0000 Received: from mail-ed1-x52b.google.com ([2a00:1450:4864:20::52b]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uCcW4-000cHK-2f for pgsql-general@lists.postgresql.org; Wed, 07 May 2025 11:00:47 +0000 Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-5fbfdf7d353so90045a12.0 for ; Wed, 07 May 2025 04:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1746615644; x=1747220444; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=e7QMWuBDfLZ6kydy4AmnvvqhIn5XeukfRyJWDTa8YGQ=; b=eXx3/L4kISFEsNo5uotunv4anX/ixLEUEcUqlhjU7L35cMiua7TfWN6bzHr4GCsdtT S7ZIfjqu2O4qz0Qno+LCUx5tCROrxlSXw8dnh02xQyb5xlJ/o2arkrflMUxSP6FcdmDO ZxRrVSWJjEsG0Z0MFT2wXiRpq+thKAhD9q1c8KhHwPmDuvU3ArmVax2FdxmfNLxOsLUA SlIkdQd8Gqbzim58vM9aO+GN1hX7/ZV+EQtQ3MDvzhCr1qMP/LJPQyVUCMZH1OE46BKS F6tjfJfpj9UMt56fZTbcy4OQAI1dsmBBJHdP6svKV28HQ5VnQetfVPD6iE3+6wc/qCa4 pSIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1746615644; x=1747220444; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=e7QMWuBDfLZ6kydy4AmnvvqhIn5XeukfRyJWDTa8YGQ=; b=IB+3I/qZO8ZrhEtGxJDVG+NTAP9ppqRFRixN+wZRlenHw10CPmlajrUH03aQhxBJmO 0UZNbpC5htAI9OQ8pKfQfFy8nPujWjW8/yf1LeRcQ9At1w+zHa4j6neWDRSUGX3A7O0M uC3RlQBy7+Vzg0rJ6SYMmKVhbb+gg2K6aoTIwPortcm9UWH+nnBglZ0T4XQ6awzGaaln ytBz5J4wzvjT2HZu5P7AVR+YvT6PS9ypwGawLy6uLMqn8vxZ9nvuKj9jxvggalHe8Unk fMmfvWE7Rv6v6eNSYwHqXE28Dj3tqzQAMHFZprDpVY6qIPPGOuvZZ+j3eOLH6DFLPQYd x9cA== X-Gm-Message-State: AOJu0YxVQAAZXwQlqC7IgwNStFshbz1wtNUlH+a1lFpgBeZdMWJ5gf8W XNAVBLOXWGbSygn8Jp4JC2wNTmyCtY+TxY5LT43U6i41xQ3vYXsSU7Lnyr5YiW/hEKNaAy8mvwj J5cNqCueErYweJd+sFGhmE5S0lGUnlcFs X-Gm-Gg: ASbGnct6T18xuSbYNlc88vWwJGyG7wTz7IWJ8q68Z0ppYHbvvqnSUb99pyED8gDXP1n eFPzCfErWjvVPaVcsc77PfyadGO3UD7dwQwFne1A5BcuPITbLvxPl+7MHouFiBbJixiHn1tgn3U OTIBhryLoDXtsi6YEkq/7kh/A= X-Google-Smtp-Source: AGHT+IF0Kq3XnSwlamkYbXXJ8mJe6p3tKhrtyhNwwIQRXQ2DkAyA0eU9XQSMhqaOlZlQPo2YLFL1kTvNBVtXjE4hEzk= X-Received: by 2002:a17:906:c153:b0:ac3:3e40:e182 with SMTP id a640c23a62f3a-ad1e8ce4c67mr295215166b.19.1746615644082; Wed, 07 May 2025 04:00:44 -0700 (PDT) MIME-Version: 1.0 From: Bogdan Siara Date: Wed, 7 May 2025 13:00:18 +0200 X-Gm-Features: ATxdqUHlnGl1_dkkBdc_MbGrCQ08mDpl5SBG0-lSAFLI2h9Wiehh02Pujk_VjAE Message-ID: Subject: huge_pages=on cause could not map anonymous shared memory: Cannot allocate memory To: pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000065609063489a5c1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000065609063489a5c1 Content-Type: text/plain; charset="UTF-8" Hi, I have problem to run postgresql on ubuntu 24.04 server with huge_pages = on. My instance have 8GB ram and 2 vcpus (t3a.large). My configuration is: max_connections = 1000 superuser_reserved_connections = 3 shared_buffers = 1960MB effective_cache_size = 5881MB huge_pages = on temp_buffers = 32MB max_prepared_transactions = 100 work_mem = 1MB maintenance_work_mem = 392MB max_stack_depth = 4MB dynamic_shared_memory_type = posix archive_mode = on max_wal_senders = 10 wal_sender_timeout = 0 min_wal_size = 4GB max_wal_size = 16GB wal_level = logical checkpoint_timeout = 15min checkpoint_completion_target = 0.9 In my sysct.conf I have: vm.overcommit_memory=2 vm.overcommit_ratio=50 vm.vfs_cache_pressure=50 vm.dirty_background_ratio=10 vm.dirty_ratio=40 fs.nr_open=10000000 fs.file-max=10000000 vm.nr_hugepages=980 vm.hugetlb_shm_group=1010 my huge meminfo looks: cat /proc/meminfo | grep -i huge AnonHugePages: 0 kB ShmemHugePages: 0 kB FileHugePages: 0 kB HugePages_Total: 980 HugePages_Free: 980 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB Hugetlb: 2007040 kB When I start postgres instance I get error: May 07 10:56:32 pg1 pg_ctl[16753]: server starting May 07 10:56:32 pg1 systemd[1]: Started postgres-17.4-local.service - PostgreSQL 17.4 database local server. May 07 10:56:35 pg1 pg_ctl[16756]: 2025-05-07 10:56:35.826 CEST [16756] - [ - - ] [] : XX000FATAL: could not map anonymous shared memory: Cannot allocate memory May 07 10:56:35 pg1 pg_ctl[16756]: 2025-05-07 10:56:35.826 CEST [16756] - [ - - ] [] : XX000HINT: This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 2204106752 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing "shared_buffers" or "max_connections". May 07 10:56:35 pg1 pg_ctl[16756]: 2025-05-07 10:56:35.826 CEST [16756] - [ - - ] [] : 00000LOG: database system is shut down May 07 10:56:35 pg1 systemd[1]: postgres-17.4-sdx.service: Main process exited, code=exited, status=1/FAILURE May 07 10:56:35 pg1 systemd[1]: postgres-17.4-sdx.service: Failed with result 'exit-code'. May 07 10:56:35 pg1 systemd[1]: postgres-17.4-sdx.service: Consumed 3.493s CPU time, 2.8M memory peak, 0B memory swap peak. When I comment #huge_pages=on in configuration postgresql started without problems. Can someone tell me where is the problem? Regards Bogdan --000000000000065609063489a5c1 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,
I have problem to run postgresql on ubuntu 24.04 s= erver with huge_pages =3D on. My instance have 8GB ram and 2 vcpus (t3a.lar= ge). My configuration is:

max_connections =3D 1000=
superuser_reserved_connections =3D 3
shared_buffers =3D 1960MB
ef= fective_cache_size =3D 5881MB
huge_pages =3D on
temp_buffers =3D 32MB=
max_prepared_transactions =3D 100
work_mem =3D 1MB
maintenance_wo= rk_mem =3D 392MB
max_stack_depth =3D 4MB
dynamic_shared_memory_type = =3D posix
archive_mode =3D on
max_wal_senders =3D 10
wal_se= nder_timeout =3D 0
min_wal_size =3D 4GB
max_wal_size =3D 16GB
wal= _level =3D logical
checkpoint_timeout =3D 15min
checkpoint_completion= _target =3D 0.9

In my sysct.conf I have:

vm.overcommit_memory=3D2
vm.overcommit_ratio=3D50
vm.= vfs_cache_pressure=3D50
vm.dirty_background_ratio=3D10
vm.dirty_ratio= =3D40
fs.nr_open=3D10000000
fs.file-max=3D10000000
vm.nr_hugepages= =3D980
vm.hugetlb_shm_group=3D1010

my huge memi= nfo looks:

cat /proc/meminfo | grep -i huge
AnonHugePages: =C2=A0= =C2=A0 =C2=A0 =C2=A0 0 kB
ShmemHugePages: =C2=A0 =C2=A0 =C2=A0 =C2=A00 = kB
FileHugePages: =C2=A0 =C2=A0 =C2=A0 =C2=A0 0 kB
HugePages_Total: = =C2=A0 =C2=A0 980
HugePages_Free: =C2=A0 =C2=A0 =C2=A0980
HugePages_R= svd: =C2=A0 =C2=A0 =C2=A0 =C2=A00
HugePages_Surp: =C2=A0 =C2=A0 =C2=A0 = =C2=A00
Hugepagesize: =C2=A0 =C2=A0 =C2=A0 2048 kB
Hugetlb: =C2=A0 = =C2=A0 =C2=A0 =C2=A0 2007040 kB

When I start postg= res instance I get error:
May 07 10:56:32 pg1 pg_ctl[16753]: serv= er starting
May 07 10:56:32 pg1 systemd[1]: Started postgres-17.4-local.= service - PostgreSQL 17.4 database local server.
May 07 10:56:35 pg1 pg_= ctl[16756]: 2025-05-07 10:56:35.826 CEST [16756] - [ - =C2=A0- ] [] : XX000= FATAL: =C2=A0could not map anonymous shared memory: Cannot allocate memory<= br>May 07 10:56:35 pg1 pg_ctl[16756]: 2025-05-07 10:56:35.826 CEST [16756] = - [ - =C2=A0- ] [] : XX000HINT: =C2=A0This error usually means that Postgre= SQL's request for a shared memory segment exceeded available memory, sw= ap space, or huge pages. To reduce the request size (currently 2204106752 b= ytes), reduce PostgreSQL's shared memory usage, perhaps by reducing &qu= ot;shared_buffers" or=C2=A0"max_connections".
May 07 10:5= 6:35 pg1 pg_ctl[16756]: 2025-05-07 10:56:35.826 CEST [16756] - [ - =C2=A0- = ] [] : 00000LOG: =C2=A0database system is shut down
May 07 10:56:35 pg1 = systemd[1]: postgres-17.4-sdx.service: Main process exited, code=3Dexited, = status=3D1/FAILURE
May 07 10:56:35 pg1 systemd[1]: postgres-17.4-sdx.ser= vice: Failed with result 'exit-code'.
May 07 10:56:35 pg1 system= d[1]: postgres-17.4-sdx.service: Consumed 3.493s CPU time, 2.8M memory peak= , 0B memory swap peak.

When I comment #huge_pages= =3Don in configuration postgresql started without problems.
Can s= omeone tell me where is the problem?

Regards
=
Bogdan
--000000000000065609063489a5c1--