Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kfJdi-0000Bp-KY for pgsql-general@arkaria.postgresql.org; Wed, 18 Nov 2020 09:20:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kfJdh-0006WT-JR for pgsql-general@arkaria.postgresql.org; Wed, 18 Nov 2020 09:20:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kf9JO-0004I4-HP for pgsql-general@lists.postgresql.org; Tue, 17 Nov 2020 22:18:54 +0000 Received: from mail.mhsoftware.com ([204.144.128.66]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kf9JM-0001y8-A0 for pgsql-general@lists.postgresql.org; Tue, 17 Nov 2020 22:18:53 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.mhsoftware.com (Postfix) with ESMTP id 8AFF9300696 for ; Tue, 17 Nov 2020 15:18:51 -0700 (MST) X-Virus-Scanned: amavisd-new at mhsoftware.com Received: from mail.mhsoftware.com ([127.0.0.1]) by localhost (mail.mhsoftware.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FGrwkecUTYej for ; Tue, 17 Nov 2020 15:18:47 -0700 (MST) Received: from [192.168.1.153] (c-67-190-58-109.hsd1.co.comcast.net [67.190.58.109]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by mail.mhsoftware.com (Postfix) with ESMTPSA id 4846E300CC9 for ; Tue, 17 Nov 2020 15:18:47 -0700 (MST) To: pgsql-general@lists.postgresql.org From: George Sexton Subject: Postgres on Kubernetes/VMware Message-ID: <82f63aa3-6d11-1361-1457-12829c05cf2a@mhsoftware.com> Date: Tue, 17 Nov 2020 15:18:45 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.3 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------EF65871315D092466B181E14" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------EF65871315D092466B181E14 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Everyone,  I’ve run into an issue that’s got me stumped and I would be really grateful for any ideas. We’re deploying Postgres 11.8 on Kubernetes 1.17.9. The nodes are running RedHat EL 7.9 with the latest kernel for that distribution.  We create a Kubernetes pod that runs Postgres. It’s setup with /pgdata going to a PersistentVolumeClaim that’s thin provisioned with a size set at 500GB. Initially, the allocated size of the PersistentVolumeClaim’s corresponding disk file (VMware .VMDK) is around 12GB. However, the size of the .VMDK keeps increasing at roughly 150-300MB/Hour even though the size of the /pgdata folder as shown by df is stable around 230MB. To try to troubleshoot this, I set up Postgres to put the pg_wal folder on a different partition. That didn’t make any difference.  Replication is turned on for this Postgres instance, and it was observed that the replica’s .VMDK file grew at a rate of 25MB/Hour.  I’ve checked to make sure that the partition is mounted with the DISCARD option. I created a test program that would allocate disk space, and then free it. I confirmed that when DISCARD is used for mount, VMware will reclaim the space as expected. For example, if the .VMDK grows to 20GB during a test, it shrinks back down to some size like 1GB when the test completes.  To try to sort this out, I’ve done the following: 1. Written the test program and confirmed that on the ESXI Host/VCenter space reclamation works. 2. Moved the pg_wal directory to another partition. 3. Changed Auto-Vacuum frequency to run less often (12 hours). 4. Executed “vacuum full”, followed by fstrim from the Kubernetes node. This freed perhaps 12 MB from the /pgdata folder, and around 19MB from the .VMDK size. 5. Checked the /proc/fd descriptors for the running connections and confirmed no unusual temp files are opened. 6. Confirmed the replication is working as expected. 7. Set archive_mode off to eliminate that as a source of noise.  Does anyone have any ideas about what’s causing this? Is there anything unusual about how Postgres allocates temporary data files or frees them? I’m really just grasping. Thanks for looking! George --------------EF65871315D092466B181E14 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit

Everyone,

 I’ve run into an issue that’s got me stumped and I would be really grateful for any ideas. We’re deploying Postgres 11.8 on Kubernetes 1.17.9. The nodes are running RedHat EL 7.9 with the latest kernel for that distribution.

 We create a Kubernetes pod that runs Postgres. It’s setup with /pgdata going to a PersistentVolumeClaim that’s thin provisioned with a size set at 500GB. Initially, the allocated size of the PersistentVolumeClaim’s corresponding disk file (VMware .VMDK) is around 12GB. However, the size of the .VMDK keeps increasing at roughly 150-300MB/Hour even though the size of the /pgdata folder as shown by df is stable around 230MB. To try to troubleshoot this, I set up Postgres to put the pg_wal folder on a different partition. That didn’t make any difference.

 Replication is turned on for this Postgres instance, and it was observed that the replica’s .VMDK file grew at a rate of 25MB/Hour.

 I’ve checked to make sure that the partition is mounted with the DISCARD option. I created a test program that would allocate disk space, and then free it. I confirmed that when DISCARD is used for mount, VMware will reclaim the space as expected. For example, if the .VMDK grows to 20GB during a test, it shrinks back down to some size like 1GB when the test completes.

 To try to sort this out, I’ve done the following:

  1. Written the test program and confirmed that on the ESXI Host/VCenter space reclamation works.
  2. Moved the pg_wal directory to another partition.
  3. Changed Auto-Vacuum frequency to run less often (12 hours).
  4. Executed “vacuum full”, followed by fstrim </mount point> from the Kubernetes node. This freed perhaps 12 MB from the /pgdata folder, and around 19MB from the .VMDK size.
  5. Checked the /proc/fd descriptors for the running connections and confirmed no unusual temp files are opened.
  6. Confirmed the replication is working as expected.
  7. Set archive_mode off to eliminate that as a source of noise.

 Does anyone have any ideas about what’s causing this? Is there anything unusual about how Postgres allocates temporary data files or frees them? I’m really just grasping. Thanks for looking!

 

George --------------EF65871315D092466B181E14--