Skip to content

Commit 5c4a1ba

Browse files
committed
fix node tuned shm param
1 parent 0111c73 commit 5c4a1ba

File tree

4 files changed

+98
-75
lines changed

4 files changed

+98
-75
lines changed

roles/node/templates/tuned-crit.conf

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,23 @@ governor=performance
2020
energy_perf_bias=performance
2121
min_perf_pct=100
2222

23-
[vm]
24-
# disable transparent hugepages
25-
transparent_hugepages=never
26-
2723
[sysctl]
2824
#-------------------------------------------------------------#
2925
# KERNEL #
3026
#-------------------------------------------------------------#
3127
# disable numa balancing
3228
kernel.numa_balancing=0
3329

34-
# total shmem size in bytes: $(expr $(getconf _PHYS_PAGES) / * 0.75 \* $(getconf PAGE_SIZE))
35-
# total mem: {{ node_mem_bytes }}
36-
kernel.shmall = {{ (node_mem_bytes|int * 0.75)|int }}
30+
# do not schedule postgres process in group
31+
kernel.sched_autogroup_enabled = 0
32+
33+
# shmall in pages
34+
kernel.shmall = {{ (node_pages|int * 0.75)|int }}
3735

38-
# total shmax size in pages: $(expr $(getconf _PHYS_PAGES) * 0.75 )
39-
kernel.shmax = {{ (node_pages|int * 0.75)|int }}
36+
# shmmax size in bytes
37+
kernel.shmmax = {{ (node_mem_bytes|int * 0.75)|int }}
4038

41-
# total shmem segs 4096 -> 8192
39+
# total shmem segs
4240
kernel.shmmni=8192
4341

4442
# total msg queue number, set to mem size in MB
@@ -55,27 +53,42 @@ kernel.pid_max=131072
5553
# max(Sem in Set)=2048, max(Sem)=max(Sem in Set) x max(SemSet) , max(Sem per Ops)=2048, max(SemSet)=65536
5654
kernel.sem=2048 134217728 2048 65536
5755

58-
# do not sched postgres process in group
59-
kernel.sched_autogroup_enabled = 0
60-
6156
# total time the scheduler will consider a migrated process cache hot and, thus, less likely to be remigrated
6257
# defaut = 0.5ms (500000ns), update to 5ms , depending on your typical query (e.g < 1ms)
6358
kernel.sched_migration_cost_ns=5000000
6459

65-
6660
#-------------------------------------------------------------#
6761
# VM #
6862
#-------------------------------------------------------------#
63+
# disable transparent hugepages
64+
vm.transparent_hugepages=never
65+
6966
# try not using swap
7067
vm.swappiness=1
7168

7269
# disable when most mem are for file cache
7370
vm.zone_reclaim_mode=0
7471

75-
# 64MB mem (2xRAID cache) wake the bgwriter
76-
vm.dirty_background_bytes=67108864
77-
# vm.dirty_background_ratio=3 # latency-performance default
78-
vm.dirty_ratio=10 # latency-performance default
72+
{% if node_overcommit_ratio|int > 0 %}
73+
# overcommit threshhold = {{ node_overcommit_ratio }}%
74+
vm.overcommit_memory=2
75+
vm.overcommit_ratio={{ node_overcommit_ratio }}
76+
{% else %}
77+
vm.overcommit_memory=0
78+
vm.overcommit_ratio=100
79+
{% endif %}
80+
81+
# Starts background writeback of dirty data at this percentage of total memory, via a pdflush daemon. The default value is 10. reduce to 1
82+
vm.dirty_background_ratio=1
83+
84+
# Starts active writeback of dirty data at this percentage of total memory for the generator of dirty data, via pdflush. The default value is 40. reduce to 5
85+
vm.dirty_ratio=5
86+
87+
# Defines when dirty in-memory data is old enough to be eligible for writeout. default 30s, reduce to 1s
88+
vm.dirty_expire_centisecs = 100
89+
90+
# Defines the interval between pdflush daemon wakeups, which periodically writes dirty in-memory data out to disk. The default value is 500, reduce to 1s
91+
vm.dirty_expire_centisecs = 100
7992

