Search code examples
phplaravellaravel-6php-7.1

How to optimize - PHP 7.3.14 + Laravel 6


I need to replicate a legacy structure for comparison purposes and to motivate system migration. I will write a report pointing out the pros and cons of this migration.

But I immediately had a problem, the server is extremely slow, I can't compare it with the web server in node/go/rust which returns less than 3ms in development mode.

The initial framework with PHP 7.13.4 + Laravel 6 is taking an average of 3 seconds to return static data.

The repository is below:

Git - Repository php7.13.4_laravel6

To verify:

docker compose up -d

and

GET: http://localhost:8080/api/user

The question is that I have just started this structure, do I need to carry out a series of optimizations for this to be minimally acceptable?

Commands executed:

composer dump-autoload --optimize
php artisan optimize
php artisan config:cache
php artisan route:cache

PC info:

Operating System Name: Microsoft Windows 10 Pro
Operating System Version: 10.0.19045 N/A Build 19045
Total Physical Memory: 16,308 MB
Processor: AMD Ryzen 5 3600 6-Core Processor 12 Threads

Running in WSL Ubuntu-18.04 - Docker


Solution

  • Probably, you are storing your files on Windows. Differences between file systems force to do some kind of conversion, that's where the problem is.

    The solution is simple: move your files into WSL (e.g. home directory) and run Docker from it.

    https://learn.microsoft.com/en-us/windows/wsl/filesystems#file-storage-and-performance-across-file-systems

    Docker on WSL2 very slow