cp-nav icon indicating copy to clipboard operation
cp-nav copied to clipboard

CP Slow with two or more users logged in #15351

Open adrianjean opened this issue 1 year ago • 6 comments

Describe the bug

Cross posting this issue https://github.com/craftcms/cms/issues/15351 here, an issue I am seeing with CP Nav installed. Basically when the plugin is installed, it causes a slow page load when non-admins access the site.

Worked with the P&T team to diagnose the issue as relating to CP Nav.

Steps to reproduce

  1. In one browser (Chrome for example), create User A, log-into the CP. Notice how fast the CP is as normal.
  2. In one browser (Safari for example), create User B. Log-into the CP in a different browser. Notice a short lag before the CP loads. Once it loads notice how fast the CP is, as normal.
  3. Switch back to the browser with User A, and refresh the page. Notice the lag in the CP loading?. Once it loads notice how fast the CP is, as normal.
  4. Switch back to the browser with User B, and refresh the page. Notice the lag in the CP loading?. Once it loads notice how fast the CP is, as normal.
  5. ... etc. etc.

Uninstalling CP Nav makes the issue go away.

Craft CMS version

Craft Pro 5.2.5 (Happens in 4.x as well)

Plugin version

8.3.9

Multi-site?

Yes

Additional context

No response

adrianjean avatar Jul 19 '24 03:07 adrianjean

I have a feeling this might be related to project config and the YAML files being generated. I actually can't replicate this on a new site though (Craft 4.x or 5.x).

Maybe to test the project config stuff, if you want to temporarily disable YAML file generation to see if that changes things on your end?

In your config/app.php:

<?php

return [
    'components' => [
        'projectConfig' => function() {
            $config = craft\helpers\App::projectConfigConfig();
            $config['writeYamlAutomatically'] = false;
            return Craft::createObject($config);
        },
    ],
];

(possibly related to https://github.com/craftcms/cms/issues/14140)

engram-design avatar Jul 20 '24 01:07 engram-design

I tried the code you supplied, and it definitely has a positive impact! Almost as snappy as not having the plugin installed.

adrianjean avatar Jul 20 '24 02:07 adrianjean

Interesting and good to know. I've found that for medium to large sites the YAML files take a stupidly long time to generate, causing lag or straight up making the CP inaccessible. It's not specifically this issue, but it probably will help to track down what's happening. My issue with Craft on that in general still hasn't been resolved.

So yeah, looks like CP Nav is re-generating the YAML files in some fashion. I'm struggling to reproduce this, but will keep at it.

engram-design avatar Jul 20 '24 04:07 engram-design

Is there any news on this? We have the same issue.

FrDH avatar Jan 21 '25 08:01 FrDH

I think this is coming down more to how Craft generates the YAML project config files, than anything unique to CP Nav. Maybe comment in https://github.com/craftcms/cms/issues/14140 and mention your development environment as well.

engram-design avatar Jan 22 '25 03:01 engram-design

I think this is coming down more to how Craft generates the YAML project config files, than anything unique to CP Nav. Maybe comment in craftcms/cms#14140 and mention your development environment as well.

My bad, I actaully ment to comment on that issue... :| (came here via the link to this issue)

FrDH avatar Jan 23 '25 07:01 FrDH