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 1jhALH-0008PN-Jo for pgsql-performance@arkaria.postgresql.org; Fri, 05 Jun 2020 11:16:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jhALE-0006Av-DR for pgsql-performance@arkaria.postgresql.org; Fri, 05 Jun 2020 11:16:52 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhALE-0006Ao-1M for pgsql-performance@lists.postgresql.org; Fri, 05 Jun 2020 11:16:52 +0000 Received: from mta97aws110.mxout.inova.com.br ([3.223.97.110] helo=mxhero01.a.inova.com.br) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhAL8-00037l-VE for pgsql-performance@lists.postgresql.org; Fri, 05 Jun 2020 11:16:48 +0000 Received: from MXHERO01.A.INOVA.COM.BR (localhost [127.0.0.1]) by mxhero01.a.inova.com.br (Postfix) with ESMTP id 2939A4C255 for ; Fri, 5 Jun 2020 11:16:45 +0000 (UTC) Received: from mxhero01.a.inova.com.br (localhost [127.0.0.1]) by mxhero01.a.inova.com.br (Postfix) with ESMTP for ; Fri, 5 Jun 2020 11:16:45 +0000 (UTC) Received: from mxhero02.a.inova.com.br (ip-10-0-4-49.ec2.internal [10.0.4.49]) by mxhero01.a.inova.com.br (Postfix) with ESMTPS id 11AC84C2EB for ; Fri, 5 Jun 2020 11:16:45 +0000 (UTC) Received: from 10.0.4.78 (localhost [127.0.0.1]) by mxhero02.a.inova.com.br (Postfix) with ESMTP id 0200D18E270 for ; Fri, 5 Jun 2020 11:16:45 +0000 (UTC) Received: from corpmoutpolicyd01.a.inova.com.br (puppetmaster.a.inova.com.br [10.0.1.88]) by mxhero02.a.inova.com.br (Postfix) with ESMTP; Fri, 5 Jun 2020 11:16:44 +0000 (UTC) Received: from corpmoutpolicyd01.a.inova.com.br (localhost [127.0.0.1]) by corpmoutpolicyd01.a.inova.com.br (Postfix) with ESMTP id E40E5220450; Fri, 5 Jun 2020 08:16:42 -0300 (BRT) Received: from corpmout01.a.inova.com.br (ip-10-0-1-125.ec2.internal [10.0.1.125]) by corpmoutpolicyd01.a.inova.com.br (Postfix) with ESMTP id D9F62AA456; Fri, 5 Jun 2020 08:16:42 -0300 (BRT) Received: from corpmbox02.a.inova.com.br (ip-10-0-4-158.ec2.internal [10.0.4.158]) by corpmout01.a.inova.com.br (Postfix) with ESMTP; Fri, 5 Jun 2020 08:16:42 -0300 (-03) Date: Fri, 5 Jun 2020 08:16:42 -0300 (BRT) From: luis.roberto@siscobra.com.br To: Krzysztof Olszewski Cc: pgsql-performance@lists.postgresql.org Message-ID: <1732071732.32630732.1591355802776.JavaMail.zimbra@siscobra.com.br> In-Reply-To: References: Subject: Re: Postgresql server gets stuck at low load MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="=_5580d095-f2ee-45d4-8701-03608fd2f652" X-Originating-IP: [10.0.1.247] X-Mailer: Zimbra 8.8.15_GA_3918 (ZimbraWebClient - GC83 (Win)/8.8.15_GA_3895) Thread-Topic: Postgresql server gets stuck at low load Thread-Index: Cp9NvVIFXP4GCEFWagmY7MmE7ynO6Q== x-mxHero-Origin-Ip: /127.0.0.1:41632 X-mxHero-AttachmentBlock: rule=48;result=false X-mxHero-AttachmentBlock: rule=48;result=false X-CMAE-Score: 0 X-CMAE-Analysis: v=2.2 cv=S/up+MkP c=1 sm=1 tr=0 cx=a_idp_d a=cevwrLK3WO2sZnq1tD4a4w==:117 a=FKkrIqjQGGEA:10 a=_uFG4AKbl_AA:10 a=nTHF0DUjJn0A:10 a=h2mZ7ym4DuMA:10 a=pGLkceISAAAA:8 a=epTmVMiNAAAA:8 a=EaOY_RrjAamFTkb4Le4A:9 a=QEXdDO2ut3YA:10 a=VBjJxrWuMRghUJ9R:21 a=_W_S_7VecoQA:10 a=ndEWmUVY6Yapc0oHF_P4:22 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=_5580d095-f2ee-45d4-8701-03608fd2f652 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable De: "Krzysztof Olszewski" =20 Para: pgsql-performance@lists.postgresql.org=20 Enviadas: Sexta-feira, 5 de junho de 2020 7:07:02=20 Assunto: Postgresql server gets stuck at low load=20 BQ_BEGIN I have problem with one of my Postgres production server. Server works fine= almost always, but sometimes without any increase of transactions or state= ments amount, machine gets stuck. Cores goes up to 100%, load up to 160%. W= hen it happens then there are problems with connect to database and even it= will succeed, simple queries works several seconds instead of milliseconds= .Problem sometimes stops after a period a time (e.g. 35 min), sometimes we = must restart Postgres, Linux, or even KVM (which exists as virtualization h= ost).=20 My hardware56 cores (Intel Core Processor (Skylake, IBRS))400 GB RAMRAID10 = with about 40k IOPS=20 Os=20 CentOS Linux release 7.7.1908=20 kernel 3.10.0-1062.18.1.el7.x86_64 Databasesize 100 GB (entirely fit in mem= ory :) )server_version 10.12effective_cache_size 192000 MBmaintenance_work_= mem 2048 MBmax_connections 150 shared_buffers 64000 MBwork_mem 96 MBOn norm= al state, i have about 500 tps, 5% usage of cores, about 3% of load, whole = database fits in memory, no reads from disk, only writes on about 500 IOPS = level, sometimes in spikes on 1500 IOPS level, but on this hardware there i= s no problem with this values (no iowaits on cores). In normal state this m= achine does "nothing". Connections to database are created by two app serve= rs based on Java, through connection pools, so connections count is limited= by configuration of pools and max is 120, is lower value than in Postgres = configuration (150). On normal state there is about 20 connections, when st= uck goes into max (120).In correlation with stucks i see informations in ke= rnel log aboutNMI watchdog: BUG: soft lockup - CPU#25 stuck for 23s! [postm= aster:33935]but i don't know this is reason or effect of problemI made inve= stigation with pgBadger and ... nothing strange happens, just normal statem= ents Any ideas? Thanks,=20 Kris=20 BQ_END Hi Krzysztof!=20 I would enable pg_stat_statements extension and check if there are long run= ning queries that should be quick.=20 --=_5580d095-f2ee-45d4-8701-03608fd2f652 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: quoted-printable

