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 1mSPzq-0006SE-Ij for pgsql-general@arkaria.postgresql.org; Mon, 20 Sep 2021 20:34:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mSPzn-00066m-Fj for pgsql-general@arkaria.postgresql.org; Mon, 20 Sep 2021 20:34:35 +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 1mSPzm-00066e-3T for pgsql-general@lists.postgresql.org; Mon, 20 Sep 2021 20:34:35 +0000 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mSPzd-0004nI-VE for pgsql-general@postgresql.org; Mon, 20 Sep 2021 20:34:33 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id A52B83201C8E; Mon, 20 Sep 2021 16:34:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 20 Sep 2021 16:34:21 -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=fm1; bh=5 sdMosmHHxvvFet5JScJkyPTT++5LAags40OojBMzZc=; b=azm+Di3qzHRYOyfoe JUR9D5+ZesyLPGiQMXsypHDXC2WTImaBZI3eA6NoRs+IorCGusE3nIgwUcAHSjNm OsFcgq16hpiA8zfFhunxK5ckvo4SrF1nAasmzWBDMY+dBkQazetW1Ps9xmgb0NMU N+HafcL8L77uyyjFmxM7wS16BTSM5inARjXhYKFajNxIh4WolRigzcfRbwphcapy 41QZmJtjanSQisp/mLdiIBKf9e5evYRynJ3FMIll+EE4vFNS/iRmiH+472NPMNpR YLMbdAdxaOgghNGj0A6cmNgrMsMtGAvrp5274Ld2Uesuh9INX40AXMFFtYyHuooU +qRxA== 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=fm3; bh=5sdMosmHHxvvFet5JScJkyPTT++5LAags40OojBMz Zc=; b=m50gbskJjfFHKVysA1TK0jDwR1l+uakbUdHNzeEHeEXSc9crX/INzNCpP ymuucHFVNJuizohdDw17BiGRcMZDC0Hw5F4Q3/4GltzgZ7r+oGaVLnIVtEAttNa0 dBh3m+DUPHv8hns/eeSL8LG2qPkwpFBTd+eGQt0C5l+mSLg22y7QjYAM8G/WP1Cp PweoKGdxX4mUVYpROBj3UVH3JNQPE11XAGZSxmt9cPyIDaNMdtHUGFalIYqZoqAz aC35RcSidMZWIxQy4+BN9TGirIDLvWM+cy4tnW0jGIwpKDob5nSgrmR0yAzLY4uZ fK3DT41qRXlWq8YXfkprXk7AmpMzA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrudeivddgudehtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefuvfhfhffkffgfgggjtgfgsehtjeertddtfeejnecuhfhrohhmpeetughr ihgrnhcumfhlrghvvghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtg homheqnecuggftrfgrthhtvghrnheptedtkeegjeelleelieehtdevleekveelhffhhfel gfegvefftdeghfeltddtudffnecuffhomhgrihhnpehpghhpohholhdrnhgvthdpphhgsg houhhntggvrhdrohhrghenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhm X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 20 Sep 2021 16:34:20 -0400 (EDT) Subject: Re: Azure Postgresql High connection establishment time To: Abhay Gupta , Tom Lane Cc: "pgsql-general@postgresql.org" References: <1817783.1632158180@sss.pgh.pa.us> From: Adrian Klaver Message-ID: <0bdf6733-14db-c935-419c-fb060711e181@aklaver.com> Date: Mon, 20 Sep 2021 13:34:19 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 9/20/21 10:37 AM, Abhay Gupta wrote: > Hello Tom > > Thanks for taking time in looking into this for us. Apologies for not > providing any required data. > > Yes, Azure postgresql has a private endpoint attached to it so it is > going through a private link. Also the server has 2 vcore and 5gb. Since > currently we are in development phase there is no load on the server at > all. No encryption and in the connection string we are passing the user > and password. It is Ssl enabled. To negate it is Azure issue, we > installed postgresql 11 on our on prem server and there also we are > seeing a connection latency of about 150-200 ms. > > We are only opening 1 connection in our application i.e. after all the > work is done for that user session than only we close the connection. > > If you could assist in what we can check will be very helpful. Per upstream comment take a look at connection pooling. Two solutions that come to mind: Pgpool-II https://www.pgpool.net/mediawiki/index.php/Main_Page PgBouncer http://www.pgbouncer.org/ > > Thanks > -- Adrian Klaver adrian.klaver@aklaver.com