Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id D3AFF9FB3B1 for ; Mon, 21 May 2007 11:43:02 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 23188-08 for ; Mon, 21 May 2007 11:42:57 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.171]) by postgresql.org (Postfix) with ESMTP id 543A29FB41C for ; Mon, 21 May 2007 11:42:56 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so898173ugf for ; Mon, 21 May 2007 07:42:54 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; b=rwsrKcojW/o+70j6RROkBYniTGqwbf7G27c1rQdwXscs5kZtj9uxnxUo2He1e4uuAN6UMrDkdg0pL843RBG/Y7s9Ff9pCbrQ5H0T6L5Jj8XJSuX47eqAf5iNyZjuN+8M5fEcKEnIeCyRNvhigo6gwWO9a38sT6hnZdWrdEigRrw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=pHENdcGiolkD+vALrdlVBgypwj7Y4QBbNbSDTVehsQfQUNQOZ0KIx/HfVlhpwNdduf/LB8WDbsvWCI84iT5IDslOczeD09kKjM3SCdyrTyaCR5bo0ne4C1Po/kHjYcqqiX2YR1HGydzfeEiUBPk7Nmb+ZVVpjdRY0kkmCYbHYI8= Received: by 10.78.167.12 with SMTP id p12mr1167991hue.1179758574416; Mon, 21 May 2007 07:42:54 -0700 (PDT) Received: by 10.78.201.16 with HTTP; Mon, 21 May 2007 07:42:54 -0700 (PDT) Message-ID: <1d219a6f0705210742rbd45663oc2b54bd3d1685305@mail.gmail.com> Date: Mon, 21 May 2007 10:42:54 -0400 From: "Chris Hoover" To: "PGSQL Performance" Subject: Increasing Shared_buffers = slow commits? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_62135_21221604.1179758574365" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/391 X-Sequence-Number: 24781 ------=_Part_62135_21221604.1179758574365 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi everyone, I am testing my shared_buffers pool and am running into a problem with slow inserts and commits. I was reading in several places that in the 8.XPostgreSQL engines should set the shared_buffers closer to 25% of the systems memory. On me development system, I have done that. We have 9GB of memory on the machine and I set my shared_buffers = 292188 (~25% of total memory). When my users logged in today, they are noticing the system is much slower. Tracing my log files, I am seeing that most of the commits are taking over 1sec. I am seeing a range of 1-5 seconds per commit. What is the correlation here between the shared_buffers and the disk activity? This is not something I would have expected at all. I was wanting to test for improved performance so I can have a good basis for making changes in my production systems. My postgresql.conf is pasted below. Thanks for any comments/clarifications, chris PG 8.1.3 RH 4 AS # ----------------------------- # PostgreSQL configuration file # ----------------------------- listen_addresses = '*' # what IP address(es) to listen on; port = 50001 max_connections = 1024 superuser_reserved_connections = 10 shared_buffers = 292188 # setting to 25% of memory max_prepared_transactions = 256 # can be 0 or more work_mem = 16384 # min 64, size in KB maintenance_work_mem = 1048576 # min 1024, size in KB max_fsm_pages = 8000000 # min max_fsm_relations*16, 6 bytes each max_fsm_relations = 20000 # min 100, ~70 bytes each vacuum_cost_delay = 0 # 0-1000 milliseconds vacuum_cost_page_hit = 0 # 0-10000 credits vacuum_cost_page_miss = 0 # 0-10000 credits vacuum_cost_page_dirty = 0 # 0-10000 credits vacuum_cost_limit = 1 # 0-10000 credits wal_buffers = 64 # min 4, 8KB each checkpoint_segments = 256 # in logfile segments, min 1, 16MB each checkpoint_timeout = 300 # range 30-3600, in seconds archive_command = '/home/postgres/bin/archive_pg_xlog.sh %p %f 50001' # command to use to archive a logfile effective_cache_size = 383490 # typically 8KB each random_page_cost = 2 # units are one sequential page fetch default_statistics_target = 100 # range 1-1000 constraint_exclusion = on redirect_stderr = on # Enable capturing of stderr into log log_directory = 'pg_log' # Directory where log files are written log_truncate_on_rotation = on # If on, any existing log file of the same log_rotation_age = 1440 # Automatic rotation of logfiles will log_rotation_size = 1048576 # Automatic rotation of logfiles will log_min_messages = debug2 # Values, in order of decreasing detail: log_min_duration_statement = 0 # -1 is disabled, 0 logs all statements log_connections = on log_disconnections = on log_duration = on log_line_prefix = '%d,%p,%u,%m,%c,%l,%s,%x,%i,' # Special values: log_statement = 'all' # none, mod, ddl, all stats_start_collector = on stats_command_string = on stats_block_level = on stats_row_level = on stats_reset_on_server_start = on autovacuum = on # enable autovacuum subprocess? autovacuum_naptime = 60 # time between autovacuum runs, in secs autovacuum_vacuum_threshold = 1000 # min # of tuple updates before autovacuum_analyze_threshold = 500 # min # of tuple updates before autovacuum_vacuum_scale_factor = 0.001 # fraction of rel size before autovacuum_analyze_scale_factor = 0.0005 # fraction of rel size before autovacuum_vacuum_cost_delay = -1 # default vacuum cost delay for autovacuum_vacuum_cost_limit = -1 # default vacuum cost limit for statement_timeout = 0 # 0 is disabled, in milliseconds lc_messages = 'C' # locale for system error message lc_monetary = 'C' # locale for monetary formatting lc_numeric = 'C' # locale for number formatting lc_time = 'C' # locale for time formatting add_missing_from = on ------=_Part_62135_21221604.1179758574365 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi everyone,

