Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

postgresql: Raise locked-memory limit for io_uring rings.

Alex Vandiverea1323c4073b
diff --git a/puppet/zulip/files/postgresql/[email protected]/zulip.conf b/puppet/zulip/files/postgresql/[email protected]/zulip.conf
new file mode 100644
index 00000000000..502e7736721
--- /dev/null
+++ b/puppet/zulip/files/postgresql/[email protected]/zulip.conf
@@ -0,0 +1,8 @@
+# This file is managed by Zulip's Puppet configuration.
+#
+# Linux 6.14+ charges (per-user) the rings from io_uring against to
+# RLIMIT_MEMLOCK, which is by default limited to 8MiB; the default
+# Zulip PostgreSQL configuration needs ~13MiB. Set a limit sizably
+# above that.
+[Service]
+LimitMEMLOCK=256M
diff --git a/puppet/zulip/manifests/profile/postgresql.pp b/puppet/zulip/manifests/profile/postgresql.pp
index 926513c8af7..25e5e8c21c7 100644
--- a/puppet/zulip/manifests/profile/postgresql.pp
+++ b/puppet/zulip/manifests/profile/postgresql.pp
@@ -2,6 +2,7 @@
class zulip::profile::postgresql(Boolean $start = true) {
include zulip::profile::base
include zulip::postgresql_base
+ include zulip::systemd_daemon_reload
$version = $zulip::postgresql_common::version
@@ -68,6 +69,25 @@ class zulip::profile::postgresql(Boolean $start = true) {
fail("PostgreSQL ${version} not supported")
}
+ # PostgreSQL 18's io_method = io_uring requires a larger
+ # RLIMIT_MEMLOCK than systemd's default on Linux 6.14 and newer
+ if $facts['os']['family'] == 'Debian' {
+ file { '/etc/systemd/system/[email protected]':
+ ensure => directory,
+ owner => 'root',
+ group => 'root',
+ mode => '0755',
+ }
+ file { '/etc/systemd/system/[email protected]/zulip.conf':
+ ensure => file,
+ owner => 'root',
+ group => 'root',
+ mode => '0644',
+ source => 'puppet:///modules/zulip/postgresql/[email protected]/zulip.conf',
+ notify => [Exec['reload systemd'], Service['postgresql']],
+ }
+ }
+
if $replication_primary != undef and $replication_user != undef {
# The presence of a standby.signal file triggers replication
file { "${zulip::postgresql_base::postgresql_datadir}/standby.signal":
@@ -90,7 +110,7 @@ class zulip::profile::postgresql(Boolean $start = true) {
}
service { 'postgresql':
ensure => $start,
- require => $require,
+ require => $require + [Exec['reload systemd']],
subscribe => [ File[$postgresql_conf_file] ],
}
}