mirror of
https://github.com/zulip/zulip.git
synced 2026-07-21 21:05:48 +08:00
postgresql: Default to io_method=io_uring on PostgreSQL 18.
This is more performant than the PostgreSQL 18 default of `io_method=workers`, but requires kernel 5.1. All supported OSes of Zulip have at least that -- however, it may not be available inside containers, so add a puppet fact to check the syscall before enabling it in PostgreSQL.
This commit is contained in:
parent
48a89464a2
commit
f0cc982e52
16
puppet/zulip/lib/facter/io_uring_available.rb
Normal file
16
puppet/zulip/lib/facter/io_uring_available.rb
Normal file
@ -0,0 +1,16 @@
|
||||
Facter.add(:io_uring_available) do
|
||||
confine :kernel => 'Linux'
|
||||
setcode do
|
||||
# Syscall 425 is io_uring_setup
|
||||
# https://www.chromium.org/chromium-os/developer-library/reference/linux-constants/syscalls/#x86_64_425
|
||||
# https://manpages.debian.org/trixie/liburing-dev/io_uring_setup.2.en.html
|
||||
#
|
||||
# We get ENOSYS if the kernel doesn't have the syscall, or EPERM
|
||||
# if it's disabled or restricted via seccomp (i.e. in Docker)
|
||||
result = Facter::Core::Execution.execute(
|
||||
"perl -MErrno=EPERM,ENOSYS -e 'syscall(425); exit((\$! != EPERM and \$! != ENOSYS) ? 0 : 1)'",
|
||||
:on_fail => :failed
|
||||
)
|
||||
result != :failed && $?.success?
|
||||
end
|
||||
end
|
||||
@ -42,6 +42,9 @@ max_wal_size = <%= @max_wal_size %>
|
||||
<% unless @random_page_cost.nil? -%>
|
||||
random_page_cost = <%= @random_page_cost %>
|
||||
<% end -%>
|
||||
<% if @version.to_i >= 18 && @io_uring_available -%>
|
||||
io_method = io_uring
|
||||
<% end -%>
|
||||
<% unless @effective_io_concurrency.nil? -%>
|
||||
effective_io_concurrency = <%= @effective_io_concurrency %>
|
||||
<% end -%>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user