8093
# deny access on 0x00000 - 0x10000
8194
vm.mmap_min_addr=65536
@@ -93,7 +106,7 @@ fs.aio-max-nr=1048576
93106
#-------------------------------------------------------------#
94107
# Network #
95108
#-------------------------------------------------------------#
96-
# max connection in listen queue (triggers retrans if full)
109+
# max connection in listen queue (triggers re-trans if full)
97110
net.core.somaxconn=65535
98111
net.core.netdev_max_backlog=8192
99112
# tcp receive/transmit buffer default = 256KiB

roles/node/templates/tuned-olap.conf

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,23 @@ governor=performance
2020
energy_perf_bias=performance
2121
min_perf_pct=100
2222

23-
[vm]
24-
# disable transparent hugepages
25-
transparent_hugepages=never
26-
2723
[sysctl]
2824
#-------------------------------------------------------------#
2925
# KERNEL #
3026
#-------------------------------------------------------------#
3127
# disable numa balancing
3228
kernel.numa_balancing=0
3329

34-
# total shmem size in bytes: $(expr $(getconf _PHYS_PAGES) / * 0.75 \* $(getconf PAGE_SIZE))
35-
# total mem: {{ node_mem_bytes }}
36-
kernel.shmall = {{ (node_mem_bytes|int * 0.75)|int }}
30+
# do not schedule postgres process in group
31+
kernel.sched_autogroup_enabled = 0
32+
33+
# shmall in pages
34+
kernel.shmall = {{ (node_pages|int * 0.75)|int }}
3735

38-
# total shmax size in pages: $(expr $(getconf _PHYS_PAGES) * 0.75 )
39-
kernel.shmax = {{ (node_pages|int * 0.75)|int }}
36+
# shmmax size in bytes
37+
kernel.shmmax = {{ (node_mem_bytes|int * 0.75)|int }}
4038

41-
# total shmem segs 4096 -> 8192
39+
# total shmem segs
4240
kernel.shmmni=8192
4341

4442
# total msg queue number, set to mem size in MB
@@ -55,16 +53,16 @@ kernel.pid_max=131072
5553
# max(Sem in Set)=2048, max(Sem)=max(Sem in Set) x max(SemSet) , max(Sem per Ops)=2048, max(SemSet)=65536
5654
kernel.sem=2048 134217728 2048 65536
5755

58-
# do not sched postgres process in group
59-
kernel.sched_autogroup_enabled = 0
60-
6156
# total time the scheduler will consider a migrated process cache hot and, thus, less likely to be remigrated
6257
# defaut = 0.5ms (500000ns), update to 5ms , depending on your typical query (e.g < 1ms)
6358
kernel.sched_migration_cost_ns=5000000
6459

6560
#-------------------------------------------------------------#
6661
# VM #
6762
#-------------------------------------------------------------#
63+
# disable transparent hugepages
64+
vm.transparent_hugepages=never
65+
6866
# try not using swap
6967
vm.swappiness=1
7068

@@ -80,9 +78,17 @@ vm.overcommit_ratio={{ node_overcommit_ratio }}
8078
#vm.overcommit_ratio=100
8179
{% endif %}
8280

83-
# allow 90% dirty ratio on OLAP instance
84-
vm.dirty_background_ratio = 20 # throughput-performance default
85-
vm.dirty_ratio=90 # throughput-performance default 40 -> 90
81+
# Starts background writeback of dirty data at this percentage of total memory, via a pdflush daemon. The default value is 10.
82+
vm.dirty_background_ratio=10
83+
84+
# Starts active writeback of dirty data at this percentage of total memory for the generator of dirty data, via pdflush. The default value is 40. increase to 80
85+
vm.dirty_ratio=80
86+
87+
# Defines when dirty in-memory data is old enough to be eligible for writeout. default 30s
88+
#vm.dirty_expire_centisecs = 3000
89+
90+
# Defines the interval between pdflush daemon wakeups, which periodically writes dirty in-memory data out to disk. The default value is 500
91+
#vm.dirty_expire_centisecs = 100
8692

