Browse Source

Add explanations about kernel and pgsql parameters + add some other parameters I've found

Ludovic Gasc (GMLudo) 10 years ago
parent
commit
9c118faa57
2 changed files with 21 additions and 3 deletions
  1. 13 3
      config/postgresql.conf
  2. 8 0
      toolset/benchmark/benchmarker.py

+ 13 - 3
config/postgresql.conf

@@ -105,10 +105,20 @@ ssl = false                             # (change requires restart)
 #------------------------------------------------------------------------------
 #------------------------------------------------------------------------------
 
 
 # - Memory -
 # - Memory -
+# values from: http://blog.pgaddict.com/posts/performance-since-postgresql-7-4-to-9-4-pgbench
+# details: http://www.postgresql.org/docs/9.4/static/runtime-config-resource.html
+# http://www.postgresql.org/docs/9.4/static/runtime-config-wal.html
+# http://www.postgresql.org/docs/9.4/static/runtime-config-query.html
+shared_buffers = 2GB                    # min 128kB
+work_mem = 64MB                                # min 64kB
+maintenance_work_mem = 512MB            # min 1MB
+checkpoint_segments = 64
+checkpoint_completion_target = 0.9
+effective_cache_size = 8GB
+
+# when executed on the SSD (otherwise 4)
+random_page_cost = 2
 
 
-shared_buffers = 128MB
-work_mem = 32MB
-maintenance_work_mem = 64MB
 #shared_buffers = 32MB			# min 128kB
 #shared_buffers = 32MB			# min 128kB
 					# (change requires restart)
 					# (change requires restart)
 #temp_buffers = 8MB			# min 800kB
 #temp_buffers = 8MB			# min 800kB

+ 8 - 0
toolset/benchmark/benchmarker.py

@@ -376,13 +376,21 @@ class Benchmarker:
     p.communicate("""
     p.communicate("""
       sudo sysctl -w net.ipv4.tcp_max_syn_backlog=65535
       sudo sysctl -w net.ipv4.tcp_max_syn_backlog=65535
       sudo sysctl -w net.core.somaxconn=65535
       sudo sysctl -w net.core.somaxconn=65535
+      sudo sysctl -w kernel.sched_autogroup_enabled=0
       sudo -s ulimit -n 65535
       sudo -s ulimit -n 65535
       sudo sysctl net.ipv4.tcp_tw_reuse=1
       sudo sysctl net.ipv4.tcp_tw_reuse=1
       sudo sysctl net.ipv4.tcp_tw_recycle=1
       sudo sysctl net.ipv4.tcp_tw_recycle=1
       sudo sysctl -w kernel.shmmax=2147483648
       sudo sysctl -w kernel.shmmax=2147483648
       sudo sysctl -w kernel.shmall=2097152
       sudo sysctl -w kernel.shmall=2097152
       sudo sysctl -w kernel.sem="250 32000 256 256"
       sudo sysctl -w kernel.sem="250 32000 256 256"
+      echo "Printing kernel configuration:" && sudo sysctl -a
     """)
     """)
+        # Explanations:
+        # net.ipv4.tcp_max_syn_backlog, net.core.somaxconn, kernel.sched_autogroup_enabled: http://tweaked.io/guide/kernel/
+        # ulimit -n: http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/
+        # net.ipv4.tcp_tw_*: http://www.linuxbrigade.com/reduce-time_wait-socket-connections/
+        # kernel.shm*: http://seriousbirder.com/blogs/linux-understanding-shmmax-and-shmall-settings/
+        # For kernel.sem: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Tuning_and_Optimizing_Red_Hat_Enterprise_Linux_for_Oracle_9i_and_10g_Databases/chap-Oracle_9i_and_10g_Tuning_Guide-Setting_Semaphores.html
   ############################################################
   ############################################################
   # End __setup_database
   # End __setup_database
   ############################################################
   ############################################################