title: PHP API: Same code in two environments, on same server, different speeds
body: <p>Hope the title wasn't too confusing.</p>
  
  <p>I have a TEST and PROD environment running the exact same PHP API code. Both "environments" run on the same VM. </p>
  
  <p>Access to PROD is made through live.myapi.com and TEST is made through test.myapi.com. Both domains point to the same IP and all requests for both are made through SSL. (doubt any of that matters but there it is anyway)</p>
  
  <p>If I run a test on the search end point in both I get HUGE differences in execution times.</p>
  
  <p>PROD <a href="https://live.myapi.com/search" rel="nofollow noreferrer">https://live.myapi.com/search</a> 1.5s to 5.8s
  TEST <a href="https://test.myapi.com/search" rel="nofollow noreferrer">https://test.myapi.com/search</a> 0.07s to 0.2s</p>
  
  <p>PROD is more than 10x slower than TEST even though they're the same code and running on the same VM.</p>
  
  <p>The API contacts a remote database in AWS (Aurora) and the absolute only difference between these two APIs is they communicate with a PROD and TEST database respectively. The databases are running on the same server as well so there's no difference in hardware between them either.</p>
  
  <p>I changed the search object in PROD to point to the TEST database but still got the same times.</p>
  
  <p>Then I changed the search object in TEST to point to the PROD database and it was still super fast.</p>
  
  <p>I also made sure they were getting the same record returned in the search for both environments but changed the value of one column for TEST so it would be clear the changes I made were actually taking effect. They definitely were.</p>
  
  <p>So I think I've eliminated the database as the issue but I cannot think of anything else that would be causing these ridiculous speed differences.</p>
  
  <p>I'm hoping that maybe some of you have some ideas for what else I can look for to determine why PROD would be running so slow.</p>
  
  <p>Thanks in advance for any help and for reading this.</p>