From b37e0cdda51cf23357302fc44815d70905fdb7f4 Mon Sep 17 00:00:00 2001 From: Kabbone Date: Mon, 12 Feb 2024 12:34:15 +0100 Subject: [PATCH] server: tweak postgresql to more caching --- disko/nas_luks.nix | 47 ++++++++++++++++++++++++++ modules/services/server/postgresql.nix | 5 +-- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 disko/nas_luks.nix diff --git a/disko/nas_luks.nix b/disko/nas_luks.nix new file mode 100644 index 0000000..82bc5be --- /dev/null +++ b/disko/nas_luks.nix @@ -0,0 +1,47 @@ +{ + disko.devices = { + disk = { + sda = { + type = "disk"; + device = "/dev/sda"; + content = { + type = "gpt"; + partitions = { + luks = { + size = "100%"; + content = { + type = "luks"; + name = "NAS-RAID"; + askPassword = true; + # disable settings.keyFile if you want to use interactive password entry + #passwordFile = "/tmp/secret.key"; # Interactive + settings = { + allowDiscards = true; + }; + content = { + type = "btrfs"; + extraArgs = [ "-f -L NAS-RAID" ]; + subvolumes = { + "@" = { + mountpoint = "/mnt/Pluto"; + mountOptions = [ "compress=zstd" "noatime" "ssd" "discard=async" ]; + }; + "@/Backups"; + "@/Media"; + "@/Games"; + "@/IT"; + "@/Rest"; + "@snapshots" = { + mountpoint = "/mnt"; + mountOptions = [ "compress=zstd" "noatime" "ssd" "discard=async" ]; + }; + }; + }; + }; + }; + }; + }; + }; + }; + }; +} diff --git a/modules/services/server/postgresql.nix b/modules/services/server/postgresql.nix index b6fa60f..3574106 100644 --- a/modules/services/server/postgresql.nix +++ b/modules/services/server/postgresql.nix @@ -12,8 +12,9 @@ max_connections = 200; listen_addresses = "localhost"; password_encryption = "scram-sha-256"; - shared_buffers = "512MB"; - work_mem = "8MB"; + shared_buffers = "2GB"; + work_mem = "1GB"; + maintence_work_mem = "500MB" autovacuum_work_mem = -1; min_wal_size = "1GB"; max_wal_size = "4GB";