Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eAReO-00012v-CJ for pgsql-general@arkaria.postgresql.org; Fri, 03 Nov 2017 02:24:04 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eAReN-0000wZ-HF for pgsql-general@arkaria.postgresql.org; Fri, 03 Nov 2017 02:24:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eARbz-0004vS-3O for pgsql-general@postgresql.org; Fri, 03 Nov 2017 02:21:35 +0000 Received: from mail-io0-x244.google.com ([2607:f8b0:4001:c06::244]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1eARbv-0007fG-75 for pgsql-general@postgresql.org; Fri, 03 Nov 2017 02:21:33 +0000 Received: by mail-io0-x244.google.com with SMTP id 189so3201953iow.10 for ; Thu, 02 Nov 2017 19:21:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=69Fl9yREyPFjTPVyzu9V+3v74+DVns9K6HE3N7NRHA8=; b=AWnTL7Y9SfY4hp7CTdpwHL+QqFdYukmalFtyLdiIRbk4SqLpjyxui0TTwVwuCYm3mI KbmQBLAdZdfJwlXszbAayxjeRWaf0Nz6m1xq2gWMzUGV4PEWoeqjnGWRwiS3FU4wZB5E AGmG6jJIrcUgzlSHKk073eb9Hn7WNXEsKu7YmyU1wY5EvuSrRdpKmDIncB35kVCyNBk0 NUmUYprRjaB7NK3LrwkBdfIibhomNPIG1OcK70uORClSfLii8MyEUL3r1ten1L8xeNpr R3p8e35c7YdC4leMqXi5o+NgHLTkfCwT/JRCguPolOEcmWoWvqX1TF61rZxXlOhEPziG zqFA== 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:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=69Fl9yREyPFjTPVyzu9V+3v74+DVns9K6HE3N7NRHA8=; b=cqjUStfnQYhfFSSeHYwiDUpfVJcnaIGvukQ3fbXGd+H7sXPbaRjtVgV+5DX1dvETY/ vHpWL1bJrmQYcon2gRGk3TcvfSIrmyTTYl6wfevNB4Dc6XTBPKdCBmUDLRIxY/NQQ2zD aTbIDJF4fP5m8zjg57fM7okQWZHpoIzBOAcG0cs+DthjDknuGHHe8qcwamKGGQN/hogf zlxAI8cVSbj3ZAX9YLXZGrpTTs12fTOxzC9j+lFs17D/MtDzYoVk/yujTJvz3A4re9px znBdL4WTdpHLLCLbsb5v4kKU3sxhCnG4fTB1OBjcVIJgGyt4b0ZSm351PS7UW2x/mJbP 6eGg== X-Gm-Message-State: AMCzsaVLU/LE89bmxlBpHbRQfIRCXBUFyILZqrUNdjyXuTfYiUX3xm9J bND3A0xoph4Cm212wKBj0vA8jg== X-Google-Smtp-Source: ABhQp+TDS2F9XR9hcumQDWI9jefwTAR7pUlVAg8NatMVI0fjFx9BAsODF1K0hMgDCMNc0pzIVscpRg== X-Received: by 10.107.183.197 with SMTP id h188mr6790298iof.183.1509675689866; Thu, 02 Nov 2017 19:21:29 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id w195sm555458ita.44.2017.11.02.19.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 19:21:29 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 48B78800FBF; Thu, 2 Nov 2017 21:21:28 -0500 (CDT) Date: Thu, 2 Nov 2017 21:21:28 -0500 From: Justin Pryzby To: tao tony Cc: "pgsql-general@postgresql.org" Subject: Re: checkpoint and recovering process use too much memory Message-ID: <20171103022128.GC2267@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org On Fri, Nov 03, 2017 at 01:43:32AM +0000, tao tony wrote: > I had an asynchronous steaming replication HA cluster.Each node had 64G memory.pg is 9.6.2 and deployed on centos 6. > > Last month the database was killed by OS kernel for OOM,the checkpoint process was killed. If you still have logs, was it killed during a large query? Perhaps one using a hash aggregate? > I noticed checkpoint process occupied memory for more than 20GB,and it was growing everyday.In the hot-standby node,the recovering process occupied memory as big as checkpoint process. "resident" RAM of a postgres subprocess is often just be the fraction of shared_buffers it's read/written. checkpointer must necessarily read all dirty pages from s-b and write out to disk (by way of page cache), so that's why its RSS is nearly 32GB. And the recovery process is continuously writing into s-b. > Now In the standby node,checkpoint and recovering process used more then 50GB memory as below,and I worried someday the cluster would be killed by OS again. > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND > 167158 postgres 20 0 34.9g 25g 25g S 0.0 40.4 46:36.86 postgres: startup process recovering 00000004000008550000004B > 167162 postgres 20 0 34.9g 25g 25g S 0.0 40.2 17:58.38 postgres: checkpointer process > > shared_buffers = 32GB Also, what is work_mem ? Justin -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general