8793
# deny access on 0x00000 - 0x10000
8894
vm.mmap_min_addr=65536
@@ -101,7 +107,7 @@ fs.aio-max-nr=1048576
101107
#-------------------------------------------------------------#
102108
# Network #
103109
#-------------------------------------------------------------#
104-
# max connection in listen queue (triggers retrans if full)
110+
# max connection in listen queue (triggers re-trans if full)
105111
net.core.somaxconn=65535
106112
net.core.netdev_max_backlog=8192
107113
# tcp receive/transmit buffer default = 256KiB

roles/node/templates/tuned-oltp.conf

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,23 @@ governor=performance
2020
energy_perf_bias=performance
2121
min_perf_pct=100
2222

23-
[vm]
24-
# disable transparent hugepages
25-
transparent_hugepages=never
26-
2723
[sysctl]
2824
#-------------------------------------------------------------#
2925
# KERNEL #
3026
#-------------------------------------------------------------#
3127
# disable numa balancing
3228
kernel.numa_balancing=0
3329

34-
# total shmem size in bytes: $(expr $(getconf _PHYS_PAGES) / * 0.75 \* $(getconf PAGE_SIZE))
35-
# total mem: {{ node_mem_bytes }}
36-
kernel.shmall = {{ (node_mem_bytes|int * 0.75)|int }}
30+
# do not schedule postgres process in group
31+
kernel.sched_autogroup_enabled = 0
32+
33+
# shmall in pages
34+
kernel.shmall = {{ (node_pages|int * 0.75)|int }}
3735

38-
# total shmax size in pages: $(expr $(getconf _PHYS_PAGES) * 0.75 )
39-
kernel.shmax = {{ (node_pages|int * 0.75)|int }}
36+
# shmmax size in bytes
37+
kernel.shmmax = {{ (node_mem_bytes|int * 0.75)|int }}
4038

41-
# total shmem segs 4096 -> 8192
39+
# total shmem segs
4240
kernel.shmmni=8192
4341

4442
# total msg queue number, set to mem size in MB
@@ -55,16 +53,16 @@ kernel.pid_max=131072
5553
# max(Sem in Set)=2048, max(Sem)=max(Sem in Set) x max(SemSet) , max(Sem per Ops)=2048, max(SemSet)=65536
5654
kernel.sem=2048 134217728 2048 65536
5755

58-
# do not sched postgres process in group
59-
kernel.sched_autogroup_enabled = 0
60-
6156
# total time the scheduler will consider a migrated process cache hot and, thus, less likely to be remigrated
6257
# defaut = 0.5ms (500000ns), update to 5ms , depending on your typical query (e.g < 1ms)
6358
kernel.sched_migration_cost_ns=5000000
6459

6560
#-------------------------------------------------------------#
6661
# VM #
6762
#-------------------------------------------------------------#
63+
# disable transparent hugepages
64+
vm.transparent_hugepages=never
65+
6866
# try not using swap
6967
vm.swappiness=1
7068

@@ -80,9 +78,17 @@ vm.overcommit_memory=0
8078
vm.overcommit_ratio=100
8179
{% endif %}
8280

83-
# vm.dirty_background_bytes=67108864 # 64MB mem (2xRAID cache) wake the bgwriter
84-
vm.dirty_background_ratio=3 # latency-performance default
85-
vm.dirty_ratio=30 # latency-performance default
81+
# Starts background writeback of dirty data at this percentage of total memory, via a pdflush daemon. The default value is 10.
82+
vm.dirty_background_ratio=3
83+
84+
# Starts active writeback of dirty data at this percentage of total memory for the generator of dirty data, via pdflush. The default value is 40.
85+
vm.dirty_ratio=15
86+
87+
# Defines when dirty in-memory data is old enough to be eligible for writeout. default 30s, reduce to 5s
88+
vm.dirty_expire_centisecs = 500
89+
90+
# Defines the interval between pdflush daemon wakeups, which periodically writes dirty in-memory data out to disk. The default value is 500, reduce to 1s
91+
vm.dirty_expire_centisecs = 100
8692

