I have an issue where the first CiviCRM request of any session takes 4 minutes to load. This can be a request for the dashboard, or an administrative screen, it doesn't matter. There are no errors on screen and no errors appearing in the CiviCRM runtime logs. The first pageload simply takes four minutes, then everything works fine -- until the user logs out, and logs in again. Then the first request takes another 4 minutes.
I've been trying to research this and have come across several other questions that are relevant but don't exactly match my situation (Slow to open at first daily use, https://civicrm.stackexchange.com/questions/12886/civicrm-dashboard-hangs-for-5-minutes?rq=1,https://civicrm.stackexchange.com/questions/14343/civicrm-dashboard-hangs-for-5-minutes-part-2?noredirect=1&lq=1)
Based on info in the many answers, I've discovered the following:
- removing all dashlets/reports from the dashboard doesn't improve speed. Dashboard still takes 4 minutes to load -- but so do the other requests (except, strangely, for searches, which load right up)
- hosting provider has confirmed we don't have a NAT Fire setup and that internal requests should be working normally
- database doesn't seem to be the issue because 1) it's not maxed out, and 2) 2 concurrent sessions making the same requests one after the other exhibit the same behavior
I'm pretty sure this is an environment problem, because I have two CiviCRM installs on the same server which are exhibiting the same behavior (two different versions: 4.7.24 and 4.7.29). Clones of these environments do not have this problem on my local test servers.
It smells like a timeout, but I just can't for the life of me figure out where to start looking for what is timing out, and why only on the FIRST request of a session!
Seen in two installs of CiviCRM on the same server:
1st: Joomla 3.6.5, CiviCRM 4.7.24, PHP 5.6 2nd: Joomla 2.5.28, CiviCRM 4.7.29, PHP 5.6