Replies: 3 comments 1 reply
-
|
Given this is CPU-bound Ruby serialization, the instinct is right: prefer more Puma workers and fewer threads. On an 8 vCPU box shared with other services, a reasonable starting point would be: WEB_CONCURRENCY=5
RAILS_MAX_THREADS=5
SIDEKIQ_CONCURRENCY=15or, if the box has enough CPU headroom: WEB_CONCURRENCY=6
RAILS_MAX_THREADS=5
SIDEKIQ_CONCURRENCY=15
|
Beta Was this translation helpful? Give feedback.
-
|
First paragraph: Recommendation for WEB_CONCURRENCY and RAILS_MAX_THREADS. Suggest 6 workers, 5 threads maybe, given 8 vCPU shared, leave headroom for other services. Also note GVL, so more workers fewer threads. Second: Explain that Views ~900ms is high but expected due to large payloads from meta endpoint (counts, unread, etc.) and conversation list serialization. Suggest checking payload size, enabling fragment caching, using fast_jsonapi or optimizing serializers, maybe limit fields, use pagination. Third: Impact of open conversations: inflates meta queries because they count open conversations, list loads all open; suggests auto-resolve or archiving, using filters, adding indexes, using counter caches, maybe using materialized views. Let's check: "First" is prohibited? The rule: "Sentences starting with 'Actually', 'Wait', 'But wait', 'Hmm', 'Let me', 'So', 'Now', 'First word'". So cannot start a sentence with "First". So avoid starting with "First". Also cannot start with "So". Also cannot start with "I". |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @VectorPeak and @UnknownHawkins — really helpful, both of you. I switched to more workers / fewer threads already, running this for ~2 days now: This resolved most of the slowness — the constant 15–28s stalls are gone and the dashboard is usable at peak now. 🎉 Two follow-up questions: 1. Occasional CPU spikes to ~500%. During the busiest moments, Rails CPU still pins around 500% (all 5 workers maxed on the 8-core box), and agents feel a brief lag in those windows. Would you bump to WEB_CONCURRENCY=6 for a bit more headroom, or does 6 risk starving Postgres/Sidekiq and the other services sharing the 8 cores? Where's the practical ceiling here? 2. Auto-resolve vs. our "All" status filter. On the open-conversations point — our agents work with the conversation list Status filter set to Thanks again — this has been the most useful tuning guidance I've found anywhere. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
What I'm trying to figure out
We run a fairly busy self-hosted instance and hit periods where the dashboard becomes very slow for agents (conversation list and loading take 15–28s, sometimes timing out at the 15s
Rack::Timeout). I've narrowed it down and would love guidance from anyone running at similar scale on how to tune Puma/Postgres/Sidekiq — and whether there's anything on the app side I can do to reduce request cost.Environment
docker-compose)max_connections=100Scale
Symptom (measured, not guessed)
ConversationsController#meta,ContactsController#filter,ConversationsController#show,MessagesController#create.Completed 200 OK in 1281ms (Views: 929ms | ActiveRecord: 330ms).pg_stat_activityshows few/short active queries (DB looks idle), while Rails CPU is pinned — so it reads like a Puma throughput limit rather than a DB bottleneck.What I've already done
/metadebounce inconversationStats.jsis active (we're on theallCount > 2000→ 10s/20s path), so per-client polling is already relaxed.WEB_CONCURRENCY2 → 4 (we were CPU/GVL-bound on 2 workers) — this helped a lot, but I want to size it properly.Current config
Questions
WEB_CONCURRENCY/RAILS_MAX_THREADSdo people actually run? Given the CPU-bound (GVL) serialization, I'm leaning toward more workers, fewer threads (e.g. 6×6) — is that the right instinct?Views: ~900msserialization cost on/metaandconversations#showexpected at this conversation volume, or a sign of something misconfigured?open(no auto-resolve) inflate list/meta queries and payloads in practice? Is auto-resolve the single biggest lever here?SIDEKIQ_CONCURRENCY, payload trimming, indexes) before scaling hardware?Happy to share more logs/metrics. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions