Bad performance: largest contentful paint (LCP)

I am experiencing a low performance on lighthouse, it mentions the <h1> element as the LCP. I ran these commands but they didn't make any difference: php artisan icons:cache php artisan filament:cache-components php artisan optimize I am using Filament v3 and Livewire v3. Thanks in advance.
No description
No description
43 Replies
Dennis Koch
Dennis Kochβ€’3mo ago
OPCache for PHP is enabled?
the_great_lol
the_great_lolβ€’3mo ago
No it's disabled
No description
Dennis Koch
Dennis Kochβ€’3mo ago
OPCache is the most impactful measurement for PHP performance in general. You should turn it on and try again
toeknee
toekneeβ€’3mo ago
It's litterally what changed the game for PHP
the_great_lol
the_great_lolβ€’3mo ago
Ok will do rookie question: I have two php.ini files, one in cli directory and one in fpm , which one do I edit? or edit both?
Dennis Koch
Dennis Kochβ€’3mo ago
fpm Unless you serve via PHPs server. And maybe php artisan serve. Just change one and see whether it's enabled when dumping phpinfo()
the_great_lol
the_great_lolβ€’3mo ago
Ok
toeknee
toekneeβ€’3mo ago
cli. is for ' Command Line Interface' so when you run php artisan etc it'll likely use that php.ini
the_great_lol
the_great_lolβ€’3mo ago
mmmm I'm little confused πŸ₯² .. so I should change both just in case?
Dennis Koch
Dennis Kochβ€’3mo ago
It won't hurt. But as I said: Change first, see whether it works. If not change other, check again
the_great_lol
the_great_lolβ€’3mo ago
I changed one at a time and restarted the nginx server but the issue is still here
No description
Dennis Koch
Dennis Kochβ€’3mo ago
Did you check whether OPCache is actually on now?
the_great_lol
the_great_lolβ€’3mo ago
I am trying to find a way ... since I'm accessing the production server using ssh Can I -for example- add a file with phpinfo() from my local and deploy it to production and check?
the_great_lol
the_great_lolβ€’3mo ago
I ran php artisan tinker in the production website directory then phpinfo() and looked for OPCache section. here is what I've found
No description
dissto
disstoβ€’3mo ago
after you have changed your php.ini did you restart php-fpm?
the_great_lol
the_great_lolβ€’3mo ago
I restarted nginx using sudo systemctl restart nginx , should I restart php-fpm individually?
dissto
disstoβ€’3mo ago
yea
the_great_lol
the_great_lolβ€’3mo ago
I ran sudo systemctl restart php8.2-fpm.service and sudo systemctl restart nginx but in my website directory phpinfo() it still not enabled
No description
dissto
disstoβ€’3mo ago
but your nginx server file does contain phpfpm, right? like:
location ~ \.php$ {
fastcgi_pass unix:/path/to/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ \.php$ {
fastcgi_pass unix:/path/to/php/php8.2-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
include fastcgi_params;
}
?
toeknee
toekneeβ€’3mo ago
Is debug bar enabled….
the_great_lol
the_great_lolβ€’3mo ago
Here is my nginx.conf file
No description
No description
the_great_lol
the_great_lolβ€’3mo ago
No we didn't install it yet it's nginx.conf right? or another file?
dissto
disstoβ€’3mo ago
sudo nano /etc/nginx/sites-available/yourfile
the_great_lol
the_great_lolβ€’3mo ago
It has this
No description
dissto
disstoβ€’3mo ago
Im not actually sure which php tinker uses (php or php-fpm)...i think there is an actual enable_cli flag.. πŸ€” Can you create a temporary dummy route where you actually output phpinfo() or opcache_get_status()
the_great_lol
the_great_lolβ€’3mo ago
ok will try Can I make the dummy route from my local and deploy it to production? because it seems like everything is cached and my temp route wasn't recognized when I created it on production
Dennis Koch
Dennis Kochβ€’3mo ago
Why not?
dissto
disstoβ€’3mo ago
thats probably already a good sign πŸ€“ reload or restart php-fpm
the_great_lol
the_great_lolβ€’3mo ago
Because the directory that I access on ssh is the latest deployed one, which has these commands already applied on
No description
Dennis Koch
Dennis Kochβ€’3mo ago
Can I make the dummy route from my local and deploy it to production
I answered to this πŸ˜…
the_great_lol
the_great_lolβ€’3mo ago
ah sorry my mistake πŸ˜…
dissto
disstoβ€’3mo ago
reloading phpfpm should be in the deploy script anyway...but i suppose you can do it locally and push it πŸ˜‹
the_great_lol
the_great_lolβ€’3mo ago
will test it πŸ‘
the_great_lol
the_great_lolβ€’3mo ago
Here is phpinfo() "zend OP cache" on production
No description
dissto
disstoβ€’3mo ago
That's great. What does lighthouse say?
the_great_lol
the_great_lolβ€’3mo ago
will test in a moment ...
the_great_lol
the_great_lolβ€’3mo ago
It's slightly better than earlier but still shows signs of low performance
No description
dissto
disstoβ€’3mo ago
Mhh πŸ€” Maybe now would be a good time to setup http2 and test its impact and gzip (or similar) if not already done?
the_great_lol
the_great_lolβ€’3mo ago
problem is I don't know where to start with this πŸ˜… especially that filament seems to handle things by itself
dissto
disstoβ€’3mo ago
i would start here unfortunately its not free but 100% worth it. That course covers literally everything You did run php artisan optimize i suppose? Did you also run php artisan icons:cache and php artisan filament:cache-components? Gotta restart php-fpm afterwards
the_great_lol
the_great_lolβ€’3mo ago
Luckily, I have access to view the course, will check it out , thanks πŸ˜„ I didn't run them πŸ˜… , so when I run all of them I should run sudo systemctl restart php8.2-fpm.service ?
dissto
disstoβ€’3mo ago
yes
the_great_lol
the_great_lolβ€’3mo ago
I ran all the cache commands and made sure that opcache is enabled and running but the problem is still on. could it be the way I assign my css and js in the layout file? <!DOCTYPE html> <html lang="{{ str_replace('_', '-', app()->getLocale()) }}"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="csrf-token" content="{{ csrf_token() }}"> <title>{{ config('app.name', 'Laravel') }}</title> <!-- Fonts --> <link rel="preconnect" href="https://fonts.bunny.net"> <link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" /> <!-- Scripts --> @vite(['resources/css/app.css', 'resources/js/app.js']) <!-- Styles --> @livewireStyles </head> <body class="font-sans antialiased"> <x-banner /> <div class="min-h-screen bg-gray-100"> @livewire('navigation-menu') <!-- Page Heading --> @if (isset($header)) <header class="bg-white shadow"> <div class="max-w-7xl mx-auto py-6 px-4 sm:px-6 lg:px-8"> {{ $header }} </div> </header> @endif <!-- Page Content --> <main> {{ $slot }} </main> </div> @stack('modals') @livewireScripts </body> </html>
Want results from more Discord servers?
Add your server