Filament performance
These numbers don't make any sense
why is a simple crud taking almost 40 MB of memory ?
41 Replies
I have the same problem here, 36MB and only loading an empty FilamentResource, example a customerResource with 36 MB, the dashboard with 32MB only with a widget, can't understand this problem... i check this video in Filament Daily, by Polivas Korop of Laravel Daily and the memory that use is 3MB and 80ms, i have all the time 400ms, 500ms... this is the video @noOne https://www.youtube.com/watch?v=LGHKjqLAhP4
Filament Daily
YouTube
Filament is Slow? Check Laravel Debugbar.
If you notice that some dynamic elements in Filament are loading slowly, I have a tip for you.
caching the icons helped reducing the loading time "php artisan icons:cache" but didn't help with the memory usage
i noticed a comment in this video saying that the windows environment is one of the reasons
so i have to ask
do you use windows like me ?
Windows could be the problem
Probably best option is to use linux or mac
Windows uses a lot of memory for running "larger" projects
Is this local or production?
For me on Mac locally a typical backend resource page is about 5MB and 350 to 400ms.
On an AWS Ubuntu in staging/prod it's about 5MB and 250 to 300ms.
That's with 'views' turned off in DebugBar and caching icons.
Which is actually slightly smaller and slightly faster than a default Jetstream "Profile" page on my front end.
Those are actually showing a livewire update, but the initial page loads are essentially identical times and sizes. I just can't click my capture buttons fast enough to snag them. 🙂
It is not the right place, but the above notification of the agreements is filament or is it something customized by you?
yes i do with
php artisan icons:cache
but the memory not change, the time drops a little, but the memory megabytes remains the same, zero changes
The time is the same like on of my project, but the memory is over 36MB and over 38 in other times
yes bro, i'm working with Windows, i will test this in a laptop with Linux, maybe ubuntu... thank fot the detail
this look cool, i love this... maybe later i will test with a droplet on DigitalOcean and check this againCould you check with inspector network tab what is getting loaded?
is a local project, not production yet
in all resource load the same memory, 36mb or more, but never over 40mb, and this problem with 36mb is a resource loading a table with 13000 register or 900 register, or in empty resource, without data loading, i mean not table... is a stranger problem, mybe is windows like you says guys... i will know later when upload in DigitalOcean and test again
Could you check network tab like this to see what gets loaded what is that size?
can you let me know when you test it ?
in my case its local
can i ask how you made the sidebar look like this ?
@noOne just set $navigationIcon to null. I have so many resources it makes no sense to try and use icons for them. You can also set an icon on the main nav group, in the panel service provider, and null for the individual resource icons ...
None of that page is Filament. It's a more or less standard Jetstream front end page (the "Profile" page), with custom styling.
So the main nav menu is ...
... and the overdue-agreements-header is ...
The only Filament thing on that page is the notifications bell, which shows the Filament database notifications shade.
thanks
So to be clear, I have a Filament backend, and a Jetstream based frontend (but which makes extensive use of standalone Filament tables, forms, actions, notifications, etc).
i went to an old laravel 9 project (not filament) and tested on a linux server and tested on my local windows pc
the difference is huge
the memory usage on windows is 27 MB but on linux its just 3 MB
On windows, how are you running it?
Via WSL? If so, are you using
php artisan serve
or nginx
?Laragon
Hmm Not really familiar with using that
I can tell you if you are using
php artisan serve
expect a huge performance hit
I have a tool that I'm close to releasing that makes Laravel via WSL a breeze on Windows
Sets everything up for you
I have seen similar really bad performance with Filament using php artisan serve
i never use artisan serve, like ever. dont recommend it
and high memory as it's effectively running a webserver via php instead of a real webserver
exactly
Back after Laracon when I was helping Marcel with NativePHP, I ran into that a LOT
since internally it uses that because PHP natively on Windows does not support PHP-FPM so the php startup on each request really hurts livewire.
and thus Filament
not really
i got the same result using
php artisan serve
Right, because if Laragon is native to Windows, it's solution isn't that much better than
artisan serve
It's better but still severely suboptimal
PHP-CGI isn't great
It suffers from starting php for each request
PHP-FPM keeps php processes spooled (depending on configuration) and ready to go
unfortunately PHP-FPM is not support for windows natively.
This is why I use WSL, I can use 'Linux' in Windows
Not promoting but if you're interested more in WSL, let me know. I am planning on moving Winux to beta in the coming weeks.
I can try to help you get it going.
This is a demo video of my tool that I use for my personal development now.
https://twitter.com/chrisreedtech/status/1695162262388949058
Just as an alternative to Laragonthanks for the useful information about PHP-FPM AND PHP-CGI
about the tool you're building
the reasons i use laragon is the ability to install multiple php versions very easy and it also auto create a virtual domain for every project you have in the www directory
and it's an "all in one" package meaning you just install laragon and it will install everything you need "php mysql apache nginx nodejs" and more
so well we see something like that in the tool ?
😄 Yes
quick run down of how I run my stack (before the tool, which is mirrored in the tool)
I'd setup a nginx zone file in /etc/nginx/sites-available then symlink it to sites-enabled
have to restart nginx, make a database, then make a line in my hostfile so that the subdomain would point to localhost
then I would still not have HTTPS and I'd have to configure all that manually
The tool does all that automagically
in less than 30 seconds
at the end of the process, you have a new Laravel project from nothing, that have a database, .env configured, https, nginx, and it auto opens vscode (for now, php storm coming) and the live webpage in your browser
Oh
It will also init a git repo in the site and auto via the github cli tool, make a repo on github and do your first push
that looks cool
i'm definitely interested
Added you as a Discord friend. I'll definitely post on Twitter and try to message you on discord when I'm ready for others to start testing.
I have a bootstrap tool that I'm working on as well that can bootstrap a fresh WSL instance (ubuntu, from the windows store) and will have it fully configured to go
It auto installs nginx, php, the modules, pretty much everything you need to then run the main tool to start making projects
I want all of the stuff I've said so far to be free but I would like to monetize company/enterprise usage and provide enhanced team/collaberation features. Gotta feed my family after all. But I want everything I've said before this message to be open source and free
Just trying to figure out a plan there before I open source the tool and 'let the cat out of the bag'
I figured that people would be far more comfortable running such a tool if they could inspect the source to make sure it's not doing anything that it shouldn't.
Main tool is made with Laravel Zero but the bootstrap program is straight python (no php in stock Ubuntu install)
nice
i wish you luck
i followed you on twitter
Appreciate the support! Encourages me to try to spend more time on it 🙂
Good luck with your performance issues on Windows. hope I can help with that before too long
FWIW, using WSL, you get a huge performance boost by having the project files inside the container you're using.
https://learn.microsoft.com/en-us/windows/wsl/filesystems#file-storage-and-performance-across-file-systems
It's a common mistake I've seen a lot of people make (including me until recently). I had my code on a Windows folder. Once I moved it inside the Ubuntu environment, the speed difference was insane
Working across file systems
Learn about the considerations and interop commands available when working across Windows and Linux file systems with WSL.
For sure, that is a huge hit. I don't do any cross file system operations unless it's copying from one into the other to then use it.
WSL still can struggle a bit with symlinks. I've run into that doing package development and having it symlinked in to my working project.
When the package and main testing app are both open, the vscode server can make the load average go up to 2+. Tracked down to symlinks
For the record I’ve seen this is valet too going up to 35MB. But restarting valet usually takes it back down to 3-5. Probably too much crap in tmp.
FWIW - I'm running HERD and sitting at 11MB right now, with a fairly empty project (data-wise) but with 13 resources.
These are my PHP processes for my WSL instance.
im working in a deploy on DigitalOcean, when i finish him, i test the memory with debugbar again
Hey friends, finally i put my project in a droplet on DigitalOcean, i check the memory with debugbar and this use 9MB now, from 36Mb or 39Mb is down to 9Mb and between 200ms to 260ms
later i will configure the php-fpm
Hi
after that i execute the
php artisan icons:cache
and now all resource use only 3Mb... this is really really cool