title: Rails, Puma, Sidekiq how to calculate total DB connections?
body: <p>I am getting <code>ActiveRecord::ConnectionTimeoutError</code> once or twice in a day. could someone help me in calculating how many connections my application is making to my DB? and suggestion to optimise my connections?</p>
  
  <p>Here is my configuration</p>
  
  <p>AWS</p>
  
  <pre><code>Database : Mysql   
  Version  : 5.7.23   
  Provider : AWS RDS (db.m5.large, vCPU: 2, RAM: 8GB)
  </code></pre>
  
  <p>3 servers with bellow configurations </p>
  
  <pre><code># database.yml
    pool: 20
  
  # puma.rb 
    RAILS_MAX_THREADS : 5
    WEB_CONCURRENCY   : 2
  </code></pre>
  
  <p>1 sidekiq server with bellow configuration</p>
  
  <pre><code># sidekiq 
    concurrency:  25
  </code></pre>
  
  <p>I tried to get max number of connection my DB is able to handle</p>
  
  <pre><code># MySQL Max connections ("show global variables like 'max_connections';")
    624
  </code></pre>