I am testing my shared_buffers pool and am running into a problem with slow inserts and commits.  I was reading in several places that in the 8.X PostgreSQL engines should set the shared_buffers closer to 25% of the systems memory.  On me development system, I have done that.  We have 9GB of memory on the machine and I set my shared_buffers = 292188 (~25% of total memory).

When my users logged in today, they are noticing the system is much slower.  Tracing my log files, I am seeing that most of the commits are taking over 1sec.  I am seeing a range of 1-5 seconds per commit.

What is the correlation here between the shared_buffers and the disk activity?  This is not something I would have expected at all.

I was wanting to test for improved performance so I can have a good basis for making changes in my production systems.

My postgresql.conf is pasted below.

Thanks for any comments/clarifications,

chris
PG 8.1.3
RH 4 AS

# -----------------------------
# PostgreSQL configuration file
# -----------------------------

listen_addresses = '*'        # what IP address(es) to listen on;

port = 50001

max_connections = 1024

superuser_reserved_connections = 10

shared_buffers = 292188            # setting to 25% of memory

max_prepared_transactions = 256        # can be 0 or more

work_mem = 16384            # min 64, size in KB

maintenance_work_mem = 1048576        # min 1024, size in KB

max_fsm_pages = 8000000            # min max_fsm_relations*16, 6 bytes each

max_fsm_relations = 20000        # min 100, ~70 bytes each

vacuum_cost_delay = 0            # 0-1000 milliseconds

vacuum_cost_page_hit = 0        # 0-10000 credits

vacuum_cost_page_miss = 0        # 0-10000 credits

vacuum_cost_page_dirty = 0        # 0-10000 credits

vacuum_cost_limit = 1            # 0-10000 credits

wal_buffers = 64            # min 4, 8KB each

checkpoint_segments = 256        # in logfile segments, min 1, 16MB each

checkpoint_timeout = 300        # range 30-3600, in seconds

archive_command = '/home/postgres/bin/archive_pg_xlog.sh %p %f 50001'    # command to use to archive a logfile

effective_cache_size = 383490        # typically 8KB each

random_page_cost = 2            # units are one sequential page fetch

default_statistics_target = 100        # range 1-1000

constraint_exclusion = on

redirect_stderr = on            # Enable capturing of stderr into log

log_directory = 'pg_log'        # Directory where log files are written

log_truncate_on_rotation = on           # If on, any existing log file of the same

log_rotation_age = 1440            # Automatic rotation of logfiles will

log_rotation_size = 1048576            # Automatic rotation of logfiles will

log_min_messages = debug2        # Values, in order of decreasing detail:

log_min_duration_statement = 0        # -1 is disabled, 0 logs all statements

log_connections = on

log_disconnections = on

log_duration = on

log_line_prefix = '%d,%p,%u,%m,%c,%l,%s,%x,%i,'    # Special values:

log_statement = 'all'            # none, mod, ddl, all

stats_start_collector = on

stats_command_string = on

stats_block_level = on

stats_row_level = on

stats_reset_on_server_start = on

autovacuum = on            # enable autovacuum subprocess?

autovacuum_naptime = 60        # time between autovacuum runs, in secs

autovacuum_vacuum_threshold = 1000    # min # of tuple updates before

autovacuum_analyze_threshold = 500    # min # of tuple updates before

autovacuum_vacuum_scale_factor = 0.001    # fraction of rel size before

autovacuum_analyze_scale_factor = 0.0005    # fraction of rel size before

autovacuum_vacuum_cost_delay = -1    # default vacuum cost delay for

autovacuum_vacuum_cost_limit = -1    # default vacuum cost limit for

statement_timeout = 0            # 0 is disabled, in milliseconds

lc_messages = 'C'            # locale for system error message

lc_monetary = 'C'            # locale for monetary formatting

lc_numeric = 'C'            # locale for number formatting

lc_time = 'C'                # locale for time formatting

add_missing_from = on
------=_Part_62135_21221604.1179758574365--