De: "Krzysztof Olszewski" <kolszew73@gmail.com>Para: pgsql-performance@lists.postgresql.org
Enviadas: Se= xta-feira, 5 de junho de 2020 7:07:02
Assunto: Postgresql server = gets stuck at low load

I have problem with one= of my Postgres production server. Server works fine almost always, but som= etimes without any increase of transactions or statements amount, machine g= ets stuck. Cores goes up to 100%, load up to 160%. When it happens then the= re are problems with connect to database and even it will succeed, simple q= ueries works several seconds instead of milliseconds.Problem sometimes stop= s after a period a time (e.g. 35 min), sometimes we must restart Postgres, = Linux, or even KVM (which exists as virtualization host).
My hardware5= 6 cores (Intel Core Processor (Skylake, IBRS))400 GB RAMRAID10 with about 4= 0k IOPS
Os
CentOS Linux release 7.7.1908
kernel 3.10.0-1= 062.18.1.el7.x86_64 Databasesize 100 GB (entirely fit in memory :) )server_= version 10.12effective_cache_size 192000 MBmaintenance_work_mem 2048 MBmax_= connections 150 shared_buffers 64000 MBwork_mem 96 MBOn normal state, i hav= e about 500 tps, 5% usage of cores, about 3% of load, whole database fits i= n memory, no reads from disk, only writes on about 500 IOPS level, sometime= s in spikes on 1500 IOPS level, but on this hardware there is no problem wi= th this values (no iowaits on cores). In normal state this machine does "no= thing". Connections to database are created by two app servers based on Jav= a, through connection pools, so connections count is limited by configurati= on of pools and max is 120, is lower value than in Postgres configuration (= 150). On normal state there is about 20 connections, when stuck goes into m= ax (120).In correlation with stucks i see informations in kernel log aboutN= MI watchdog: BUG: soft lockup - CPU#25 stuck for 23s! [postmaster:33935]but= i don't know this is reason or effect of problemI made investigation with = pgBadger and ... nothing strange happens, just normal statements Any ideas?= Thanks,
Kris
Hi Krzysztof!

I would enable p= g_stat_statements extension and check if there are long running queries tha= t should be quick.
--=_5580d095-f2ee-45d4-8701-03608fd2f652--