Server hangs all requests after a while Server hangs all requests after a while nginx nginx

Server hangs all requests after a while


It could be a symptom of RAM starvation due to the query cache getting too big. We saw this in one of our apps running on Heroku. The default query cache is set to 1000. Lowering the limit eased the RAM usage for us with no noticeable performance degradation:

database.yml:

default: &default  adapter: postgresql  pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %>  timeout: 5000  port: 5432  host: localhost  statement_limit: <%= ENV["DB_STATEMENT_LIMIT"] || 200 %>

However searching for "activerecord querycache slow" returns other causes, such as perhaps outdated versions of Ruby or Puma or rack-timeout: https://stackoverflow.com/a/44158724/126636

Or maybe a too large value for read_timeout: https://stackoverflow.com/a/30526430/126636