diff --git a/distribution/src/dist/usr/lib/systemd/system/openfire.service b/distribution/src/dist/usr/lib/systemd/system/openfire.service index 88b2596030..8a7fb98be5 100644 --- a/distribution/src/dist/usr/lib/systemd/system/openfire.service +++ b/distribution/src/dist/usr/lib/systemd/system/openfire.service @@ -12,6 +12,15 @@ ExecStart=/bin/bash -c '/usr/share/openfire/bin/openfire.sh ${DAEMON_OPTS}' Restart=on-failure RuntimeDirectory=openfire +# Specify resource limits in the slice +Slice=openfire.slice +# We expect a lot of connections from many clients so increase limit of file descriptiors +LimitNOFILE=50000 +# The Openfire is less important for CPU than system vital services +Nice=5 +# If not enough RAM then kill the Openfire first to preserve system vital services +OOMScoreAdjust=-100 + [Install] WantedBy=multi-user.target Alias=xmpp.service diff --git a/distribution/src/dist/usr/lib/systemd/system/openfire.slice b/distribution/src/dist/usr/lib/systemd/system/openfire.slice new file mode 100644 index 0000000000..eef22a5749 --- /dev/null +++ b/distribution/src/dist/usr/lib/systemd/system/openfire.slice @@ -0,0 +1,5 @@ +[Slice] +#MemoryAccounting=yes +#MemoryMax=95% +#CPUQuota=95% +#CPUAccounting=yes