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 1jxdy3-0003ZR-8s for pgsql-admin@arkaria.postgresql.org; Mon, 20 Jul 2020 22:09:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jxdy0-0007D3-5m for pgsql-admin@arkaria.postgresql.org; Mon, 20 Jul 2020 22:09:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jxdxz-0007Cw-Pt for pgsql-admin@lists.postgresql.org; Mon, 20 Jul 2020 22:08:59 +0000 Received: from mail-qv1-xf43.google.com ([2607:f8b0:4864:20::f43]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jxdxr-0007yA-U6 for pgsql-admin@postgresql.org; Mon, 20 Jul 2020 22:08:58 +0000 Received: by mail-qv1-xf43.google.com with SMTP id m9so8405878qvx.5 for ; Mon, 20 Jul 2020 15:08:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=TR9c4NUiRN1CcZUkV2Q7PmNOzTPmjw6CppYuvrVwGIQ=; b=KidVE1GFCPViRBLb2XG4gwbVXeg3qwzA3lbUkG+cFdqC7T/llKP83Re4/rjBiBouAk 7+P7g/zEaq8KlrnA/wTuqp2vMOy2e0IHmRk1zWV6KUevYS4NxbpNV9QSEXfSueQkcfzw HjgZFbc8+R/2p74gJ6/DlbRNuZPFkoEOUuItoT90yDYB3sbQY7okNgWOYvPjAK4gBqLE hmEXy7xCr8mbVUivH4F9lXLLFWIgSPtrzhdiXTbcefy/CI6XDxLyHQwehv4grkmAGAt9 7JT27VX0MSO+dTnDD27HoQFkD+BNjp3tOgwMTLWpoyLBnKCJSKd0/5rQBQ0MwE3cccrX oM3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=TR9c4NUiRN1CcZUkV2Q7PmNOzTPmjw6CppYuvrVwGIQ=; b=pBvnZe37/Iw0jXXoBvY2j9xIsioKmhlElGqGptbjaMXCP0vgOn4vmywTtopzPM+3qI vJfwgc6VhuyydezIJ3SBm/aUpol6/jfLaUDTgSSOwqQ3TAcY92rYzTo56s6c0QzJHDLd adiLP7ZXXxDo7HWeuJqprJDNFWcfmo38RFB1E3Y+QjxHLV5sWTxfLJkB95Udkc/V4ARL F4kRbjojQerAf278JPO1D2h158CAE9yYM7iKYF5tdk0EPr6MbqQZ5heUbHzoy4ZVWtzR /A3Hg9SgxPEvmiYtMltSCqgDTpooElZdubaIFva889Nd5kfZNZVX+tv+XN6108TPGerb renw== X-Gm-Message-State: AOAM533E/T0dQpotv8fG7puVXGmSYTzIntjkeHdgNopSKFus0H7LxyL1 fkm6WkYm9Q6dj4Gvl5qUQKaErA== X-Google-Smtp-Source: ABdhPJxVaM+OUZE1Y6f7jp37aTuQaupZLUioLjA2PK5bxVWfZVuMnM+pVL1VAjhwdK55BaOeBmz6tg== X-Received: by 2002:a05:6214:a72:: with SMTP id ef18mr23621162qvb.166.1595282930156; Mon, 20 Jul 2020 15:08:50 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id o184sm837532qkd.41.2020.07.20.15.08.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 15:08:49 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id E49A22A1DF9; Mon, 20 Jul 2020 18:08:47 -0400 (-04) Date: Mon, 20 Jul 2020 18:08:47 -0400 From: Alvaro Herrera To: jian xu Cc: MichaelDBA , Scott Ribe , Laurenz Albe , "pgsql-admin@postgresql.org" Subject: Re: checkpoint process use too much memory Message-ID: <20200720220847.GA28454@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Jul-20, jian xu wrote: > we are seeing this issue again, the checkpoint process is eating up all the memory, > based on the htop, the checkpointer process has > VIRT: 103G > RES: 103G > SHR: 4099M > MEM%: 41% > > I use ps_mem.py to check the process, > https://github.com/pixelb/ps_mem > ================================= > Private + Shared = RAM used Program > > 99.5 GiB + 37.5 MiB = 99.5 GiB postgres > --------------------------------- > 99.5 GiB > ================================= > my pg version is 10.3 , shared_buffer size is 4GB. work_mem 64MB. there are about 120 connections on the db side. most of them are idle. > does anyone have idea how to troubleshooting this kind of issue? I see no reason for checkpointer to use that much memory. Accounting for the whole of shared_buffers is okay (as Laurenz explaijned), which in other installations may account for several gigabytes of memory. But if shared_buffers is 4GB, then 99GB is clearly overboard. I see no explanation for checkpointer using 25x shared_buffers. Maybe looking at /proc//smaps would tell you where that memory is going? Have a look there are see if you can figure out some obviously absurd entries. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services