Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZA4SW-0002B0-Qs for pgsql-performance@arkaria.postgresql.org; Tue, 30 Jun 2015 22:56:56 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZA4SW-0006qY-6i for pgsql-performance@arkaria.postgresql.org; Tue, 30 Jun 2015 22:56:56 +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) (envelope-from ) id 1ZA4SU-0006pt-9z for pgsql-performance@postgresql.org; Tue, 30 Jun 2015 22:56:54 +0000 Received: from 01.zmailcloud.com ([192.198.85.104] helo=mx-out-1.zmailcloud.com) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZA4SR-0003EX-7G for pgsql-performance@postgresql.org; Tue, 30 Jun 2015 22:56:52 +0000 Received: from smtp.01.com (smtp.01.com [10.10.0.43]) by mx-out-1.zmailcloud.com (Postfix) with ESMTP id 8BCD5563EDE; Tue, 30 Jun 2015 17:56:50 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 778A160218; Tue, 30 Jun 2015 17:56:50 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tyrtOTmplSVJ; Tue, 30 Jun 2015 17:56:50 -0500 (CDT) Received: from smtp.01.com (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 5804B602D0; Tue, 30 Jun 2015 17:56:50 -0500 (CDT) Received: from localhost (localhost [127.0.0.1]) by smtp-out-2.01.com (Postfix) with ESMTP id 39BF36029E; Tue, 30 Jun 2015 17:56:50 -0500 (CDT) X-Virus-Scanned: amavisd-new at smtp-out-2.01.com Received: from smtp.01.com ([127.0.0.1]) by localhost (smtp-out-2.01.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id v2Lr3LqSSEye; Tue, 30 Jun 2015 17:56:50 -0500 (CDT) Received: from [192.168.23.160] (199-83-220-245.PUBLIC.monkeybrains.net [199.83.220.245]) by smtp-out-2.01.com (Postfix) with ESMTPSA id C150160218; Tue, 30 Jun 2015 17:56:49 -0500 (CDT) Message-ID: <55931EB0.1000003@agliodbs.com> Date: Tue, 30 Jun 2015 15:56:48 -0700 From: Josh Berkus Organization: PostgreSQL Experts Inc. User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: eudald_v , pgsql-performance@postgresql.org Subject: Re: Sudden connection and load average spikes with postgresql 9.3 References: <1435675936590-5855895.post@n5.nabble.com> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org On 06/30/2015 07:52 AM, eudald_v wrote: > Two days from now, I've been experiencing that, randomly, the connections > rise up till they reach max connections, and the load average of the server > goes arround 300~400, making every command issued on the server take > forever. When this happens, ram is relatively low (70Gb used), cores > activity is lower than usual and sometimes swap happens (I've swappiness > configured to 10%) As Tom said, the most likely reason for this is application behavior and blocking locks. Try some of these queries on our scripts page: https://github.com/pgexperts/pgx_scripts/tree/master/locks However, I have seem some other things which cause these kinds of stalls: * runaway connection generation by the application, due to either a programming bug or an irresponsible web crawler (see https://www.pgexperts.com/blog/quinn_weaver/) * issues evicting blocks from shared_buffers: what is your shared_buffers set to? How large is your database? * Checkpoint stalls: what FS are you on? What are your transaction log settings for PostgreSQL? * Issues with the software/hardware stack around your storage, causing total IO stalls periodically. What does IO throughput look like before/during/after the stalls? The last was the cause the last time I dealt with a situation like yours; it turned out the issue was bad RAID card firmware where the card would lock up whenever the write-through buffer got too much pressure. -- Josh Berkus PostgreSQL Experts Inc. http://pgexperts.com -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance