Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uUM9z-001yEi-20 for pgsql-performance@arkaria.postgresql.org; Wed, 25 Jun 2025 09:11:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uUM9w-001iNV-64 for pgsql-performance@arkaria.postgresql.org; Wed, 25 Jun 2025 09:11:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uUM9v-001iNM-Qh for pgsql-performance@lists.postgresql.org; Wed, 25 Jun 2025 09:11:12 +0000 Received: from mail-yw1-x1130.google.com ([2607:f8b0:4864:20::1130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uUM9r-003zad-1H for pgsql-performance@lists.postgresql.org; Wed, 25 Jun 2025 09:11:12 +0000 Received: by mail-yw1-x1130.google.com with SMTP id 00721157ae682-70e3e0415a7so7110917b3.0 for ; Wed, 25 Jun 2025 02:11:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750842665; x=1751447465; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=q4tPZ5U/2s0/7oXsZRp10IdGwpGCkpavYF1w78kLgYA=; b=b3sHs383tcm/kp7gauCMrvmwze586eyovkH8TKAbVsVlITO7CHKAd/t6Pk+dE7ZK07 SDEFoUJBPSKHKVnDq66PNzGcTf9Hzl7Ts0hx7rrBu/7hzqkM97s1AUqkN8AfIqrnt6as vAeGeeBDje1SZ9gE5wGmOLfKC+Iez5vf+VbqwmUt1v0VVJqZ5NCX/795DGu+pDKeCVgi MAISHhmVwWsUt+BWwrk4DqOsA3P2JUfPnJpRnITZms6kR3R4KIWw5yqMgLkMyIDT3EQ7 jAmJhkdF6HTRzWFJ6QkPq35kXwZ9+B57I2lWVqsqMGdZsA8ibyaNfac82f4XZ6HTJ1+d Pjww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750842665; x=1751447465; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=q4tPZ5U/2s0/7oXsZRp10IdGwpGCkpavYF1w78kLgYA=; b=WvlsjOfg1qR32CS7/SE6xChVziiZkT1W6mpURpBzvPq58vjTmzuiAaIamvHvgehwEk LMT/sH88wK4ai3I9Uo4aL/qSDTrFmw7K25ge4P9Hv9W+vwYnB0VcfpzBeeHKqQ9f+j8T +qPW1bTtptK76W4PinPFJAdSJKJkyTSgDfs3VSDzVd2St7mv7xYc9F+6czAgSr1DgtEu mwLy2DXYDt+O41cNt5kWUkk5KX5aTFkHy+q74A34i8jXav4hCTl0S3PEL8qLMTxLxy3L Fb1l+fQjCnzOo8sYdfXWAB2pyn0GQsqqJCU0x7KhPqJZ6FLXvKWraY91TOI5MtQKsswt TEMw== X-Gm-Message-State: AOJu0YxJVz7V38VAwCse6ur6S81IZXrzfW/I0jznsS4rb3zw6AaoBcBT 96NdctsjBRttq+8ZoRHH+iQwtTAHPte1PE5OZIX8sOrTmpTsCIDmnVpt8ALzRLYyd1vGVeNSDdb YTlSUVOpQC9+CCfJ7jQ3O/6x/BYH9csc= X-Gm-Gg: ASbGncttSk8ry+9IqBoFmLW4055aDtl5sFzBTK5+5hV5OVydDcVg5tKzi46whhknmI2 9s9X9EE/zPACfIR6fMKqYQUR85X+Zg7pey+QmyIcm629NrP9tDMqBV3az+RqUJF/pSEMU61uOae HLe6qCHjXLXExVTnmk+ROw+zF6+RiQQXU7dcosnysZkWU= X-Google-Smtp-Source: AGHT+IEFxBJ6gta9AkwRbBK9Gtsknvc5zdNFid/opBfn8jSzhSqNgfkVzW9Ny7iAQJRl64p0zlgEyiW+5SW5lm+v0UE= X-Received: by 2002:a05:690c:6e0a:b0:70c:c20a:89a5 with SMTP id 00721157ae682-71406cbb6f6mr29621597b3.19.1750842665352; Wed, 25 Jun 2025 02:11:05 -0700 (PDT) MIME-Version: 1.0 References: <66879d8bd44148f2ef1dcde1eff056e6c671306e.camel@cybertec.at> In-Reply-To: <66879d8bd44148f2ef1dcde1eff056e6c671306e.camel@cybertec.at> From: James Pang Date: Wed, 25 Jun 2025 17:10:55 +0800 X-Gm-Features: Ac12FXzCdpkS2z-Qu2hkVYdtCxl_glaRQ-Ut6Ti220f4SHFFj9ulQabDZ4a2ioI Message-ID: Subject: Re: many sessions waiting DataFileRead and extend To: Laurenz Albe Cc: pgsql-performance@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000002045a9063861d334" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000002045a9063861d334 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable transparent_hugepage=3Dnever in our prod servers, %iowait is low 0.x-1.= x% , read/write iops <2k, and read/write wait 0.x ms. we did not find other abnormal logs from OS logs either. Yes, we are discussing with our application team to reduce concurrency. more questions about DataFileRead and extend wait_event. when starting read data from physical datafiles , it report DataFileRead wait_event, until the data pages successfully loaded into buffer cache, then end wait_event report from pg_stat_activity,right? if some contention in buffer cache, that will make the session waiting there while in report DataFileRead, right? another thing is Operating system page cache, may sessions starting read data in parallel may bring contention on OS pagecache, bgwriter and checkpointer is flushing data, or OS background worker may flush dirty pages from OS page cache too, bgwriter or checkpointer maybe contention on OS pagecache or PG buffer cache? . no idea how to get the reason from online production server. Thanks, James Laurenz Albe =E6=96=BC 2025=E5=B9=B46=E6=9C=8825= =E6=97=A5=E9=80=B1=E4=B8=89 =E4=B8=8B=E5=8D=881:59=E5=AF=AB=E9=81=93=EF=BC= =9A > On Wed, 2025-06-25 at 11:15 +0800, James Pang wrote: > > pgv14, RHEL8, xfs , we suddenly see tens of sessions waiting on > "DataFileRead" and > > "extend", it last about 2 seconds(based on pg_stat_activity query) , > during the > > waiting time, "%sys" cpu increased to 80% , but from "iostat" , no high > iops and > > io read/write latency increased either. > > Run "sar -P all 1" and see if "%iowait" is high. > > Check if you have transparent hugepages enabled: > > cat /sys/kernel/mm/transparent_hugepage/enabled > > If they are enabled, disable them and see if it makes a difference. > > I am only guessing here. > > > many sessions were running same "DELETE FROM xxxx" in parallel waiting > on "extend" > > and "DataFileRead", there are triggers in this table "After delete" to > insert/delete > > other tables in the tigger. > > One thing that almost certainly would improve your situation is to run > fewer > concurrent statements, for example by using a reasonably sized connection > pool. > > Yours, > Laurenz Albe > --0000000000002045a9063861d334 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
=C2=A0 =C2=A0transparent_hugepage=3Dnever in our prod serv= ers,=C2=A0 %iowait is low 0.x-1.x% , read/write iops <2k, and read/write= wait 0.x ms. we did not find other abnormal logs from OS logs either.=C2= =A0 Yes, we are discussing with our application team to reduce concurrency.=C2= =A0 more questions about DataFileRead and extend wait_event.=C2=A0 =C2=A0wh= en starting read=C2=A0data from physical datafiles , it report DataFileRead= wait_event, until the data pages successfully loaded into buffer cache, th= en end wait_event report from pg_stat_activity,right?=C2=A0=C2=A0if some co= ntention in buffer cache, that will make the session waiting=C2=A0there whi= le=C2=A0in report DataFileRead,=C2=A0right?=C2=A0 another thing is Operatin= g system page cache, may sessions starting read data in parallel may bring = contention on OS pagecache,=C2=A0bgwriter and checkpointer is flushing data= , or OS background worker may flush dirty pages from OS page cache too, bgw= riter or checkpointer maybe contention on OS pagecache or PG buffer cache? = . no idea how to get the reason from online production server.=C2=A0
Thanks,

James=C2=A0

Laurenz Albe <laur= enz.albe@cybertec.at> =E6=96=BC 2025=E5=B9=B46=E6=9C=8825=E6=97=A5= =E9=80=B1=E4=B8=89 =E4=B8=8B=E5=8D=881:59=E5=AF=AB=E9=81=93=EF=BC=9A
On Wed, 2025-06-25 at = 11:15 +0800, James Pang wrote:
> pgv14, RHEL8, xfs , we suddenly see tens of sessions waiting on "= DataFileRead" and
> "extend", it last about 2 seconds(based on pg_stat_activity = query) , during the
> waiting time, "%sys" cpu increased to 80% , but from "i= ostat" , no high iops and
> io read/write latency increased either.

Run "sar -P all 1" and see if "%iowait" is high.

Check if you have transparent hugepages enabled:

=C2=A0 cat /sys/kernel/mm/transparent_hugepage/enabled

If they are enabled, disable them and see if it makes a difference.

I am only guessing here.

> many sessions were running same "DELETE FROM xxxx" in parall= el waiting on "extend"
> and "DataFileRead", there are triggers in this table "A= fter delete" to insert/delete
> other tables in the tigger.=C2=A0

One thing that almost certainly would improve your situation is to run fewe= r
concurrent statements, for example by using a reasonably sized connection p= ool.

Yours,
Laurenz Albe
--0000000000002045a9063861d334--