1

iam confused about setting Resources in postgres unit file. I setup the following files:

cat /etc/systemd/system/postgresql.service.d/50-BlockIOWeight.conf
[Service]
BlockIOWeight=10
cat /etc/systemd/system/postgresql.service.d/50-CPUShares.conf
[Service]
CPUShares=10

then i make:

systemctl daemon-reload
systemctl restart postgresql.service

now i thought i can get the actual values of the service via:

systemctl show postgres.service | grep CPUShares
CPUShares=18446744073709551615
StartupCPUShares=18446744073709551615

Also the following gets nothing:

cat /sys/fs/cgroup/blkio/system.slice/postgresql.service/blkio.weight
cat: /sys/fs/cgroup/blkio/system.slice/postgresql.service/blkio.weight: Datei oder Verzeichnis nicht gefunden

But if i delete my configurations and restart service and then set property instant, i can cat the configuration in /sys/fs/ .... see here:

rm -rf /etc/systemd/system/postgresql.service.d/50-*
systemctl daemon-reload
systemctl restart postgresql.service
cat /sys/fs/cgroup/cpu,cpuacct/system.slice/postgresql.service/cpu.shares
cat: /sys/fs/cgroup/cpu,cpuacct/system.slice/postgresql.service/cpu.shares: Datei oder Verzeichnis nicht gefunden

systemctl set-property postgresql.service CPUShares=10 BlockIOWeight=10
cat /sys/fs/cgroup/cpu,cpuacct/system.slice/postgresql.service/cpu.shares
10

but systemd show shows still no cpushares value:

systemctl show postgres.service | grep CPUShares
CPUShares=18446744073709551615
StartupCPUShares=18446744073709551615

also the files in /etc/systemd was created

ls -la /etc/systemd/system/postgresql.service.d/
insgesamt 16
drwxr-xr-x  2 root root 4096 Jul  4 08:28 .
drwxr-xr-x 19 root root 4096 Jul  3 11:47 ..
-rw-r--r--  1 root root   27 Jul  4 08:28 50-BlockIOWeight.conf
-rw-r--r--  1 root root   23 Jul  4 08:28 50-CPUShares.conf

so setting via set-property with running service works ? but after simple restart the service all is gone, although the configurations are still present in /etc/systemd/system/postgresql.service.d/

Whats wrong here ?

rupat
  • 186
  • 1
  • 1
  • 6
  • The problem still exists in debian stretch. `systemctl start` is unable to properly set the cgroup filesystem. – Aaron Apr 03 '18 at 10:47

0 Answers0