Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3C423B5DC16 for ; Tue, 13 Sep 2011 15:57:04 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 59086-08 for ; Tue, 13 Sep 2011 18:56:56 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from blu0-omc2-s27.blu0.hotmail.com (blu0-omc2-s27.blu0.hotmail.com [65.55.111.102]) by mail.postgresql.org (Postfix) with ESMTP id 35EC6B5DBD8 for ; Tue, 13 Sep 2011 15:56:55 -0300 (ADT) Received: from BLU153-W38 ([65.55.111.73]) by blu0-omc2-s27.blu0.hotmail.com with Microsoft SMTPSVC(6.0.3790.4675); Tue, 13 Sep 2011 11:56:54 -0700 Message-ID: Content-Type: multipart/alternative; boundary="_fa64cbc8-4358-4cee-b9a0-2aec346dcbdd_" 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: Tue, 13 Sep 2011 18:56:53 +0000 Importance: Normal In-Reply-To: <4E6A11AC0200002500041055@gw.wicourts.gov> References: , <4E6A11AC0200002500041055@gw.wicourts.gov> MIME-Version: 1.0 X-OriginalArrivalTime: 13 Sep 2011 18:56:54.0427 (UTC) FILETIME=[E78286B0:01CC7246] 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/188 X-Sequence-Number: 44964 --_fa64cbc8-4358-4cee-b9a0-2aec346dcbdd_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Kevin=2C (sorry for late reply=2C PG forums seem to have problems with my e-mail cli= ent=2C now trying web mail) =20 First=2C thanks for taking the time. I wish I could write back with quick= =2C terse questions to your detailed reply - but I'm sorry=2C this is still= going to be a wordy post. >> max_connections =3D 300 >Too high. Both throughput and latency should improve with correct use=20 >of a connection pooler. Even for 300 stateful applications that can remain connected for up to a we= ek=2C continuously distilling data (imports)? The 300 is overkill=2C a sys = admin raised it from 100 when multiple large projects were loaded and the s= erver refused the additional connections. We can take large imports and bre= ak them into multiple smaller ones which the operators are doing to try and= improve import performance. It does result in some improvement=2C but I th= ink they have gone over the top and the answer is to improve DB and OS perf= ormance. Perhaps I don't understand how connection pooling will work with s= tateful apps that are continuously reading and writing (the apps are DB I/O= bound). =20 > you want the controller configured for write-back (with automatic=20 > switch to write-through on low or failed battery=2C if possible). For performance or safety reasons? Since the sys admin thinks there's no pe= rformance benefit from this=2C I would like to be clear on why we should do= this. >> Can our particular setup benefit from changing the bgwriter values? > Probably not. If you find that your interactive users have periods=20 > where queries seem to "freeze" for a few minutes at a time and then=20 > return to normal levels of performance=2C you might need to make this=20 > more aggressive. We actually experience this. Once again=2C remember the overwhelming use of= the system is long-running import threads with continuous connections. Eve= ry now and then the imports behave as if they are suddenly taking a deep br= eath=2C slowing down. Sometimes=2C so much we cancel the import and restart= (the imports pick up where they left off). What would the bg_writer settings be in this case? Thanks again for your time=2C Carlo =20 > Date: Fri=2C 9 Sep 2011 13:16:28 -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 > > this is a full-time ETL system=2C with only a handful of actual > > *users* and automated processes over 300 connections running > > *import* programs 24/7 > =20 > > Intel* Xeon* Processor X5560 (8M Cache=2C 2.80 GHz=2C 6.40=20 > > GT/s Intel* QPI) x 2=2C dual quad core 48 GB RAM > > RAID 10=2C 6 X 600 GB 15krpm SAS) > =20 > So=2C eight cores and six spindles. You are probably going to see > *much* better throughput if you route those 300 workers through > about 22 connections. Use a connection pooler which limits active > transactions to that and queues up requests to start a transaction. > =20 > > Sys admin says that battery-backup RAID controller and=20 > > consequent write settings should have no impact on performance. > =20 > With only six drives=2C I your OS=2C WAL files=2C indexes=2C and heap fil= es > are all in the same RAID? If so=2C your sys admin is wrong -- you > want the controller configured for write-back (with automatic switch > to write-through on low or failed battery=2C if possible). > =20 > > max_connections =3D 300 > =20 > Too high. Both throughput and latency should improve with correct > use of a connection pooler. > =20 > > shared_buffers =3D=20 > > 500MB # At 48GB of RAM=2C could we go to 2GB > =20 > You might benefit from as much as 8GB=2C but only testing with your > actual load will show for sure. > =20 > > effective_cache_size =3D=20 > > 2457MB # Sys admin says assume 25% of 48GB > =20 > Add together the shared_buffers setting and whatever the OS tells > you is used for cache under your normal load. It's usually 75% of > RM or higher. (NOTE: This doesn't cause any allocation of RAM=3B it's > a hint to the cost calculations.) > =20 > > work_mem =3D=20 > > 512MB # Complex reads are called many times a second > =20 > Maybe=2C if you use the connection pooler as described above. Each > connection can allocate this multiple times. So with 300 > connections you could very easily start using 150GB of RAM in > addition to your shared buffers=3B causing a swap storm followed by > OOM crashes. If you stay with 300 connections this *must* be > reduced by at least an order of magnitude. > =20 > > # from each connection=2C so what should this be? > > maintenance_work_mem =3D=20 > > 256MB # Should this be bigger - 1GB at least? > =20 > I'd go to 1 or 2 GB. > =20 > > checkpoint_segments =3D=20 > > 128 # There is lots of write activity=3B this is high=20 > =20 > OK > =20 > > # but could it be higher? > =20 > IMO=2C there's unlikely to be much benefit beyond that. > =20 > > #checkpoint_completion_target not set=3B=20 > > # Recommendation appears to be .9 for our 128 checkpoint segments > =20 > 0.9 is probably a good idea. > =20 > > default_statistics_target =3D=20 > > 200 # Deprecated? > =20 > Depends on your data. The default is 100. You might want to leave > that in general and boost it for specific columns where you find it > is needed. Higher values improve estimates and can lead to better > query plans=2C but boost ANALYZE times and query planning time. > =20 > > # What is the metric for wal_buffers setting? > > wal_buffers =3D=20 > > 4MB # Looks low=2C recommendation appears to be 16MB. > =20 > 16MB is good. > =20 > > # Is it really "set it and forget it"? > =20 > Yeah. > =20 > > #synchronous_commit not set=3B=20 > >=20 > > # Recommendation is to turn this off and leave fsync on > =20 > If this is off=2C it makes lack of write-back on the controller a lot > less painful. Even with write-back it can improve performance some. > It does mean that on a crash you can lose some committed > transactions (typically less than a second's worth)=2C but you will > still have database integrity. > =20 > > #fsync not set=3B=20 > >=20 > > # Recommendation is to leave this on > =20 > Unless you want to rebuild your database from scratch or restore > from backup on an OS crash=2C leave this on. > =20 > > #wal_level not set=3B=20 > >=20 > > # Do we only needed for replication? > =20 > The lowest level just supports crash recovery. The next level > supports archiving=2C for recovery from a PITR-style backup. The > third level is needed to support hot standby (a replicated server on > which you can run targets as it is updated). > =20 > > # The issue of vacuum/analyze is a tricky one. > > # Data imports are running 24/7. One the DB is seeded=2C the vast > > # majority of write activity is updates=2C and not to indexed > > # columns. Deletions are vary rare. > > vacuum_cost_delay =3D=20 > > 20ms > =20 > You could try that. I would monitor for bloat and make things more > aggressive if needed. If you are not vacuuming aggressively enough=2C > performance will slowly degrade. If you let it go too far=2C recovery > can be a lot of work. > =20 > > # The background writer has not been addressed at all. > > # Can our particular setup benefit from changing the bgwriter > > # values? > =20 > Probably not. If you find that your interactive users have periods > where queries seem to "freeze" for a few minutes at a time and then > return to normal levels of performance=2C you might need to make this > more aggressive. > =20 > -Kevin = --_fa64cbc8-4358-4cee-b9a0-2aec346dcbdd_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi Kevin=2C

