title: Connection Timeout Error
body: <p>I am getting following error on my application logs</p>
  
  <pre><code>ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)
  </code></pre>
  
  <p>My application is required to create too many background workers. I am using <code>sucker-punch gem</code> for background jobs. I have implemented Rollbar tool to monitor application crashes and it is reporting</p>
  
  <pre><code>10 occurrences in 5 minutes: #8 ActiveRecord::ConnectionTimeoutError: could not obtain a database connection within 5.000 seconds (waited 5.000 seconds)
  </code></pre>
  
  <p>I am not sure why is this happening but I can feel that some of my background jobs keeps on breaking time to time. At lot of places I am making DB connections using  <code>ActiveRecord::Base.connection.execute</code> command.</p>
  
  <p>My DB pool size is set to <code>100</code>, and MYSQL statistics are: </p>
  
  <pre><code>Aborted_connects    **51088**
  Connection_errors_accept    **0**
  Connection_errors_internal  **0**
  Connection_errors_max_connections   **0**
  Connection_errors_peer_address  **8**
  Connection_errors_select    **0**
  Connection_errors_tcpwrap   **0**
  Connections **1232264**
  Max_used_connections    **115**
  Performance_schema_session_connect_attrs_lost   **0**
  Ssl_client_connects **0**
  Ssl_connect_renegotiates    **0**
  Ssl_finished_connects   **0**
  Threads_connected   **12**
  </code></pre>
  
  <p>Is something very wrong with the application? Also just an information to help debug the issue It's AWS EC2 CPU usage always remains very high above 80% all the time. I am using <code>m3.medium</code> instance.</p>