Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Occasional requests take over 10 seconds
  • Every now and then I get a really slow response from the app I'm building, and looking at the profiler I could see that it was happening somewhere inside the Fuel::init function, so I stuck a load of extra stuff into that method to measure the execution time at various points throughout. Here's the log output...




    Warning - 2013-01-10 17:40:23 --> Fuel\Core\Fuel::init - Execution time after getting the cache_dir : 0.0089578628540039
    Warning - 2013-01-10 17:40:33 --> Fuel\Core\Fuel::init - Execution time after getting the cache config setting : 10.016606807709


    And here's the relevant bit of code...


    static::$cache_dir = \Config::get('cache_dir', APPPATH.'cache/');

    if (static::$profiling || static::$logslow)
    {
    \Profiler::mark(__METHOD__.' Execution time after getting the cache_dir : ' . \Profiler::elapsed());
    if(\Profiler::elapsed() > static::$slowtime){
    logger(\Fuel::L_WARNING, 'Execution time after getting the cache_dir : ' . \Profiler::elapsed(), __METHOD__);
    }
    }

    static::$caching = \Config::get('caching', false);

    if (static::$profiling || static::$logslow)
    {
    \Profiler::mark(__METHOD__.' Execution time after getting the cache config setting ' . \Profiler::elapsed());
    if(\Profiler::elapsed() > static::$slowtime){
    logger(\Fuel::L_WARNING, 'Execution time after getting the cache config setting ' . \Profiler::elapsed(), __METHOD__);
    }
    }


    Any ideas why it might take 10 seconds to get the cache setting from config? It doesn't seem to make a difference what this cache setting is.

  • Honestly, I don't have a clue. Run an xdebug trace and analyze it with kcachegrind of webgrind?
  • Cheers, I'll give it a go. Seems a bit weird doesn't it.
  • Absolutely. And I can't think of any reason why this would happen.
    Config::get() is nothing more than a glorified array_key_exists()...
  • It looks like the Profiler was reporting inaccurately somehow, I've added xdebug_start_trace(); as the first line (after the php tag) of index.html and eventually managed to get it to do the 10 second lag thing: the first line of the xdebug output shows as happening before anything has happened...

    10.0064     681160     -> error_reporting() /vagrant/site/public/index.php:6

    This makes me think it's something to do with Vagrant or VirtualBox. I've already destroyed and recreated the box and switched to nginx from apache while trying to track this down. Will report back if I manage to solve it.
  • Should read index.php above, obviously.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion