pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Vasiliy I Ozerov <vozerov@2reallife.com>
To: pgsql-admin@postgresql.org
Subject: Postgres 9.2 CPU Usage
Date: Fri, 20 Dec 2013 00:56:47 +0400
Message-ID: <0ECD0DAFC1A24867A84CBF6C25C372F9@2reallife.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

Good day!

Sometimes ago we order new Dell (Dell PowerEdge T720 DX290) server, with this configuration:

1. 128 Gb DDR3 ECC RAM
2. Dual Intel Xeon E5-2620 Hexa Core incl. Hyper-Thrreading Tecknology
3. 2x 600Gb SSD With PERC H710 mini RAID 1

We store a not big database (around 50 Gb) at postgresql, config:


archive_command = 'cp %p /var/lib/postgresql/9.2/main/archive/%f'
archive_mode = on
autovacuum = on
autovacuum_max_workers = '1'
checkpoint_completion_target = '0.75'
checkpoint_segments = '256'
checkpoint_timeout = '45min'
constraint_exclusion = on
data_directory = '/var/lib/postgresql/9.2/main'
datestyle = 'iso, mdy'
default_statistics_target = '50'
default_text_search_config = 'pg_catalog.english'
effective_cache_size = '72GB'
enable_seqscan = off
external_pid_file = '/var/run/postgresql/9.2-main.pid'
hba_file = '/etc/postgresql/9.2/main/pg_hba.conf'
ident_file = '/etc/postgresql/9.2/main/pg_ident.conf'
lc_messages = 'en_US.UTF-8'
lc_monetary = 'en_US.UTF-8'
lc_numeric = 'en_US.UTF-8'
lc_time = 'en_US.UTF-8'
listen_addresses = '*'
log_checkpoints = on
log_connections = on
log_directory = '/var/log/postgresql/'
log_duration = off
log_line_prefix = '%t '
log_lock_waits = on
log_min_duration_statement = '50ms'
log_min_error_statement = 'notice'
log_min_messages = 'notice'
log_statement = 'none'
log_timezone = 'GMT-4'
logging_collector = on
maintenance_work_mem = '1GB'
max_connections = '150'
max_wal_senders = '3'
port = '56432'
shared_buffers = '24GB'
ssl = off
timezone = 'GMT-4'
track_activities = on
track_counts = on
track_functions = 'all'
unix_socket_directory = '/var/run/postgresql'
wal_buffers = '8MB'
wal_level = 'hot_standby'
work_mem = ‘32MB'


But we have a strange cpu usage by postgresql (LA about 4). But there is no a lot of requests or heavy requests. We use pgbouncer, so postgresql doesn’t accept connections from users, only from pgbouncer. And the number of active requests per second is about 5:

postgres=# select count(datid) from pg_stat_activity where state='active';
 count
-------
     5
(1 row)

postgres=#

But the time spent to request is about 500 ms (from postgresql log).

I tried to strace postgresql and I see the following:

root@server:/var/lib/postgresql# strace -c -f -p 41236
Process 41236 attached - interrupt to quit
^CProcess 41236 detached
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 50.80    0.000508           3       201           fdatasync
 25.40    0.000254           0     82860           lseek
 14.60    0.000146           0      1525           sendto
  9.20    0.000092           0       737           recvfrom
  0.00    0.000000           0        12           read
  0.00    0.000000           0       321           write
  0.00    0.000000           0        19         3 open
  0.00    0.000000           0        17           close
  0.00    0.000000           0         2           brk
  0.00    0.000000           0         2           setitimer
  0.00    0.000000           0         1           kill
  0.00    0.000000           0       153           semop
------ ----------- ----------- --------- --------- ----------------
100.00    0.001000                 85850         3 total


I think it is some misconfiguration issue, so can you help me with some config/sysctl options for such server?

Thank you!


--  
Vasiliy I Ozerov

view thread (3+ messages)  latest in thread

Message-ID: <0ECD0DAFC1A24867A84CBF6C25C372F9@2reallife.com>
Permalink:  ../0ECD0DAFC1A24867A84CBF6C25C372F9@2reallife.com/
Also on:    postgresql.org/message-id/0ECD0DAFC1A24867A84CBF6C25C372F9@2reallife.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: vozerov@2reallife.com
  Subject: Re: Postgres 9.2 CPU Usage
  In-Reply-To: <0ECD0DAFC1A24867A84CBF6C25C372F9@2reallife.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox