title: Eloquent Very slow when using remote MySQL
body: <p>I recently had to transfer my database to a remote server.</p>
  <p>I used Postman to connect to PHP running on localhost to make the same requests. Here are the results,</p>
  <blockquote>
  <p>MySQL on Localhost and Eloquent : ~30ms</p>
  <p>MySQL on Remote Server and Eloquent : ~2.7 seconds</p>
  <p>MySQL on Localhost and PHP: ~10ms</p>
  <p>MySQL on Remote Server and PHP: ~850ms</p>
  </blockquote>
  <p>The average ping from my computer to the the remote server ip is about 150ms.</p>
  <p>Here is the PHP script I used,</p>
  <pre><code>// Create connection
  $conn = new mysqli($servername, $username, $password, $dbname);
  
  if ($conn-&gt;connect_error) {
      die(&quot;Connection failed: &quot; . $conn-&gt;connect_error);
  }
  
  $sql = &quot;select * from `online` where `online`.`id` = 1 limit 1&quot;;
  $result = $conn-&gt;query($sql);
  
  var_dump($result);
  </code></pre>
  <p>For eloquent, I just used <code>Online::find(1)</code>.</p>
  <p>I still haven't tried running eloquent on a server, but is this normal? Should I steer away from using eloquent if I am going to be using remote mysql databases on different servers?</p>
  <p><strong>EDIT:</strong></p>
  <p>I was changing some values, and when I removed the charset and collation value from eloquent config, the response time improved to 1.7s which is 1s faster.</p>
  <pre><code>'charset' =&gt; 'utf8mb4',
  'collation' =&gt; 'utf8mb4_unicode_ci',
  </code></pre>