Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A9E2CB5DBD8 for ; Tue, 13 Sep 2011 22:27:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 53280-07 for ; Wed, 14 Sep 2011 01:27:07 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.8.0-rc2 Received: from blu0-omc4-s16.blu0.hotmail.com (blu0-omc4-s16.blu0.hotmail.com [65.55.111.155]) by mail.postgresql.org (Postfix) with ESMTP id 739F7B5DBC4 for ; Tue, 13 Sep 2011 22:27:07 -0300 (ADT) Received: from BLU153-W27 ([65.55.111.135]) by blu0-omc4-s16.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 13 Sep 2011 18:27:07 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_4286a752-310f-4242-a300-a2b9aeab52a1_" X-Originating-IP: [174.93.168.109] From: Carlo Stonebanks To: Performance support Postgresql Subject: Re: Migrated from 8.3 to 9.0 - need to update config (re-post) Date: Wed, 14 Sep 2011 01:27:06 +0000 Importance: Normal In-Reply-To: References: <4E6F810C0200002500041144@gw.wicourts.gov>, MIME-Version: 1.0 X-OriginalArrivalTime: 14 Sep 2011 01:27:07.0143 (UTC) FILETIME=[6A937970:01CC727D] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201109/202 X-Sequence-Number: 44978 --_4286a752-310f-4242-a300-a2b9aeab52a1_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable =20 Ok=2C connection pooler it is. As I understand it=2C even if there are no i= dle connections available we'll get the benefit of putting a turnstile on t= he butcher's door. I also ordered the book as soon as you mentioned - the title alone was enou= gh to sell me on it! The book won't be for the errant sys admin who increas= ed the connections=2C it's for me - I'll use it to whack the sys admin on t= he head. Thanks fo rthe tip=2C the author owes you a beer - as do I. Will t= he book recommend any particular connection pooler product=2C or is it inap= propriate to ask for a recommendation on the forum? Carlo > Date: Tue=2C 1= 3 Sep 2011 16:13:00 -0500 > From: Kevin.Grittner@wicourts.gov > To: pgsql-performance@postgresql.org=3B stonec.register@sympatico.ca > Subject: RE: [PERFORM] Migrated from 8.3 to 9.0 - need to update config = (re-post) >=20 > Carlo Stonebanks wrote: > =20 > >> max_connections =3D 300 > > Too high. Both throughput and latency should improve with correct > > use of a connection pooler. > =20 > > Even for 300 stateful applications that can remain connected for > > up to a week=2C continuously distilling data (imports)? > =20 > Absolutely. > =20 > A good connection pooler will be able to hold those 300 *client* > connections=2C and maintain a much smaller set of connections to the > database. It will notice when a client connection is requesting the > start of a database transaction. If there is an idle database > connection it will route the requests there=3B otherwise it will put > that client connection in a queue. When a database transaction is > committed=2C a waiting client connection (if any) will be assigned to > its database connection. > =20 > Every benchmark I've seen shows that this will improve both > throughput and latency over the approach of releasing a "thundering > herd" of requests against the server. Picture a meat counter with > four butchers behind it=2C and few spinning devices to slice meat. > If customers queue up=2C and the butchers call on people as they are > ready=2C things go better than if each butcher tries to take on one- > fourth of the customers at a time and constantly switch between one > order and another to try to make incremental progress on all of > them. > =20 > > a sys admin raised it from 100 when multiple large projects were > > loaded and the server refused the additional connections. > =20 > Whoever is making these decisions needs more training. I suggest > Greg Smith's book: > =20 > http://www.postgresql.org/docs/books/ > =20 > (Full disclosure=2C I was a technical reviewer of the book and got a > free copy.) > =20 > > you want the controller configured for write-back (with automatic > > switch to write-through on low or failed battery=2C if possible). > =20 > For performance or safety reasons? > =20 > You get better performance with write-back. If you can't rely on > the battery=2C then write-back is not safe and you need to use write- > through. > =20 > > Since the sys admin thinks there's no performance benefit from > > this=2C I would like to be clear on why we should do this. > =20 > If you can get him to change it back and forth for performance > testing=2C it is easy enough to prove. Write a client application > which inserts on row per database transaction. A nice=2C simple=2C > short row -- like containing one integer column with no indexes. > Have the external application create the table and do a million > inserts. Try this with both cache settings. It's best not to > issue a BEGIN and COMMIT at all. Don't loop in a function or a DO > block=2C because that creates an implicit transaction. > =20 > > Every now and then the imports behave as if they are suddenly > > taking a deep breath=2C slowing down. Sometimes=2C so much we cancel > > the import and restart (the imports pick up where they left off). > >=20 > > What would the bg_writer settings be in this case? > =20 > I'm not sure what that is based on information so far=2C so it's > unclear whether background writer settings would help=3B but on the > face of it my bet would be that it's a context switching storm or > swapping=2C and the connection pool would be the better solution. > Those poor butchers are just overwhelmed.... > =20 > -Kevin >=20 >=20 = --_4286a752-310f-4242-a300-a2b9aeab52a1_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

 =3B

