title: Random extremely long request in Rails app
body: <p>I have a really strange behaviour in my Rails app.</p>
  
  <p>Sometimes, like 1 request every 500, I have a simple ActiveRecord code which takes a lot of time (from 5 sec to X min). Some examples here:</p>
  
  <pre class="lang-ruby prettyprint-override"><code>User.where(id: params[:id]).first # or
  current_user # (with *Devise*) or
  Authentication.where(provider: 'whatever', user_id: 12345).first
  </code></pre>
  
  <p>I don't really know where to look at: all these requests have appropriate indexes (they usually work in millisecond times), the server load seems constant, ...</p>
  
  <p>Anyone here had this kind of issue before or some ideas on how I could resolve them?</p>
  
  <p>Thanks!</p>
  
  <p><em>FYI, I work with Rails/ActiveRecord 3.2.17, puma 3.11.4, Docker (ECS on AWS), MySQL 5.6.34</em></p>