mirror of
https://git.pvv.ntnu.no/Drift/pvv-nixos-config.git
synced 2026-07-21 20:41:25 +02:00
bicep/postgresql: enable hugepages
This commit is contained in:
@@ -197,6 +197,7 @@
|
||||
inputs.pvv-calendar-bot.nixosModules.default
|
||||
inputs.minecraft-heatmap.nixosModules.default
|
||||
self.nixosModules.gickup
|
||||
self.nixosModules.hugepages
|
||||
self.nixosModules.matrix-ooye
|
||||
];
|
||||
overlays = [
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
{ config, lib, pkgs, values, ... }:
|
||||
let
|
||||
cfg = config.services.postgresql;
|
||||
|
||||
sharedBuffersMB = 8192;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
@@ -29,7 +31,7 @@ in
|
||||
superuser_reserved_connections = 3;
|
||||
|
||||
# Memory Settings
|
||||
shared_buffers = "8192 MB";
|
||||
shared_buffers = "${toString sharedBuffersMB} MB";
|
||||
work_mem = "32 MB";
|
||||
maintenance_work_mem = "420 MB";
|
||||
effective_cache_size = "22 GB";
|
||||
@@ -93,6 +95,10 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
boot.kernel.hugepages.reservations.postgresql = lib.mkIf cfg.enable (
|
||||
builtins.ceil (sharedBuffersMB / config.boot.hugepages.size)
|
||||
);
|
||||
|
||||
systemd.tmpfiles.settings."10-postgresql"."/data/postgresql".d = lib.mkIf cfg.enable {
|
||||
user = config.systemd.services.postgresql.serviceConfig.User;
|
||||
group = config.systemd.services.postgresql.serviceConfig.Group;
|
||||
|
||||
Reference in New Issue
Block a user