1

For some reason when we're bootstrapping Craft CMS it's VERY slow to bootstrap (500ms) worth of slowness. This is utilizing HTTP2 and PHP7 so we're expecting it to be much faster than this.

I'm assuming this is just some setting we're missing and/or our Craft installation is doing too much for one app.

I changed the _layout.html to this:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>TESTING</title>

    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
</head>

<body id="body">
    <!-- View container-->
    <div class="view-container" id="main-view-container">
        <h1>TESTING IN THE BODY</h1>
    </div>
</body>

Not much going on there. However, this is still taking 500-600ms to bootstrap. This is my general.php file --

<?php

require __Dir__ . '/../../vendor/autoload.php';
require_once __Dir__ . '/../plugins/global/config/Environment.php';

//error reporting
if (Craft\Environment::isProduction()) {
    //log all errors except for notices, strict php guidelines, etc
    error_reporting(E_ALL & ~E_STRICT & ~E_NOTICE & ~E_DEPRECATED); 
    ini_set('display_errors', 0);
} else if (Craft\SayEnvironment::isDemo()) {
    error_reporting(E_ALL & ~E_STRICT & ~E_WARNING);
    ini_set('display_errors', 0); //don't display errors to console in demo
}

return array(

//////////////////////////
///  Default Settings  ///
//////////////////////////
'*' => array(
    'useCompressedJs' => false,
    'appId' => 'myappid',
    'validationKey' => 'asdfasfdasdfasdfasfasd',
    'timezone' => 'America/Chicago',
    'omitScriptNameInUrls' => true,
    'generateTransformsBeforePageLoad' => true,
    'maxUploadFileSize' => 33554432,
    'phpMaxMemoryLimit' => '512M',
    'slugWordSeparator' => '-',
    'enableCsrfProtection' => true,
    'devMode' => false
),

////////////////////////
//  Local Overrides  ///
////////////////////////
'localhost' => array(
    'cacheMethod' => 'file',
    'overridePhpSessionLocation' => false,
    'environmentVariables' => array(
        'siteUrl' => 'https://localhost/'
    )
)

);

Realistically all I'm asking Craft to do right now is bootstrap itself and load this _layout.html file. Any ideas why this implementation might be slow? We have 15-20 large plugins but we're not really doing anything with them in this instance?

1 Answer 1

2

It shouldn't be that slow to bootstrap, but even if you're not doing anything with the plugins in your template, they are still loaded and instantiated with every request.

If I were you, I'd do some profiling with Blackfire or NewRelic to see what's really going on.

1
  • That's what I'm thinking is the issue. We essentially have an entire PHP application that is built inside CraftCMS plugins. I'm thinking the plugins are too massive/plentiful for craft to bootstrap quickly. I'm already in the process of breaking this code out of the CMS so that should confirm this idea in the next few weeks!
    – Exziled
    Nov 8, 2017 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.