1
0
Fork 0

added postgresql server profile

A new tuned profile for PostgreSQL database server.

This profile is based of information collected from various
presentations about Linux tuning at PGConf.

See: https://www.socallinuxexpo.org/sites/default/files/presentations/scale_kosmodemiansky_linux_internals.pdf

Signed-off-by: Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>
This commit is contained in:
Tigran Mkrtchyan 2020-07-29 12:37:50 +02:00
parent 6e6f324885
commit f7ecad0ae0
15 changed files with 142 additions and 0 deletions

View file

@ -45,6 +45,8 @@ A profile optimized for Oracle databases loads based on `throughput-performance`
`desktop`::
A profile optimized for desktops, based on the `balanced` profile. It additionally enables scheduler autogroups for better response of interactive applications.
`postgresql`::
A profile optimized for PostgreSQL databases loads based on `throughput-performance` profile. It additionally disables transparent huge pages and modifies other performance-related kernel parameters. This profile is provided by the [package]`tuned-profiles-postgresql` package.
[discrete]
== Real-time profiles

View file

@ -117,6 +117,7 @@ Unload tunings.
.BR tuned\-profiles\-nfv\-host (7)
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -59,6 +59,7 @@ netfilter connections tracking.
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -44,6 +44,7 @@ throughput-performance profile.
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -50,6 +50,7 @@ Profile optimized for virtual guests based on realtime profile.
.BR tuned\-profiles\-nfv\-host (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -50,6 +50,7 @@ Profile optimized for virtual hosts based on realtime profile.
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -52,6 +52,7 @@ performance related kernel parameters.
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -0,0 +1,61 @@
.\"/*
.\" * All rights reserved
.\" * Copyright (C) 2020 Red Hat, Inc.
.\" * Copyright (C) 2020 Deutsches Elektronen-Synchrotron DESY
.\" * Authors: Jaroslav Škarvada
.\" * Tigran Mkrtchyan
.\" *
.\" * This program is free software; you can redistribute it and/or
.\" * modify it under the terms of the GNU General Public License
.\" * as published by the Free Software Foundation; either version 2
.\" * of the License, or (at your option) any later version.
.\" *
.\" * This program is distributed in the hope that it will be useful,
.\" * but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" * GNU General Public License for more details.
.\" *
.\" * You should have received a copy of the GNU General Public License
.\" * along with this program; if not, write to the Free Software
.\" * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.\" */
.\"
.TH TUNED_PROFILES_POSTGRESQL "7" "29 Jul 2020" "Fedora Power Management SIG" "tuned"
.SH NAME
tuned\-profiles\-postgresql - description of profiles provided for PostgreSQL Server
.SH DESCRIPTION
These profiles are provided for the PostgreSQL Database server.
.SH PROFILES
The following profiles are provided:
.TP
.BI "postgresql"
Profile optimized for PostgreSQL databases based on throughput\-performance profile.
It additionally disables transparent huge pages and modifies some other
performance related kernel parameters.
.SH "FILES"
.nf
.I /etc/tuned/*
.I /usr/lib/tuned/*
.SH "SEE ALSO"
.BR tuned (8)
.BR tuned\-adm (8)
.BR tuned\-profiles (7)
.BR tuned\-profiles\-sap (7)
.BR tuned\-profiles\-sap\-hana (7)
.BR tuned\-profiles\-oracle (7)
.BR tuned\-profiles\-mssql (7)
.BR tuned\-profiles\-atomic (7)
.BR tuned\-profiles\-realtime (7)
.BR tuned\-profiles\-nfv\-host (7)
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>
Tigran Mkrtchyan <tigran.mkrtchyan@desy.de>

View file

@ -50,6 +50,7 @@ Profile optimized for realtime.
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -55,6 +55,7 @@ semaphores.
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -53,6 +53,7 @@ areas a process may have.
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -53,6 +53,7 @@ performance related kernel parameters.
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Luis Bolinches <luis.bolinches@fi.ibm.com>

View file

@ -153,6 +153,7 @@ profiles (e.g. throughput\-performance profile), example:
.BR tuned\-profiles\-nfv\-guest (7)
.BR tuned\-profiles\-cpu\-partitioning (7)
.BR tuned\-profiles\-compat (7)
.BR tuned\-profiles\-postgresql (7)
.SH AUTHOR
.nf
Jaroslav Škarvada <jskarvad@redhat.com>

View file

@ -0,0 +1,55 @@
#
# tuned configuration for PostgreSQL servers
#
[main]
summary=Optimize for PostgreSQL server
include=throughput-performance
[cpu]
# The alternation of CPU bound load and disk IO operations of postgresql
# db server suggest CPU to go into powersave mode.
#
# Explicitly disable deep c-states to reduce latency on OLTP workloads.
force_latency=1
[vm]
transparent_hugepages=never
[sysctl]
# ktune sysctl settings for rhel6 servers, maximizing i/o throughput
#
# Minimal preemption granularity for CPU-bound tasks:
# (default: 1 msec# (1 + ilog(ncpus)), units: nanoseconds)
kernel.sched_min_granularity_ns=10000000
# The dirty_background_ratio and dirty_ratio controls percentage of memory
# that file system cache have to fill with dirty data before kernel will
# will start to flush data to disks. The default values are 10% and 20%
# accordingly. On a systems with a big amount of memory this values can
# be tens of gigabytes and produce IO spikes when PostgreSQL server writes
# checkpoints.
#
# Keep this values reasonable small - about size of RAID controller write-back
# cache size (typcal 512MB - 2GB).
vm.dirty_background_ratio = 0
vm.dirty_ratio = 0
vm.dirty_background_bytes = 67108864
vm.dirty_bytes = 536870912
# The swappiness parameter controls the tendency of the kernel to move
# processes out of physical memory and onto the swap disk.
# 0 tells the kernel to avoid swapping processes out of physical memory
# for as long as possible
# 100 tells the kernel to aggressively swap processes out of physical memory
# and move them to swap cache
vm.swappiness=3
# The total time the scheduler will consider a migrated process
# "cache hot" and thus less likely to be re-migrated
# (system default is 500000, i.e. 0.5 ms)
kernel.sched_migration_cost_ns=50000000
# The autogroup feature of the CFS
# (system default is 1, e.q enabled)
kernel.sched_autogroup_enabled = 0

View file

@ -237,6 +237,13 @@ Requires: %{name} = %{version}
Additional tuned profiles mainly for backward compatibility with tuned 1.0.
It can be also used to fine tune your system for specific scenarios.
%package profiles-postgresql
Summary: Additional tuned profile(s) targeted to PostgreSQL server loads
Requires: %{name} = %{version}
%description profiles-postgresql
Additional tuned profile(s) targeted to PostgreSQL server loads.
%prep
%setup -q -n %{name}-%{version}%{?prerel2}
@ -391,6 +398,7 @@ fi
%exclude %{_prefix}/lib/tuned/realtime-virtual-host
%exclude %{_prefix}/lib/tuned/cpu-partitioning
%exclude %{_prefix}/lib/tuned/spectrumscale-ece
%exclude %{_prefix}/lib/tuned/postgresql
%{_prefix}/lib/tuned
%dir %{_sysconfdir}/tuned
%dir %{_sysconfdir}/tuned/recommend.d
@ -518,6 +526,11 @@ fi
%{_prefix}/lib/tuned/spindown-disk
%{_mandir}/man7/tuned-profiles-compat.7*
%files profiles-postgresql
%defattr(-,root,root,-)
%{_prefix}/lib/tuned/postgresql
%{_mandir}/man7/tuned-profiles-postgresql.7*
%changelog
* Mon Jun 15 2020 Jaroslav Škarvada <jskarvad@redhat.com> - 2.14.0-1
- new release