Tuning postgresql.

This commit is contained in:
Samuel Clay 2015-07-21 15:15:29 -07:00
parent e41106dce3
commit b05ddbec87
3 changed files with 13 additions and 6 deletions

View file

@ -106,7 +106,7 @@ ssl = false # (change requires restart)
# - Memory -
shared_buffers = 512MB # min 128kB
shared_buffers = 16GB # min 128kB
# (change requires restart)
#temp_buffers = 8MB # min 800kB
#max_prepared_transactions = 0 # zero disables the feature
@ -171,7 +171,7 @@ wal_buffers = 16MB # min 32kB
# - Checkpoints -
checkpoint_segments = 10 # in logfile segments, min 1, 16MB each
checkpoint_segments = 40 # in logfile segments, min 1, 16MB each
#checkpoint_timeout = 5min # range 30s-1h
#checkpoint_completion_target = 0.5 # checkpoint target duration, 0.0 - 1.0
#checkpoint_warning = 30s # 0 disables
@ -195,7 +195,7 @@ wal_keep_segments = 320 # in logfile segments, 16MB each; 0 disables
# - Standby Servers -
#hot_standby = off # "on" allows queries during recovery
hot_standby = on # "on" allows queries during recovery
# (change requires restart)
#max_standby_archive_delay = 30s # max delay before canceling queries
# when reading WAL from archive;
@ -229,7 +229,7 @@ wal_keep_segments = 320 # in logfile segments, 16MB each; 0 disables
#cpu_tuple_cost = 0.01 # same scale as above
#cpu_index_tuple_cost = 0.005 # same scale as above
#cpu_operator_cost = 0.0025 # same scale as above
effective_cache_size = 6GB
effective_cache_size = 32GB
# - Genetic Query Optimizer -
@ -338,7 +338,7 @@ effective_cache_size = 6GB
# fatal
# panic (effectively off)
#log_min_duration_statement = -1 # -1 is disabled, 0 logs all statements
log_min_duration_statement = 5000 # -1 is disabled, 0 logs all statements
# and their durations, > 0 logs only
# statements running at least this number
# of milliseconds

7
fabfile.py vendored
View file

@ -870,6 +870,13 @@ def setup_postgres(standby=False):
sudo('/etc/init.d/postgresql stop')
sudo('/etc/init.d/postgresql start')
def config_postgres(standby=False):
put('config/postgresql%s.conf' % (
('_standby' if standby else ''),
), '/etc/postgresql/9.4/main/postgresql.conf', use_sudo=True)
sudo('/etc/init.d/postgresql reload 9.4')
def copy_postgres_to_standby(master='db01'):
# http://www.rassoc.com/gregr/weblog/2013/02/16/zero-to-postgresql-streaming-replication-in-10-mins/

View file

@ -85,7 +85,7 @@
<img src="/media/img/logo_512.png" class="logo">
<h1>NewsBlur is in <span class="error404">maintenance mode</span></h1>
<div class="description">
<p>Digital Ocean, NewsBlur's hosting provider, is undergoing maintenance and should be back within the next half hour. I'll keep you updated until then, but for now NewsBlur is taking a rest.</p>
<p>Tuning PostgreSQL requires a restart of the database. This should take no more than 2 minutes.</p>
<p>To pass the time, <a href="http://mlkshk.com/popular">check out what's popular on MLKSHK</a>.</p>
</div>
</div>