Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion toolset/databases/postgres/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,11 @@

set -e

cat /tmp/postgresql.conf >> "${PGDATA}/postgresql.conf"
cat /docker-entrypoint-initdb.d/postgresql.conf >> "${PGDATA}/postgresql.conf"

IO_WORKERS="$(( (`nproc` + 3) / 4 ))"

# The maximum valid value for the io_workers configuration parameter is 32.
if [[ "$IO_WORKERS" -lt 32 ]]; then
sed -i "s/io_workers = 32/io_workers = ${IO_WORKERS}/" "${PGDATA}/postgresql.conf"
fi
6 changes: 2 additions & 4 deletions toolset/databases/postgres/postgres.dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FROM postgres:18-trixie

ENV PGDATA=/ssd/postgresql \
POSTGRES_DB=hello_world \
ENV POSTGRES_DB=hello_world \
POSTGRES_PASSWORD=benchmarkdbpass \
POSTGRES_USER=benchmarkdbuser

COPY 60-postgresql-shm.conf /etc/sysctl.d/
COPY config.sh create-postgres.sql /docker-entrypoint-initdb.d/
COPY postgresql.conf /tmp/
COPY config.sh create-postgres.sql postgresql.conf /docker-entrypoint-initdb.d/
5 changes: 5 additions & 0 deletions toolset/databases/postgres/postgresql.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ listen_addresses = '*'
max_connections = 2000
ssl = false

# Tuning AIO in PostgreSQL 18:
# https://vondra.me/posts/tuning-aio-in-postgresql-18
# The config.sh script sets the actual value based on that article and the runtime environment.
io_workers = 32

# 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
Expand Down
Loading