Note that there are some explanatory texts on larger screens.

plurals
  1. POThrottling i/o in postgres's pg_dump?
    primarykey
    data
    text
    <p>So we have a production database that is 32GB on a machine with 16GB of RAM. Thanks to caching this is usually not a problem at all. But whenever I start a pg_dump of the database, queries from the app servers start queueing up, and after a few minutes the queue runs away and our app grinds to a halt.</p> <p>I'll be the first to acknowledge that we have query performance issues, and we're addressing those. Meanwhile, I want to be able to run pg_dump nightly, in a way that sips from the database and doesn't take our app down. I don't care if it takes hours. Our app doesn't run any DDL, so I'm not worried about lock contention.</p> <p>Attempting to fix the problem, I'm running pg_dump with both nice and ionice. Unfortunately, this doesn't address the issue.</p> <pre><code>nice ionice -c2 -n7 pg_dump -Fc production_db -f production_db.sql </code></pre> <p>Even with ionice I still see the issue above. It appears that i/o wait and lots of seeks are causing the problem.</p> <pre><code>vmstat 1 </code></pre> <p>Shows me that iowait hovers around 20-25% and spikes to 40% sometimes. Real CPU % fluctuates between 2-5% and spikes to 70% sometimes.</p> <p>I don't believe locks are a possible culprit. When I run this query:</p> <pre><code>select pg_class.relname,pg_locks.* from pg_class,pg_locks where pg_class.relfilenode=pg_locks.relation; </code></pre> <p>I only see locks which are marked granted = 't'. We don't typically run any DDL in production -- so locks don't seem to be the issue.</p> <p>Here is output from a ps with the WCHAN column enabled:</p> <pre><code>PID WIDE S TTY TIME COMMAND 3901 sync_page D ? 00:00:50 postgres: [local] COPY 3916 - S ? 00:00:01 postgres: SELECT 3918 sync_page D ? 00:00:07 postgres: INSERT 3919 semtimedop S ? 00:00:04 postgres: SELECT 3922 - S ? 00:00:01 postgres: SELECT 3923 - S ? 00:00:01 postgres: SELECT 3924 - S ? 00:00:00 postgres: SELECT 3927 - S ? 00:00:06 postgres: SELECT 3928 - S ? 00:00:06 postgres: SELECT 3929 - S ? 00:00:00 postgres: SELECT 3930 - S ? 00:00:00 postgres: SELECT 3931 - S ? 00:00:00 postgres: SELECT 3933 - S ? 00:00:00 postgres: SELECT 3934 - S ? 00:00:02 postgres: SELECT 3935 semtimedop S ? 00:00:13 postgres: UPDATE waiting 3936 - R ? 00:00:12 postgres: SELECT 3937 - S ? 00:00:01 postgres: SELECT 3938 sync_page D ? 00:00:07 postgres: SELECT 3940 - S ? 00:00:07 postgres: SELECT 3943 semtimedop S ? 00:00:04 postgres: UPDATE waiting 3944 - S ? 00:00:05 postgres: SELECT 3948 sync_page D ? 00:00:05 postgres: SELECT 3950 sync_page D ? 00:00:03 postgres: SELECT 3952 sync_page D ? 00:00:15 postgres: SELECT 3964 log_wait_commit D ? 00:00:04 postgres: COMMIT 3965 - S ? 00:00:03 postgres: SELECT 3966 - S ? 00:00:02 postgres: SELECT 3967 sync_page D ? 00:00:01 postgres: SELECT 3970 - S ? 00:00:00 postgres: SELECT 3971 - S ? 00:00:01 postgres: SELECT 3974 sync_page D ? 00:00:00 postgres: SELECT 3975 - S ? 00:00:00 postgres: UPDATE 3977 - S ? 00:00:00 postgres: INSERT 3978 semtimedop S ? 00:00:00 postgres: UPDATE waiting 3981 semtimedop S ? 00:00:01 postgres: SELECT 3982 - S ? 00:00:00 postgres: SELECT 3983 semtimedop S ? 00:00:02 postgres: UPDATE waiting 3984 - S ? 00:00:04 postgres: SELECT 3986 sync_buffer D ? 00:00:00 postgres: SELECT 3988 - R ? 00:00:01 postgres: SELECT 3989 - S ? 00:00:00 postgres: SELECT 3990 - R ? 00:00:00 postgres: SELECT 3992 - R ? 00:00:01 postgres: SELECT 3993 sync_page D ? 00:00:01 postgres: SELECT 3994 sync_page D ? 00:00:00 postgres: SELECT </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload