Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 25FF8B5DBBE for ; Mon, 5 Sep 2011 10:57:53 -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 62505-02-5 for ; Mon, 5 Sep 2011 13:57:46 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mail.postgresql.org (Postfix) with ESMTP id 14EACB5DEAA for ; Mon, 5 Sep 2011 10:57:45 -0300 (ADT) Received: by wwi36 with SMTP id 36so4933103wwi.19 for ; Mon, 05 Sep 2011 06:57:45 -0700 (PDT) Received: by 10.216.160.8 with SMTP id t8mr711550wek.97.1315231065617; Mon, 05 Sep 2011 06:57:45 -0700 (PDT) Received: from [192.168.121.74] ([85.133.43.170]) by mx.google.com with ESMTPS id m2sm8311478wbp.5.2011.09.05.06.57.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Sep 2011 06:57:44 -0700 (PDT) Subject: Re: Rather large LA Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=iso-8859-1 From: Richard Shaw In-Reply-To: <4E64D0FE.6020704@squeakycode.net> Date: Mon, 5 Sep 2011 14:57:43 +0100 Cc: pgsql-performance@postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <97BCA6CA-A1DB-43C7-B710-C2836B656FD6@aggress.net> References: <4E64D0FE.6020704@squeakycode.net> To: Andy Colson X-Mailer: Apple Mail (2.1244.3) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201109/36 X-Sequence-Number: 44812 Hi Andy, It's not a new issue no, It's a legacy system that is in no way ideal = but is also not in a position to be overhauled. Indexes are correct, = tables are up to 25 million rows. =20 On startup, it hits CPU more than IO, I'll provide some additional stats = after I restart it tonight. Server logs have been reviewed and where possible, slow queries have = been fixed. =20 Autovacuum has been disabled and set to run manually via cron during a = quiet period and fsync has recently been turned off to gauge any real = world performance increase, there is battery backup on the raid card = providing some level of resilience. Thanks Richard On 5 Sep 2011, at 14:39, Andy Colson wrote: > On 09/05/2011 05:28 AM, Richard Shaw wrote: >>=20 >> Hi, >>=20 >> I have a database server that's part of a web stack and is = experiencing prolonged load average spikes of up to 400+ when the db is = restarted and first accessed by the other parts of the stack and has = generally poor performance on even simple select queries. >>=20 >=20 > Is the slowness new? Or has it always been a bit slow? Have you = checked for bloat on your tables/indexes? >=20 > When you start up, does it peg a cpu or sit around doing IO? >=20 > Have you reviewed the server logs? >=20 >=20 > autovacuum | off >=20 > Why? I assume that's a problem. >=20 > fsync | off >=20 > Seriously? >=20 >=20 > -Andy >=20 >=20 >=20 >> There are 30 DBs in total on the server coming in at 226GB. The one = that's used the most is 67GB and there are another 29 that come to = 159GB. >>=20 >> I'd really appreciate it if you could review my configurations below = and make any suggestions that might help alleviate the performance = issues. I've been looking more into the shared buffers to the point of = installing the contrib module to check what they're doing, possibly = installing more RAM as the most used db @ 67GB might appreciate it, or = moving the most used DB onto another set of disks, possible SSD. >>=20 >>=20 >> PostgreSQL 9.0.4 >> Pgbouncer 1.4.1 >>=20 >> Linux 2.6.18-238.9.1.el5 #1 SMP Tue Apr 12 18:10:13 EDT 2011 x86_64 = x86_64 x86_64 GNU/Linux >>=20 >> CentOS release 5.6 (Final) >>=20 >> 4 x Intel Xeon-NehalemEX E7540-HexCore [2GHz] ( 24 physical cores ) >> 32GB DDR3 RAM >> 1 x Adaptec 5805 Z SATA/SAS RAID with battery backup >> 4 x Seagate Cheetah ST3300657SS 300GB 15RPM SAS drives in RAID 10 >> 1 x 500GB 7200RPM SATA disk >>=20 >> Postgres and the OS reside on the same ex3 filesystem, whilst query = and archive logging go onto the SATA disk which is also ext3. >>=20 >>=20 >> name | = current_setting >> = --------------------------------+-----------------------------------------= --------------------------------------------------------------------------= >> version | PostgreSQL 9.0.4 on = x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red = Hat 4.1.2-48), 64-bit >> archive_command | tar jcf /disk1/db-wal/%f.tar.bz2 %p >> archive_mode | on >> autovacuum | off >> checkpoint_completion_target | 0.9 >> checkpoint_segments | 10 >> client_min_messages | notice >> effective_cache_size | 17192MB >> external_pid_file | /var/run/postgresql/9-main.pid >> fsync | off >> full_page_writes | on >> lc_collate | en_US.UTF-8 >> lc_ctype | en_US.UTF-8 >> listen_addresses | >> log_checkpoints | on >> log_destination | stderr >> log_directory | /disk1/pg_log >> log_error_verbosity | verbose >> log_filename | postgresql-%Y-%m-%d_%H%M%S.log >> log_line_prefix | %m %u %h >> log_min_duration_statement | 250ms >> log_min_error_statement | error >> log_min_messages | notice >> log_rotation_age | 1d >> logging_collector | on >> maintenance_work_mem | 32MB >> max_connections | 1000 >> max_prepared_transactions | 25 >> max_stack_depth | 4MB >> port | 6432 >> server_encoding | UTF8 >> shared_buffers | 8GB >> superuser_reserved_connections | 3 >> synchronous_commit | on >> temp_buffers | 5120 >> TimeZone | UTC >> unix_socket_directory | /var/run/postgresql >> wal_buffers | 10MB >> wal_level | archive >> wal_sync_method | fsync >> work_mem | 16MB >>=20 >>=20 >> Pgbouncer config >>=20 >> [databases] >> * =3D port=3D6432 >> [pgbouncer] >> user=3Dpostgres >> pidfile =3D /tmp/pgbouncer.pid >> listen_addr =3D >> listen_port =3D 5432 >> unix_socket_dir =3D /var/run/postgresql >> auth_type =3D trust >> auth_file =3D /etc/pgbouncer/userlist.txt >> admin_users =3D postgres >> stats_users =3D postgres >> pool_mode =3D session >> server_reset_query =3D DISCARD ALL; >> server_check_query =3D select 1 >> server_check_delay =3D 10 >> server_idle_timeout =3D 5 >> server_lifetime =3D 0 >> max_client_conn =3D 4096 >> default_pool_size =3D 100 >> log_connections =3D 1 >> log_disconnections =3D 1 >> log_pooler_errors =3D 1 >> client_idle_timeout =3D 30 >> reserve_pool_size =3D 800 >>=20 >>=20 >> Thanks in advance >>=20 >> Richard >>=20 >>=20 >=20