Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CEDEF6347AF for ; Thu, 8 Apr 2010 18:19:50 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 72184-08 for ; Thu, 8 Apr 2010 21:19:40 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-vbr14.xs4all.nl (smtp-vbr14.xs4all.nl [194.109.24.34]) by mail.postgresql.org (Postfix) with ESMTP id F359263475F for ; Thu, 8 Apr 2010 18:19:39 -0300 (ADT) Received: from webmail.xs4all.nl (dovemail8.xs4all.nl [194.109.26.10]) by smtp-vbr14.xs4all.nl (8.13.8/8.13.8) with ESMTP id o38LJbEK093044 for ; Thu, 8 Apr 2010 23:19:38 +0200 (CEST) (envelope-from er@xs4all.nl) Received: from 156.83.0.57 (SquirrelMail authenticated user er) by webmail.xs4all.nl with HTTP; Thu, 8 Apr 2010 23:19:38 +0200 Message-ID: <29917878e0efe02a50bbc400e6e4034e.squirrel@webmail.xs4all.nl> Date: Thu, 8 Apr 2010 23:19:38 +0200 Subject: testing HS/SR - performance difference primary vs. standby From: "Erik Rijkers" To: pgsql-testers@postgresql.org User-Agent: SquirrelMail/1.4.18 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.185 tagged_above=-10 required=5 tests=BAYES_40=-0.185 X-Spam-Level: X-Archive-Number: 201004/6 X-Sequence-Number: 76 What is the expected difference in (select-) performance between a primary and standby? (v9.0) I expected no difference, but I find large differences. Here is one test: On port 6566 is primary, on port 6566 slave. They are both on an otherwise idle machine. Initialize: pgbench -h /tmp -p 6565 -i -s 10000 replicas Then, after waiting for the standby to catch up: 3x pgbench on primary: pgbench -h /tmp -p 6565 -n -S -c 20 -T 900 replicas tps = 518.854079 (including connections establishing) tps = 563.715825 (including connections establishing) tps = 614.428721 (including connections establishing) 3x pgbench on standby: pgbench -h /tmp -p 6566 -n -S -c 20 -T 900 replicas tps = 272.378369 (including connections establishing) tps = 287.080326 (including connections establishing) tps = 304.373053 (including connections establishing) The postgresql.conf's are almost the same: grep -Ev '^([[:space:]]*#)|(^$)' ... pgsql.sr_primary/data/postgresql.conf:data_directory = '/var/data1/pg_stuff/pg_installations/pgsql.sr_primary/data' pgsql.sr_primary/data/postgresql.conf:port = 6565 pgsql.sr_primary/data/postgresql.conf:max_connections = 100 pgsql.sr_primary/data/postgresql.conf:shared_buffers = 32MB pgsql.sr_primary/data/postgresql.conf:checkpoint_segments = 50 pgsql.sr_primary/data/postgresql.conf:archive_mode = 'on' pgsql.sr_primary/data/postgresql.conf:archive_command= 'cp %p /var/data1/pg_stuff/dump/replication_archive/%f' pgsql.sr_primary/data/postgresql.conf:max_wal_senders = 5 pgsql.sr_primary/data/postgresql.conf:datestyle = 'iso, mdy' pgsql.sr_primary/data/postgresql.conf:lc_messages = 'en_US.UTF-8' pgsql.sr_primary/data/postgresql.conf:lc_monetary = 'en_US.UTF-8' pgsql.sr_primary/data/postgresql.conf:lc_numeric = 'en_US.UTF-8' pgsql.sr_primary/data/postgresql.conf:lc_time = 'en_US.UTF-8' pgsql.sr_primary/data/postgresql.conf:default_text_search_config = 'pg_catalog.english' pgsql.sr_slavery/data/postgresql.conf:data_directory = '/var/data1/pg_stuff/pg_installations/pgsql.sr_slavery/data' pgsql.sr_slavery/data/postgresql.conf:port = 6566 pgsql.sr_slavery/data/postgresql.conf:max_connections = 100 pgsql.sr_slavery/data/postgresql.conf:shared_buffers = 32MB pgsql.sr_slavery/data/postgresql.conf:checkpoint_segments = 50 pgsql.sr_slavery/data/postgresql.conf:archive_mode = 'on' pgsql.sr_slavery/data/postgresql.conf:archive_command= 'cp %p /var/data1/pg_stuff/dump/replication_archive/%f' pgsql.sr_slavery/data/postgresql.conf:max_wal_senders = 5 pgsql.sr_slavery/data/postgresql.conf:datestyle = 'iso, mdy' pgsql.sr_slavery/data/postgresql.conf:lc_messages = 'en_US.UTF-8' pgsql.sr_slavery/data/postgresql.conf:lc_monetary = 'en_US.UTF-8' pgsql.sr_slavery/data/postgresql.conf:lc_numeric = 'en_US.UTF-8' pgsql.sr_slavery/data/postgresql.conf:lc_time = 'en_US.UTF-8' pgsql.sr_slavery/data/postgresql.conf:default_text_search_config = 'pg_catalog.english' Is that large difference expected? (what causes it?) Thanks, Erik Rijkers