(sorry for late reply=2C PG forums seem to have problems with my e-mail= client=2C now trying web mail)
 =3B
First=2C thanks for taking t= he time. I wish I could write back with quick=2C terse questions to your de= tailed reply - but I'm sorry=2C this is still going to be a wordy post.

>=3B>=3B max_connections =3D 300
>=3BToo high. Both throughput and latency should improve with correct us= e
>=3Bof a connection pooler.

Even for 300 stateful applications that can remain connected for up to = a week=2C continuously distilling data (imports)? The 300 is overkill=2C a = sys admin raised it from 100 when multiple large projects were loaded and t= he server refused the additional connections. We can take large imports and= break them into multiple smaller ones which the operators are doing to try= and improve import performance. It does result in some improvement=2C but = I think they have gone over the top and the answer is to improve DB and OS = performance. Perhaps I don't understand how connection pooling will work wi= th stateful apps that are continuously reading and writing (the apps are DB= I/O bound).
 =3B
>=3B you want the controller configured for write-back (with = automatic
>=3B switch to write-through on low or failed battery=2C if possible).
For performance or safety reasons? Since the sys admin thinks there's n= o performance benefit from this=2C I would like to be clear on why we shoul= d do this.

>=3B>=3B Can our particular setup benefit from changing the bgwrite= r values?
>=3B Probably not. If you find that your interactive users have periods =
>=3B where queries seem to "freeze" for a few minutes at a time and then =
>=3B return to normal levels of performance=2C you might need to make thi= s
>=3B more aggressive.

