Optimizing Table Load Speed

"Hi, I'm comparing the performance of my application built with NOVA V4 and FILAMENT v3. When loading 50 records, NOVA takes 1.08 seconds, while FILAMENT takes 4.21 seconds. Both applications are already in production and are using the same specifications. Things I've already done: - Ran php artisan optimize:clear - Ran php artisan config:cache - Ran php artisan view:cache - Ran php artisan route:cache - Ran php artisan icons:cache Are there any other steps I can take to improve the performance of my FILAMENT application? Thank you in advance."
nova
nova
filament
filament
Solution:
summary: 1. run php artisan icons:cache 2. run php artisan filament:cache-components 3. run php artisan optimize 4. implement OPCache...
Jump to solution
30 Replies
Dennis Koch
Dennis Koch10mo ago
Both 1s and 4s are bad performance for both tools. Do you have Debugging stuff enabled? What machine is this running on?
Jr.Pikong
Jr.PikongOP10mo ago
no, I don't use debugging, because this is already in production, I use Kubernetes and apache and image : php:8.2-apache
S. Mert ÖZTÜRK
S. Mert ÖZTÜRK10mo ago
did you try php artisan icons:cache
Jr.Pikong
Jr.PikongOP10mo ago
@S. Mert ÖZTÜRK Things I've already done: Ran php artisan optimize:clear Ran php artisan config:cache Ran php artisan view:cache Ran php artisan route:cache Ran php artisan icons:cache
S. Mert ÖZTÜRK
S. Mert ÖZTÜRK10mo ago
oh sorry i didn't see it, my mistake. Which is your using database
Jr.Pikong
Jr.PikongOP10mo ago
I Use mysql : db.t3.medium Single-AZ instance (AWS )
Jr.Pikong
Jr.PikongOP10mo ago
this is my code :
S. Mert ÖZTÜRK
S. Mert ÖZTÜRK10mo ago
can u try to remove declare and simplify your table. It's just a guess I've never tried it before, but all that formatting and other stuff might be delaying loading. In simpler terms, we can at least try and measure the difference.
Jr.Pikong
Jr.PikongOP10mo ago
simplifying the table I think it doesn't have much of an impact, because in other resources with the same amount of data with simpler table columns, the results are the same but for declare I can try
S. Mert ÖZTÜRK
S. Mert ÖZTÜRK10mo ago
So may we have problem with server setup, do you have any chance to try on diffrent server? or local.
Jr.Pikong
Jr.PikongOP10mo ago
declare make an impact approximately 1s prod and local same a result .
S. Mert ÖZTÜRK
S. Mert ÖZTÜRK10mo ago
I only have one idea left: Install a new Laravel and filament and try the same table without installing anything else. Maybe your installed packages crush or impact some performance
Jr.Pikong
Jr.PikongOP10mo ago
Thank you for the advice while waiting for suggestions from others because if I look at the packages I use, there aren't many "requires": { "php": "^8.2", "ariaieboy/filament-currency": "^1.2", "aymanalhattami/filament-page-with-sidebar": "^2.2", "barryvdh/laravel-dompdf": "^2.0", "bezhansalleh/filament-shield": "^3.2", "calebporzio/sushi": "^2.5", "filament/filament": "^3.2", "flowframe/laravel-trend": "^0.1.5", "guzzlehttp/guzzle": "^7.2", "laravel/framework": "^10.10", "laravel/sanctum": "^3.2", "laravel/tinker": "^2.8", "league/flysystem-aws-s3-v3": "^3.0", "league/flysystem-path-prefixing": "^3.0", "league/flysystem-read-only": "^3.0", "parallax/filament-syntax-entry": "^1.0" },
S. Mert ÖZTÜRK
S. Mert ÖZTÜRK10mo ago
yes not many but maybe some packages impact on performance. And we dont know which it is, if it is. Last thing for try, Can you share your env file, by hiding important infos and how do you power up your application, with php artisan serve or serve direclty from public?
Jr.Pikong
Jr.PikongOP10mo ago
this my .env APP_NAME="INTERNAL-DASHBOARD" APP_ENV=production APP_KEY=base64:nQixtHIGs7ZPLHG24NGMHky APP_DEBUG=false APP_URL=https://xxx.com ASSET_URL=https://xxx.com LOG_CHANNEL=stdout LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug DB_CONNECTION=mysql DB_HOST=xxxx DB_PORT=3306 DB_DATABASE=xxx DB_USERNAME=xxx DB_PASSWORD=xxxx BROADCAST_DRIVER=redis CACHE_DRIVER=redis FILESYSTEM_DISK=s3 QUEUE_CONNECTION=redis SESSION_DRIVER=redis SESSION_LIFETIME=120 MEMCACHED_HOST=127.0.0.1 REDIS_HOST=xxx REDIS_PASSWORD=xx REDIS_PORT=6379 REDIS_DB=h2hNewDBWeb MAIL_MAILER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=xxx MAIL_PASSWORD=xx MAIL_ENCRYPTION=ssl [email protected] MAIL_FROM_NAME="${APP_NAME}" AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxx AWS_DEFAULT_REGION=xxx AWS_BUCKET=xxx I use kubernetes and Docker FROM php:8.2-apache # RUN set -eux \ && apt-get update \ && apt-get install -y libzip-dev zlib1g-dev \ && docker-php-ext-install zip # ENV DEBIAN_FRONTEND noninteractive ENV TZ=Asia/Jakarta RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone RUN apt-get update --fix-missing RUN apt-get install -y curl #COPY src/supervisord.conf /etc/supervisor/conf.d/supervisord.conf RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev libicu-dev RUN a2enmod rewrite headers #RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ # && docker-php-ext-install gd RUN pecl install -o -f redis \ && rm -rf /tmp/pear \ && docker-php-ext-enable redis RUN docker-php-ext-install pdo_mysql gd intl COPY src/000-default.conf /etc/apache2/sites-available/000-default.conf WORKDIR /var/www/html COPY src/ /var/www/html/ RUN apt-get -y autoremove RUN apt-get -y clean RUN docker-php-ext-install pcntl RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer RUN composer install --prefer-dist --no-dev -o RUN php artisan optimize:clear RUN php artisan config:cache RUN php artisan view:cache RUN php artisan route:cache RUN php artisan icons:cache RUN chgrp -R www-data storage bootstrap/cache RUN chmod -R ug+rwx storage bootstrap/cache RUN chown -R www-data: /var/www/html # USER www-data EXPOSE 80 CMD ["apache2-foreground"]
Jr.Pikong
Jr.PikongOP10mo ago
Hi @Miguel García , thanks for the advice, there's something I haven't done yet: artisan filament:cache-components , I'll try it now
binaryfire
binaryfire10mo ago
Nova's table load times are faster. It's not a Filament issue, it's a Livewire issue. Nova's tables are rendered client-side (Vue) whereas Livewire has to load / diff / update a lot of Blade components every time a table is (re)rendered. Hopefully someone figures out a way to improve it but it'll never be as fast as a client-side solution. There's some work being done to add loading indicators, which will definitely help "perceived" performance: https://github.com/filamentphp/filament/pull/9958 But as Dennis said, even 1s is too slow for 50 records. And Filament should be rendering 50 records in well under a second too.
Jr.Pikong
Jr.PikongOP10mo ago
Hi @binaryfire thanks for your explanation, it helped my insight.
Dennis Koch
Dennis Koch10mo ago
I think a normal time for Filament is around 300–400ms. Do you have OPCache enabled?
binaryfire
binaryfire10mo ago
Yeah. And less with Octane too!
Jr.Pikong
Jr.PikongOP10mo ago
no, I didn't set it, but I will explore from this article : https://laravel-news.com/php-opcache-docker
Laravel News
Speeding Up PHP with OPcache in Docker - Laravel News
If you’re on Docker for Mac or Docker for Windows, you might see some noticeable slowness and time to the first byte (TTFB) depending on your application’s setup. One of the most important things you can do to improve performance is enabling the OPCache module. Let’s look at how we can configure OPcache is a way that is development-friendly, but...
Dennis Koch
Dennis Koch10mo ago
OPCache is must have when working with PHP
Jr.Pikong
Jr.PikongOP10mo ago
thanks @Dennis Koch I will back if done implementing it wow OPcache renders 50% faster than before
Solution
Jr.Pikong
Jr.Pikong10mo ago
summary: 1. run php artisan icons:cache 2. run php artisan filament:cache-components 3. run php artisan optimize 4. implement OPCache
binaryfire
binaryfire10mo ago
What's the load time for the Filament version now?
Jr.Pikong
Jr.PikongOP10mo ago
now is 1.17 s with table record per page 50 .
Jr.Pikong
Jr.PikongOP10mo ago
No description
S. Mert ÖZTÜRK
S. Mert ÖZTÜRK10mo ago
Still slow. livewire re-render all component for little changes is too big problem. Hope caleb can do something for this on v4. I'm here for some trick, do you try pure pdo for get 50 records on same server, cauz 1.17s is still soooo big
Jr.Pikong
Jr.PikongOP10mo ago
Yes, that's right, but with the optimization that has been done, I think it's ok, we can apply a smaller limit, for example, 10 data, and apply a filter. with the advantages that filament has, it can still be accepted, while waiting for the latest version of Livewire which is better.
Want results from more Discord servers?
Add your server