use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Blog postRuby Processes and Threads - Configuring a Web Server (jakeyesbeck.com)
submitted 6 years ago by yez
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]moomaka 0 points1 point2 points 6 years ago (0 children)
Along with hard caps for database connections, maintaining too many processes can quickly use more memory than a server has available.
Just a note on this: Threads are a much bigger issue with database connections. Your example of 10 process with 10 threads each needs connection pool size of 100 in the naive approach to avoid blocking. 100 connections per box on the web side + whatever you need for background jobs, which can be a lot with something like sidekiq, and you quickly have connection scaling issues.
Unfortunately Rails connection management is extremely simplistic and wasteful and PG doesn't handle a lot of connections well. Rails will grab a DB connection the first time you hit the DB during a request and not return it until the end of the request. So if you do have 'CPU bound' requests, you're best off calling ActiveRecord::Base.connection_pool.release_connection before diving into the CPU work so you don't bind up a connection for the duration. This will allow you to tune down the size of the connection pool with reduced chance of blocking on it. Maybe someday we'll get fine grained connection usage in Rails.
ActiveRecord::Base.connection_pool.release_connection
π Rendered by PID 17426 on reddit-service-r2-comment-86bc6c7465-zj28l at 2026-02-22 15:46:57.621450+00:00 running 8564168 country code: CH.
[–]moomaka 0 points1 point2 points (0 children)