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 1jLutu-0005Zy-88 for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 20:32:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jLutt-00072S-5Q for pgsql-general@arkaria.postgresql.org; Tue, 07 Apr 2020 20:32:49 +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 1jLutr-00070j-4r for pgsql-general@lists.postgresql.org; Tue, 07 Apr 2020 20:32:48 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jLutn-0000ov-Ok for pgsql-general@postgresql.org; Tue, 07 Apr 2020 20:32:46 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 65BDD650; Tue, 7 Apr 2020 16:32:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 07 Apr 2020 16:32:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm2; bh=+ YjvPcO1XzbfHxpKGeifdimMfdg6fmSQbOdml0H/jUI=; b=HsHMT4UrrxzgCWIWn 2cLUiV+/i4F2F41BzD6HC8VWFSJDk/NU/Qmgu1GQmCFpd5LafMviO9DNTNFvHcBW 1rRoE2JF1/TdVRWuv8EjabO4xWSrZofOKMsZXI/5W3pp4y+ngwSa7tmZRh+xRGQ4 ItMyIXokxk6lo48Lucp1sjQHoBg1oRoMRucPiFhTMf+JieKoeD4Jk2ufWeNoUgo9 k2/p26AZ9WUUTtpK+FlQXjWAd0K0ZVHg977Y6ClAioKwBIUADMqt2rNb/UC4ktEK 8ONowcE/Adt4YgPpF2ZiM8sHLV+jg6pha9LTOTh1JR3Xj3mGxJIKdYB+jyCOGvWS RN0fw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=+YjvPcO1XzbfHxpKGeifdimMfdg6fmSQbOdml0H/j UI=; b=nCCHC52OaNYUqLXKR0GuxQyB9DA8bZR7HHKfYYKu9H2DmrzpxXQFwYqzc 7gYHPdhC3tqr2zGxfnYdtPak43RSSC2z2sH176HfSHfuIlVggmiam1MifVd0TV6s A6MPzjN7e00ViUqdYFG161fw6bNOGyR6sINOBtrQOEbJTbraJYBbT81BZPT/OXpw H1qP6BzRIQuQXRqnQsJMqhLXIyGiPrztMEq51/Vty++BD2gKKPqfXIt97ajfqVvP 3vp4jK8p7FQ7oH4idE6A2aMwUOfmZRCPX735LvSmVqaR0Im5Siuv/Ahh2aVy7vx2 wW2pDyjcAom0eaDAINv69pDPzOmHg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudehgddugedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucfkphepjeehrddujedvrdeltddrledvnecuvehluhhsthgvrhfuihiivgeptden ucfrrghrrghmpehmrghilhhfrhhomheprggurhhirghnrdhklhgrvhgvrhesrghklhgrvh gvrhdrtghomh X-ME-Proxy: Received: from [192.168.1.10] (75-172-90-92.tukw.qwest.net [75.172.90.92]) by mail.messagingengine.com (Postfix) with ESMTPA id EB703306D5FB; Tue, 7 Apr 2020 16:32:39 -0400 (EDT) Subject: Re: Estimated resources for a 500 connections instance (VM) To: David Gauthier , Laurenz Albe Cc: Postgres General References: <3fd51f3222a35e227484afae34796d3f4f667567.camel@cybertec.at> From: Adrian Klaver Message-ID: <856ecfc2-de82-816b-9b9b-4bd6ae78e6a7@aklaver.com> Date: Tue, 7 Apr 2020 13:32:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 4/7/20 12:51 PM, David Gauthier wrote: > After looking at some of the factors that can affect this, I think it > may be important to know that most of the connections will be almost > idle (in terms of interacting with the DB).  The "users" are perl/dbi > scripts which connect to the DB and spend the vast majority of the time > doing things other than interacting with the DB.  So a connection is > consumed, but it's not really working very hard with the DB per-se.  I > am cleaning up some of that code by strategically > connecting/disconnecting only when a DB interaction is required.  But > for my edification, is it roughly true that 2 connections working with > the DB 100% of the time is equivalent to 20 connections @ 10% = 200 > connections @ 1 % (if you know what I mean) ? Well to get a sense of the load you could use top, with in top: 1) Hitting u key and entering postgres as user 2) Hitting c key to get full command line That should result in something like(though formatted better): PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 978 postgres 20 0 72072 7688 6548 S 0.000 0.096 0:00.04 /usr/lib/systemd/systemd --user 981 postgres 20 0 117124 2704 52 S 0.000 0.034 0:00.00 (sd-pam) 1201 postgres 20 0 184292 20396 19520 S 0.000 0.254 0:01.19 /usr/local/pgsql12/bin/postmaster -D /usr/local/pgsql12/data 1255 postgres 20 0 38364 4192 3332 S 0.000 0.052 0:00.00 postgres: logger 1263 postgres 20 0 184408 5916 5016 S 0.000 0.074 0:00.00 postgres: checkpointer 1264 postgres 20 0 184424 5520 4640 S 0.000 0.069 0:00.18 postgres: background writer 1265 postgres 20 0 184292 9500 8620 S 0.000 0.118 0:00.18 postgres: walwriter 1266 postgres 20 0 185116 7756 6520 S 0.000 0.096 0:01.32 postgres: autovacuum launcher 1267 postgres 20 0 39488 5316 3780 S 0.000 0.066 0:02.86 postgres: stats collector 1268 postgres 20 0 184844 6064 4980 S 0.000 0.075 0:00.00 postgres: logical replication launcher 14478 postgres 20 0 185252 9612 8184 S 0.000 0.119 0:00.00 postgres: postgres production [local] idle 14507 postgres 20 0 185348 11380 9848 S 0.000 0.141 0:00.00 postgres: aklaver task_manager ::1(45202) idle -- Adrian Klaver adrian.klaver@aklaver.com