OLTP
Tuned OLTP模板,针对常规业务数据库,优化延迟
Tuned OLTP模板主要针对延迟进行优化,此模板针对的机型是Dell R740 64核/400GB内存,使用PCI-E SSD的节点。您可以根据自己的实际机型进行调整。
# tuned configuration#==============================================================## File : tuned.conf# Mtime : 2020-06-29# Desc : Tune operatiing system to oltp mode# Path : /etc/tuned/oltp/tuned.conf# Author : Vonng(fengruohang@outlook.com)# Copyright (C) 2018-2021 Ruohang Feng#==============================================================#[main]summary=Optimize for PostgreSQL OLTP Systeminclude=network-latency[cpu]force_latency=1governor=performanceenergy_perf_bias=performancemin_perf_pct=100[vm]# disable transparent hugepagestransparent_hugepages=never[sysctl]#-------------------------------------------------------------## KERNEL ##-------------------------------------------------------------## disable numa balancingkernel.numa_balancing=0# total shmem size in bytes: $(expr $(getconf _PHYS_PAGES) / 2 \* $(getconf PAGE_SIZE)){% if param_shmall is defined and param_shmall != '' %}kernel.shmall = {{ param_shmall }}{% endif %}# total shmem size in pages: $(expr $(getconf _PHYS_PAGES) / 2){% if param_shmmax is defined and param_shmmax != '' %}kernel.shmmax = {{ param_shmmax }}{% endif %}# total shmem segs 4096 -> 8192kernel.shmmni=8192# total msg queue number, set to mem size in MBkernel.msgmni=32768# max length of message queuekernel.msgmnb=65536# max size of messagekernel.msgmax=65536kernel.pid_max=131072# max(Sem in Set)=2048, max(Sem)=max(Sem in Set) x max(SemSet) , max(Sem per Ops)=2048, max(SemSet)=65536kernel.sem=2048 134217728 2048 65536# do not sched postgres process in groupkernel.sched_autogroup_enabled = 0# total time the scheduler will consider a migrated process cache hot and, thus, less likely to be remigrated# defaut = 0.5ms (500000ns), update to 5ms , depending on your typical query (e.g < 1ms)kernel.sched_migration_cost_ns=5000000#-------------------------------------------------------------## VM ##-------------------------------------------------------------## try not using swapvm.swappiness=0# disable when most mem are for file cachevm.zone_reclaim_mode=0# overcommit threshhold = 80%vm.overcommit_memory=2vm.overcommit_ratio=80# vm.dirty_background_bytes=67108864 # 64MB mem (2xRAID cache) wake the bgwritervm.dirty_background_ratio=3 # latency-performance defaultvm.dirty_ratio=10 # latency-performance default# deny access on 0x00000 - 0x10000vm.mmap_min_addr=65536#-------------------------------------------------------------## Filesystem ##-------------------------------------------------------------## max open files: 382589 -> 167772160fs.file-max=167772160# max concurrent unfinished async io, should be larger than 1M. 65536->1Mfs.aio-max-nr=1048576#-------------------------------------------------------------## Network ##-------------------------------------------------------------## max connection in listen queue (triggers retrans if full)net.core.somaxconn=65535net.core.netdev_max_backlog=8192# tcp receive/transmit buffer default = 256KiBnet.core.rmem_default=262144net.core.wmem_default=262144# receive/transmit buffer limit = 4MiBnet.core.rmem_max=4194304net.core.wmem_max=4194304# ip optionsnet.ipv4.ip_forward=1net.ipv4.ip_nonlocal_bind=1net.ipv4.ip_local_port_range=32768 65000# tcp optionsnet.ipv4.tcp_timestamps=1net.ipv4.tcp_tw_reuse=1net.ipv4.tcp_tw_recycle=0net.ipv4.tcp_syncookies=0net.ipv4.tcp_synack_retries=1net.ipv4.tcp_syn_retries=1# tcp read/write buffernet.ipv4.tcp_rmem="4096 87380 16777216"net.ipv4.tcp_wmem="4096 16384 16777216"net.ipv4.udp_mem="3145728 4194304 16777216"# tcp probe fail interval: 75s -> 20snet.ipv4.tcp_keepalive_intvl=20# tcp break after 3 * 20s = 1mnet.ipv4.tcp_keepalive_probes=3# probe peroid = 1 minnet.ipv4.tcp_keepalive_time=60net.ipv4.tcp_fin_timeout=5net.ipv4.tcp_max_tw_buckets=262144net.ipv4.tcp_max_syn_backlog=8192net.ipv4.neigh.default.gc_thresh1=80000net.ipv4.neigh.default.gc_thresh2=90000net.ipv4.neigh.default.gc_thresh3=100000net.bridge.bridge-nf-call-iptables=1net.bridge.bridge-nf-call-ip6tables=1net.bridge.bridge-nf-call-arptables=1# max connection tracking numbernet.netfilter.nf_conntrack_max=1048576
Last modified 2022-06-03: add scaffold for en docs (6a6eded)