Merge pull request 'Scale akkounts Solid Queue workers and guard unit memory' (#713) from chore/akkounts_workers into master

Reviewed-on: #713
This commit was merged in pull request #713.
This commit is contained in:
raucao committed 2026-11-27 13:14:05 +00:00
commit 4c780808db
2 files changed
+21 -2

No files matched your search

+1 -1
Submodule nodes updated: 455cb4aab7...ff95561ad1.
@@ -249,12 +249,27 @@ systemd_unit "akkounts.service" do
Type: "simple",
User: deploy_user,
WorkingDirectory: deploy_path,
Environment: "RAILS_ENV=#{rails_env} SOLID_QUEUE_IN_PUMA=true",
# Solid Queue worker sizing (see config/queue.yml in the app):
# * JOB_CONCURRENCY scales the `default,nostr` group's processes; each
# extra process costs ~60-90 MB.
# * NOSTR_CONNECT_THREADS sizes the `nostr_connect` listener pool. Those
# jobs block a thread for up to 5 min on relay websockets, so they get
# many cheap threads instead of processes.
# * NOSTR_RPC_THREADS sizes the separate signing pool so sign events
# never queue behind the long-running listeners.
# * DB_POOL must be >= the largest thread count, or worker threads hit
# ActiveRecord::ConnectionTimeoutError under load.
Environment: "RAILS_ENV=#{rails_env} SOLID_QUEUE_IN_PUMA=true " \
"JOB_CONCURRENCY=6 NOSTR_CONNECT_THREADS=24 " \
"NOSTR_RPC_THREADS=4 DB_POOL=24",
ExecStart: "#{bundle_path} exec puma -C config/puma.rb --pidfile #{deploy_path}/tmp/puma.pid",
ExecReload: "#{bundle_path} exec pumactl -F config/puma.rb --pidfile #{deploy_path}/tmp/puma.pid phased-restart",
PIDFile: "#{deploy_path}/tmp/puma.pid",
TimeoutSec: "30",
Restart: "always",
# Guard against a runaway worker triggering the host-wide OOM killer.
MemoryHigh: "3G",
MemoryMax: "3500M",
},
Install: {
WantedBy: "multi-user.target"
@@ -263,6 +278,10 @@ systemd_unit "akkounts.service" do
verify false
triggers_reload true
action [:create, :enable]
# The unit body carries JOB_CONCURRENCY (and the memory guards), so a change
# here must restart the service to take effect. Nothing else notifies it
# unless the git checkout / .env also change.
notifies :restart, "service[#{app_name}]", :delayed
end
deploy_env = {