Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 868B46501D1 for ; Tue, 26 Aug 2008 17:53:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 18486-03 for ; Tue, 26 Aug 2008 17:53:39 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from bay0-omc2-s3.bay0.hotmail.com (bay0-omc2-s3.bay0.hotmail.com [65.54.246.139]) by postgresql.org (Postfix) with ESMTP id A756B64FF77 for ; Tue, 26 Aug 2008 17:53:42 -0300 (ADT) Received: from BAY124-W38 ([207.46.11.201]) by bay0-omc2-s3.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 26 Aug 2008 13:53:40 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_ec4ee4a7-363c-4f8d-8cba-44002db4bfae_" X-Originating-IP: [86.81.58.36] From: henk de wit To: "pgsql-performance@postgresql.org" Subject: Re: select on 22 GB table causes "An I/O error occured while sending to the backend." exception Date: Tue, 26 Aug 2008 22:53:40 +0200 Importance: Normal In-Reply-To: References: MIME-Version: 1.0 X-OriginalArrivalTime: 26 Aug 2008 20:53:40.0473 (UTC) FILETIME=[D1AC8E90:01C907BD] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 200808/341 X-Sequence-Number: 31222 --_ec4ee4a7-363c-4f8d-8cba-44002db4bfae_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > What do your various logs (pgsql=2C application=2C etc...) have to say? There=0A= is hardly anything helpful in the pgsql log. The application log=0A= doesn't mention anything either. We log a great deal of information in=0A= our application=2C but there's nothing out of the ordinary there=2C=0A= although there's of course always a chance that somewhere we missed=0A= something.=20 > Can you read a java stack trace? Sometimes slogging through them will > reveal some useful information. I can read a java stack trace very well=2C I'm primarily a Java developer. = The stack trace is the following one: org.postgresql.util.PSQLException:=0A= An I/O error occured while sending to the backend. =0A= at=0A= org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:218= ) =0A= at=0A= org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.= java:451) =0A= at=0A= org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2S= tatement.java:350) =0A= at=0A= org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Stat= ement.java:304) =0A= at=0A= org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(Deleg= atingPreparedStatement.java:102) =0A= at=0A= org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(Deleg= atingPreparedStatement.java:102) Our=0A= code simply executes the same statement.executeUpdate() that is does=0A= about 500.000 times during a business day. As soon as this select query=0A= is hitting this 22 GB table then there's a chance that 'suddenly' all=0A= these utterly simply insert queries start failing. The insert query is=0A= nothing special either. It's just an "INSERT INTO ... VALUES (...)"=0A= type of thing. The select query can actually be a few different kinds=0A= of queries=2C but basically the common thing between them is reading from= =0A= this 22 GB table. In fact=2C our system administrator just told me that=0A= even the DB backup is able to trigger this behaviour. As soon as the=0A= backup process is reading from this 22 GB table=2C the inserts on it=0A= -may- start to fail. > Sounds to me like your connections are timing out (what's your timeout > in jdbc set to?) There's=0A= no explicit timeout being set. Queries can theoretically execute for=0A= hours. In some rare cases=2C some queries indeed run for that long. =20 > A likely cause is that you're getting big checkpoint spikes. What > does vmstat 10 say during these spikes? It's=0A= hard to reproduce the problem. We're trying to simulate it in on our=0A= testing servers but haven't been successfull yet. The problem typically=0A= lasts for only a minute a time on the production server and there's no=0A= saying on when it will occur again. Of course we could try to enfore it=0A= by running this select query continously=2C but for a production server=0A= it's not an easy decission to actually do that. So therefore basically=0A= all we were able to do now is investigate the logs afterwards. I'll try=0A= to run vmstat though when the problem happens when I'm at the console.=20 > If you're running the > sysstate service with data collection then sar can tell you a lot. Ok=2C I'm not a big PG expert so I'll have to look into what that means exa= ctly =3B) Thanks for the advice though. Kind regards=2C Henk _________________________________________________________________ Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/= --_ec4ee4a7-363c-4f8d-8cba-44002db4bfae_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable >=3B What do your various logs (pgsql=2C applic= ation=2C etc...) have to say?

There=0A= is hardly anything helpful in the pgsql log. The application log=0A= doesn't mention anything either. We log a great deal of information in=0A= our application=2C but there's nothing out of the ordinary there=2C=0A= although there's of course always a chance that somewhere we missed=0A= something.

>=3B Can you read a java stack trace? Sometimes slogg= ing through them will
>=3B reveal some useful information.

I ca= n read a java stack trace very well=2C I'm primarily a Java developer. The = stack trace is the following one:

org.postgresql.u= til.PSQLException:=0A= An I/O error occured while sending to the backend.
=0A=  =3B =3B =3B at=0A= org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:218= )
=0A=  =3B =3B =3B at=0A= org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.= java:451)
=0A=  =3B =3B =3B at=0A= org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2S= tatement.java:350)
=0A=  =3B =3B =3B at=0A= org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Stat= ement.java:304)
=0A=  =3B =3B =3B at=0A= org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(Deleg= atingPreparedStatement.java:102)
=0A=  =3B =3B =3B at=0A= org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeUpdate(Deleg= atingPreparedStatement.java:102)


Our=0A= code simply executes the same statement.executeUpdate() that is does=0A= about 500.000 times during a business day. As soon as this select query=0A= is hitting this 22 GB table then there's a chance that 'suddenly' all=0A= these utterly simply insert queries start failing. The insert query is=0A= nothing special either. It's just an "INSERT INTO ... VALUES (...)"=0A= type of thing. The select query can actually be a few different kinds=0A= of queries=2C but basically the common thing between them is reading from= =0A= this 22 GB table. In fact=2C our system administrator just told me that=0A= even the DB backup is able to trigger this behaviour. As soon as the=0A= backup process is reading from this 22 GB table=2C the inserts on it=0A= -may- start to fail.

>=3B Sounds to me like your connections are t= iming out (what's your timeout
>=3B in jdbc set to?)

There's=0A= no explicit timeout being set. Queries can theoretically execute for=0A= hours. In some rare cases=2C some queries indeed run for that long.
&nbs= p=3B
>=3B A likely cause is that you're getting big checkpoint spikes.= What
>=3B does vmstat 10 say during these spikes?

It's=0A= hard to reproduce the problem. We're trying to simulate it in on our=0A= testing servers but haven't been successfull yet. The problem typically=0A= lasts for only a minute a time on the production server and there's no=0A= saying on when it will occur again. Of course we could try to enfore it=0A= by running this select query continously=2C but for a production server=0A= it's not an easy decission to actually do that. So therefore basically=0A= all we were able to do now is investigate the logs afterwards. I'll try=0A= to run vmstat though when the problem happens when I'm at the console.
=
>=3B If you're running the
>=3B sysstate service with data colle= ction then sar can tell you a lot.

Ok=2C I'm not a big PG expert so = I'll have to look into what that means exactly =3B) Thanks for the advice t= hough.

Kind regards=2C
Henk

Express yourself instantly= with MSN Messenger! MSN Messenger = --_ec4ee4a7-363c-4f8d-8cba-44002db4bfae_--