Home > other >  Differences between developer and production mode CodeIgniter4
Differences between developer and production mode CodeIgniter4

Time:12-22

Today I ran into a interesting problem, was wondering if anyone here know what is happening. I'm developing a Web App with CodeIgniter4, so far everything was working fine, so I decided to spice things up and seed a few thousands registers into some of my tables. Nothing really absurd like a million registers, but enough to stress test the application. It was like 20k registers, so CodeIgniter shouldn't really have a problem, neither should PostgreSQL. But after that, any page related with those tables were taking more than a minute to load.

After a few minutes looking arround trying to find the reason, I stumbled into the "solution". When I set the .env to Production, everything runs just fine. But when its set to developer mode, the lag is surreal.

By my understanding, those options should just change the way an error is presented in the Views, beeing developer mode more specific and production mode just some generic "Ops, something went wrong". Is there anything more to it so I can find why my site is lagging so much?

CodePudding user response:

Just in case you are seeing this 10 years from now with this very specific problem, the solution was turning off the CI4 toolbar in app/Config/Filters.php at the section

public $globals = [
        'before' => [
            // 'honeypot',
            // 'csrf',
        ],
        'after'  => [
            //'toolbar',
            // 'honeypot',
        ],
    ];

Not sure why it was causing the lag, so if you need this toolbar, you might want look a bit further to find out.

  • Related