Link to home
Start Free TrialLog in
Avatar of Eduardo Fuerte
Eduardo FuerteFlag for Brazil

asked on

Could you point what must to be checked to make a Laravel app to runs quickly?

Hi Experts

Could you point what must to be checked to make a Laravel app to run quickly?

I'm using php artisan serve, no errors are occuring, I changed execution time at PHP.INI (any other place is necessary when using Laravel?)

User generated image
Thanks in advance
Avatar of David Favor
David Favor
Flag of United States of America image

Code speed relates to how you've written your code, in most cases.

The problem above seems to relate to your database either being down or more likely slow.

Database speed/slowness is a function of your hosting. You really have little to no control over this, unless you're running on a bare metal (dedicated server) machine.

If you are running bare metal, you can easily review your logs to determine the problem + fix.

Normal first action is to run mysqltuner, addressing diagnostics which are meaningful for your specific database access pattern.
Avatar of Eduardo Fuerte

ASKER

The same app runs quickly at other machines, it's a common Laravel project used by another programmers.

It's running locally at my PC.

I got elsewhere an opinion on increase the memory allocation by an Apache configuration and/ or MySQL configuration.

I changed PHP.INI
memory_limit=20000M

Any idea on how to configure it to increase MySQL memory in PHP.INI?
I found that the local station's MySQL data load script has too much duplicated lines, so when an "administrative profile" user (that I was logging in with) tries to log in, a lot of processing is done on this data in order to produce a dashboard to be presented, before the page open,  I only had this profile to login.

I got a workaround to access as a "regular profile" user and then there was no delay on the page presentation.

Then I droped the database recreated it and reinserted lines at DB without duplictions and everything get been normal.

Before I had created a virtual machine to be able to use Apache's larger configured memory (I don't know how to configure Laravel's internal server memory)  it seems that the process just got better too.
ASKER CERTIFIED SOLUTION
Avatar of Eduardo Fuerte
Eduardo Fuerte
Flag of Brazil image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks David!
You're welcome!

About MySQL performance enhancements.

1) Largest performance boost. Deinstall MySQL. Install MariaDB.

Since MariaDB is a... faster + more functional MySQL, same data files are used, so MariaDB is usually just a drop in replacement.

Normal performance testing I've done, shows a 30%-50%+ performance boost for the few minutes of work to install MariaDB.

2) If slowness relates to row count, this points to a schema deficiency (lack of UNIQUE constraints on indexes).

This problem is best fixed at the table level, else the same problem will likely reoccur in production.

Temporary fix will be to add a LIMIT clause to your SELECT statements.

3) Running mysqltuner each day, then implement tuning suggestions, till suggestions no longer emit... is a simple way to boost performance.

4) Tip: Likely best run on a machine with 64G-128G of RAM for best database flexibility tuning.