Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XVS9k-0006Mf-1f for pgsql-docs@arkaria.postgresql.org; Sat, 20 Sep 2014 21:25:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XVS9j-0006e5-30 for pgsql-docs@arkaria.postgresql.org; Sat, 20 Sep 2014 21:25:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XVS9h-0006du-2d for pgsql-docs@postgresql.org; Sat, 20 Sep 2014 21:25:21 +0000 Received: from blu004-omc1s12.hotmail.com ([65.55.116.23]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XVS9e-0007f7-0O for pgsql-docs@postgresql.org; Sat, 20 Sep 2014 21:25:19 +0000 Received: from BLU178-DS20 ([65.55.116.9]) by BLU004-OMC1S12.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.22724); Sat, 20 Sep 2014 14:25:16 -0700 X-TMN: [slN90Ls4G1h0M1G7nLJJ+COYgXfZ/HzU] X-Originating-Email: [greenreaper@hotmail.com] Message-ID: From: "Laurence Parry" To: Subject: Huge pages section needs to describe hugetlb_shm_group, memlock limit Date: Sat, 20 Sep 2014 22:24:51 +0100 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal Importance: Normal X-Mailer: Microsoft Windows Live Mail 16.4.3505.912 X-MimeOLE: Produced By Microsoft MimeOLE V16.4.3505.912 X-OriginalArrivalTime: 20 Sep 2014 21:25:16.0699 (UTC) FILETIME=[5F4FAEB0:01CFD519] X-Pg-Spam-Score: 2.3 (++) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org Regarding the coverage of huge pages (added in 9.4): http://www.postgresql.org/docs/9.4/static/kernel-resources.html#LINUX-HUGE-PAGES This section does not call out the need to add the PostgreSQL user to a group which has been given access to shared memory by setting its number as vm.hugetlb_shm_group, nor that the "memlock" limit needs to be raised or set to unlimited for this user. If these are not done, postgres would need to be running as a user with CAP_IPC_LOCK (e.g. root) to take advantage of large pages. These restrictions exist because reserving a large page locks it in physical memory, which can lead to resource exhaustion. Compare http://dev.mysql.com/doc/refman/5.7/en/large-page-support.html which mentions both of these issues (although it does not show adding the user to the group, just setting the group as vm.hugetlb_shm_group). An example command sequence: groupadd hugepages gpasswd -a postgres hugepages id postgres [user finds "hugepages" group has id 1234] sysctl -w vm.hugetlb_shm_group=1234 sysctl -w vm.nr_hugepages=5678 [as estimated in documentation] Edit /etc/sysctl.conf and add: vm.hugetlb_shm_group=1234 vm.nr_hugepages=5678 Add to /etc/security/limits.conf: @hugepages soft memlock unlimited @hugepages hard memlock unlimited In some cases (e.g. Debian's start-stop-daemon) the command "ulimit -l unlimited" may be needed in the PostgreSQL startup scripts instead of the limits.conf edit, because PAM limits are not called for those scripts. Hope this helps, -- Laurence "GreenReaper" Parry http://greenreaper.co.uk - http://wikifur.com - http://flayrah.com "Eternity lies ahead of us, and behind. Have you drunk your fill?" -- Sent via pgsql-docs mailing list (pgsql-docs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-docs