Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Are you using Threads in your app dealing with the database? if so, you will have to wrap the Thread code like this
begin #your code here ensure #guarantee that the thread is releasing the DB connection after it is done ActiveRecord::Base.connection_pool.release_connection end
The ActiveRecord::ConnectionTimeoutError error usually means that the database can not can’t accept any new connection connections as it is maxed out. As you are using Unicorn, you need to consider the number of connections that each forked worker process will attempt to make. If you have four Unicorn workers processes, they all may be trying to make 10 connections each.
If you post your database.yml and Unicorn configuration, we might be able to help further.
@asb Thanks for the reply I did read it, but the post on https://bibwild.wordpress.com/2014/07/17/activerecord-concurrency-in-rails4-avoid-leaked-connections/ was really helpful.
For viewers who come here from Google search (coz DO posts are high in content value :P), I was using Thread.new in many locations where I was trying to archive data that was flowing out and therefore I opened a lot of connections and never used the rails directive with_connection when trying to make a db connection and therefore AR didn’t know how to check back the connection into the pool and I exhausted the pool with my n00bness.