My CI site will sometimes just hang - server seems to take forever to answer my request, i.e. when just loading the homepage, and other pages too. It's quite random and only does it sometimes.
I turned on profiling and hit the homepage, this was the result:
Here's the home/index method
function index()
{
$this->output->enable_profiler(TRUE);
$this->benchmark->mark('template_sets_start');
$this->template->title('Yay, welcome to my site');
$this->template->js('home.js,cycle.js');
$this->benchmark->mark('template_set_end');
$this->benchmark->mark('template_load_start');
$this->template->load('template/home');
$this->benchmark->mark('template_load_end');
}
}
Since the time returned for the template stuff is low, I can assume the lag isn't happening anywhere in the views.
An ideas or suggestions?
===EDIT===
One thing I found is the config is setting the base_url dynamically. Code below, could this potentially cause slow-dows?
$config['base_url'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http");
$config['base_url'] .= "://".$_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']),"",$_SERVER['SCRIPT_NAME']);
Execution time for "Template Sets" is 0.0000, because you missed "s" in mark's name.
Change:
$this->benchmark->mark('template_set_end');
to
$this->benchmark->mark('template_sets_end');