Ok=2C connection pooler it is. As I understand it=2C even if there are no i= dle connections available =3Bwe'll =3Bget the benefit of putting a = turnstile on the =3Bbutcher's =3Bdoor.

I also ordered the book as soon as you mentioned - the t= itle alone was enough to sell me on it! The book won't be for the errant sy= s admin who increased the connections=2C it's for me - =3BI'll use it t= o whack the sys admin on the head. Thanks fo rthe tip=2C the author owes yo= u a beer - as do I.
 =3B
Will the book recommend an= y particular connection pooler product=2C or is it inappropriate to ask for= a recommendation on the forum?
 =3B
Carlo
 =3B
 =3B
>=3B Date: Tue=2C 13 Sep 2011 16:13:00= -0500
>=3B From: Kevin.Grittner@wicourts.gov
>=3B To: pgsql-perf= ormance@postgresql.org=3B stonec.register@sympatico.ca
>=3B Subject: R= E: [PERFORM] Migrated from 8.3 to 9.0 - need to update config (re-post)>=3B
>=3B Carlo Stonebanks wrote:
>=3B
>=3B >=3B>= =3B max_connections =3D 300
>=3B >=3B Too high. Both throughput and = latency should improve with correct
>=3B >=3B use of a connection po= oler.
>=3B
>=3B >=3B Even for 300 stateful applications that = can remain connected for
>=3B >=3B up to a week=2C continuously dist= illing data (imports)?
>=3B
>=3B Absolutely.
>=3B
>= =3B A good connection pooler will be able to hold those 300 *client*
>= =3B connections=2C and maintain a much smaller set of connections to the>=3B database. It will notice when a client connection is requesting th= e
>=3B start of a database transaction. If there is an idle database<= br>>=3B connection it will route the requests there=3B otherwise it will = put
>=3B that client connection in a queue. When a database transacti= on is
>=3B committed=2C a waiting client connection (if any) will be a= ssigned to
>=3B its database connection.
>=3B
>=3B Every b= enchmark I've seen shows that this will improve both
>=3B throughput a= nd latency over the approach of releasing a "thundering
>=3B herd" of = requests against the server. Picture a meat counter with
>=3B four bu= tchers behind it=2C and few spinning devices to slice meat.
>=3B If cu= stomers queue up=2C and the butchers call on people as they are
>=3B r= eady=2C things go better than if each butcher tries to take on one-
>= =3B fourth of the customers at a time and constantly switch between one
= >=3B order and another to try to make incremental progress on all of
&= gt=3B them.
>=3B
>=3B >=3B a sys admin raised it from 100 whe= n multiple large projects were
>=3B >=3B loaded and the server refus= ed the additional connections.
>=3B
>=3B Whoever is making thes= e decisions needs more training. I suggest
>=3B Greg Smith's book:>=3B
>=3B http://www.postgresql.org/docs/books/
>=3B
&g= t=3B (Full disclosure=2C I was a technical reviewer of the book and got a>=3B free copy.)
>=3B
>=3B >=3B you want the controller c= onfigured for write-back (with automatic
>=3B >=3B switch to write-t= hrough on low or failed battery=2C if possible).
>=3B
>=3B For = performance or safety reasons?
>=3B
>=3B You get better perform= ance with write-back. If you can't rely on
>=3B the battery=2C then w= rite-back is not safe and you need to use write-
>=3B through.
>= =3B
>=3B >=3B Since the sys admin thinks there's no performance be= nefit from
>=3B >=3B this=2C I would like to be clear on why we shou= ld do this.
>=3B
>=3B If you can get him to change it back and = forth for performance
>=3B testing=2C it is easy enough to prove. Wri= te a client application
>=3B which inserts on row per database transac= tion. A nice=2C simple=2C
>=3B short row -- like containing one integ= er column with no indexes.
>=3B Have the external application create t= he table and do a million
>=3B inserts. Try this with both cache sett= ings. It's best not to
>=3B issue a BEGIN and COMMIT at all. Don't l= oop in a function or a DO
>=3B block=2C because that creates an implic= it transaction.
>=3B
>=3B >=3B Every now and then the imports= behave as if they are suddenly
>=3B >=3B taking a deep breath=2C sl= owing down. Sometimes=2C so much we cancel
>=3B >=3B the import and = restart (the imports pick up where they left off).
>=3B >=3B
>= =3B >=3B What would the bg_writer settings be in this case?
>=3B >=3B I'm not sure what that is based on information so far=2C so it's>=3B unclear whether background writer settings would help=3B but on th= e
>=3B face of it my bet would be that it's a context switching storm = or
>=3B swapping=2C and the connection pool would be the better soluti= on.
>=3B Those poor butchers are just overwhelmed....
>=3B
&= gt=3B -Kevin
>=3B
>=3B
= = --_4286a752-310f-4242-a300-a2b9aeab52a1_--