8793
# deny access on 0x00000 - 0x10000
8894
vm.mmap_min_addr=65536
@@ -101,7 +107,7 @@ fs.aio-max-nr=1048576
101107
#-------------------------------------------------------------#
102108
# Network #
103109
#-------------------------------------------------------------#
104-
# max connection in listen queue (triggers retrans if full)
110+
# max connection in listen queue (triggers re-trans if full)
105111
net.core.somaxconn=65535
106112
net.core.netdev_max_backlog=8192
107113
# tcp receive/transmit buffer default = 256KiB

roles/node/templates/tuned-tiny.conf

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,45 +11,39 @@
1111
#==============================================================#
1212

1313
[main]
14-
summary=Optimize for PostgreSQL TINY System
14+
summary=Optimize for TINY System
1515
# include=virtual-guest
1616

17-
[vm]
18-
# disable transparent hugepages
19-
transparent_hugepages=never
20-
2117
[sysctl]
2218
#-------------------------------------------------------------#
2319
# KERNEL #
2420
#-------------------------------------------------------------#
2521
# disable numa balancing
2622
kernel.numa_balancing=0
2723

28-
# total shmem size in bytes: $(expr $(getconf _PHYS_PAGES) / * 0.75 \* $(getconf PAGE_SIZE))
29-
# total mem: {{ node_mem_bytes }}
30-
kernel.shmall = {{ (node_mem_bytes|int * 0.75)|int }}
24+
# do not schedule postgres process in group
25+
kernel.sched_autogroup_enabled = 0
3126

32-
# total shmax size in pages: $(expr $(getconf _PHYS_PAGES) * 0.75 )
33-
kernel.shmax = {{ (node_pages|int * 0.75)|int }}
27+
# shmall in pages
28+
kernel.shmall = {{ (node_pages|int * 0.75)|int }}
3429

35-
# If a workload mostly uses anonymous memory and it hits this limit, the entire
36-
# working set is buffered for I/O, and any more write buffering would require
37-
# swapping, so it's time to throttle writes until I/O can catch up. Workloads
38-
# that mostly use file mappings may be able to use even higher values.
39-
#
40-
# The generator of dirty data starts writeback at this percentage (system default
41-
# is 20%)
42-
vm.dirty_ratio = 50
30+
# shmmax size in bytes
31+
kernel.shmmax = {{ (node_mem_bytes|int * 0.75)|int }}
32+
33+
# total shmem segs
34+
kernel.shmmni=8192
4335

44-
# Filesystem I/O is usually much more efficient than swapping, so try to keep
45-
# swapping low. It's usually safe to go even lower than this on systems with
46-
# server-grade storage.
47-
vm.swappiness = 10
4836

4937

5038
#-------------------------------------------------------------#
5139
# VM #
5240
#-------------------------------------------------------------#
41+
# disable transparent hugepages
42+
vm.transparent_hugepages=never
43+
44+
# try not using swap
45+
vm.swappiness=10
46+
5347
{% if node_overcommit_ratio|int > 0 %}
5448
# overcommit threshhold = {{ node_overcommit_ratio }}%
5549
vm.overcommit_memory=2
@@ -59,6 +53,10 @@ vm.overcommit_ratio={{ node_overcommit_ratio }}
5953
#vm.overcommit_ratio=100
6054
{% endif %}
6155

56+
57+
# deny access on 0x00000 - 0x10000
58+
vm.mmap_min_addr=65536
59+
6260
#-------------------------------------------------------------#
6361
# Network #
6462
#-------------------------------------------------------------#

0 commit comments

Comments
 (0)