We actually experience this. Once again=2C remember the overwhelming us= e of the system is long-running import threads with continuous connections.= Every now and then the imports behave as if they are suddenly taking a dee= p breath=2C slowing down. Sometimes=2C so much we cancel the import and res= tart (the imports pick up where they left off).

What would the bg_writer settings be in this case?

Thanks again for your time=2C

Carlo

 =3B
>=3B Date: Fri=2C 9 Sep 2011 13:= 16:28 -0500
>=3B From: Kevin.Grittner@wicourts.gov
>=3B To: pgsql= -performance@postgresql.org=3B stonec.register@sympatico.ca
>=3B Subje= ct: Re: [PERFORM] Migrated from 8.3 to 9.0 - need to update config (re-pos= t)
>=3B
>=3B Carlo Stonebanks <=3Bstonec.register@sympatico.ca= >=3B wrote:
>=3B
>=3B >=3B this is a full-time ETL system= =2C with only a handful of actual
>=3B >=3B *users* and automated pr= ocesses over 300 connections running
>=3B >=3B *import* programs 24/= 7
>=3B
>=3B >=3B Intel* Xeon* Processor X5560 (8M Cache=2C 2.= 80 GHz=2C 6.40
>=3B >=3B GT/s Intel* QPI) x 2=2C dual quad core 48 = GB RAM
>=3B >=3B RAID 10=2C 6 X 600 GB 15krpm SAS)
>=3B
&g= t=3B So=2C eight cores and six spindles. You are probably going to see
= >=3B *much* better throughput if you route those 300 workers through
&= gt=3B about 22 connections. Use a connection pooler which limits active>=3B transactions to that and queues up requests to start a transaction.=
>=3B
>=3B >=3B Sys admin says that battery-backup RAID contr= oller and
>=3B >=3B consequent write settings should have no impact= on performance.
>=3B
>=3B With only six drives=2C I your OS=2C= WAL files=2C indexes=2C and heap files
>=3B are all in the same RAID?= If so=2C your sys admin is wrong -- you
>=3B want the controller con= figured for write-back (with automatic switch
>=3B to write-through on= low or failed battery=2C if possible).
>=3B
>=3B >=3B max_co= nnections =3D 300
>=3B
>=3B Too high. Both throughput and late= ncy should improve with correct
>=3B use of a connection pooler.
&g= t=3B
>=3B >=3B shared_buffers =3D
>=3B >=3B 500MB #= At 48GB of RAM=2C could we go to 2GB
>=3B
>=3B You might benef= it from as much as 8GB=2C but only testing with your
>=3B actual load = will show for sure.
>=3B
>=3B >=3B effective_cache_size =3D <= br>>=3B >=3B 2457MB # Sys admin says assume 25% of 48GB
>=3B
= >=3B Add together the shared_buffers setting and whatever the OS tells>=3B you is used for cache under your normal load. It's usually 75% of<= br>>=3B RM or higher. (NOTE: This doesn't cause any allocation of RAM=3B= it's
>=3B a hint to the cost calculations.)
>=3B
>=3B >= =3B work_mem =3D
>=3B >=3B 512MB # Complex reads are c= alled many times a second
>=3B
>=3B Maybe=2C if you use the con= nection pooler as described above. Each
>=3B connection can allocate = this multiple times. So with 300
>=3B connections you could very easi= ly start using 150GB of RAM in
>=3B addition to your shared buffers=3B= causing a swap storm followed by
>=3B OOM crashes. If you stay with = 300 connections this *must* be
>=3B reduced by at least an order of ma= gnitude.
>=3B
>=3B >=3B # from each connection=2C so what sho= uld this be?
>=3B >=3B maintenance_work_mem =3D
>=3B >=3B 25= 6MB # Should this be bigger - 1GB at least?
>=3B
>=3B I'd go t= o 1 or 2 GB.
>=3B
>=3B >=3B checkpoint_segments =3D
>= =3B >=3B 128 # There is lots of write activity=3B this is high
&g= t=3B
>=3B OK
>=3B
>=3B >=3B # but could it be higher?<= br>>=3B
>=3B IMO=2C there's unlikely to be much benefit beyond tha= t.
>=3B
>=3B >=3B #checkpoint_completion_target not set=3B >=3B >=3B # Recommendation appears to be .9 for our 128 checkpoint s= egments
>=3B
>=3B 0.9 is probably a good idea.
>=3B
&= gt=3B >=3B default_statistics_target =3D
>=3B >=3B 200 # Depreca= ted?
>=3B
>=3B Depends on your data. The default is 100. You = might want to leave
>=3B that in general and boost it for specific col= umns where you find it
>=3B is needed. Higher values improve estimate= s and can lead to better
>=3B query plans=2C but boost ANALYZE times a= nd query planning time.
>=3B
>=3B >=3B # What is the metric f= or wal_buffers setting?
>=3B >=3B wal_buffers =3D
>=3B >=3B = 4MB # Looks low=2C recommendation appears to be 16MB.
>=3B=
>=3B 16MB is good.
>=3B
>=3B >=3B # Is it really "set= it and forget it"?
>=3B
>=3B Yeah.
>=3B
>=3B >= =3B #synchronous_commit not set=3B
>=3B >=3B
>=3B >=3B # R= ecommendation is to turn this off and leave fsync on
>=3B
>=3B = If this is off=2C it makes lack of write-back on the controller a lot
&g= t=3B less painful. Even with write-back it can improve performance some.>=3B It does mean that on a crash you can lose some committed
>=3B= transactions (typically less than a second's worth)=2C but you will
>= =3B still have database integrity.
>=3B
>=3B >=3B #fsync not = set=3B
>=3B >=3B
>=3B >=3B # Recommendation is to leave th= is on
>=3B
>=3B Unless you want to rebuild your database from s= cratch or restore
>=3B from backup on an OS crash=2C leave this on.>=3B
>=3B >=3B #wal_level not set=3B
>=3B >=3B
>= =3B >=3B # Do we only needed for replication?
>=3B
>=3B The = lowest level just supports crash recovery. The next level
>=3B suppor= ts archiving=2C for recovery from a PITR-style backup. The
>=3B third= level is needed to support hot standby (a replicated server on
>=3B w= hich you can run targets as it is updated).
>=3B
>=3B >=3B # = The issue of vacuum/analyze is a tricky one.
>=3B >=3B # Data impor= ts are running 24/7. One the DB is seeded=2C the vast
>=3B >=3B # m= ajority of write activity is updates=2C and not to indexed
>=3B >=3B= # columns. Deletions are vary rare.
>=3B >=3B vacuum_cost_delay = =3D
>=3B >=3B 20ms
>=3B
>=3B You could try that. I wou= ld monitor for bloat and make things more
>=3B aggressive if needed. = If you are not vacuuming aggressively enough=2C
>=3B performance will = slowly degrade. If you let it go too far=2C recovery
>=3B can be a lo= t of work.
>=3B
>=3B >=3B # The background writer has not bee= n addressed at all.
>=3B >=3B # Can our particular setup benefit fr= om changing the bgwriter
>=3B >=3B # values?
>=3B
>=3B = Probably not. If you find that your interactive users have periods
>= =3B where queries seem to "freeze" for a few minutes at a time and then
= >=3B return to normal levels of performance=2C you might need to make thi= s
>=3B more aggressive.
>=3B
>=3B -Kevin
= --_fa64cbc8-4358-4cee-b9a0-2aec346dcbdd_--