Loading pages and images are really slow

Solved
brianh

Nov 10th, 2023 01:06 PM

Hello again,

I am having a rather odd issue. I have published my application using Laravel Forge. The app is working great however suddenly the loading of my users profile image in the header is slow. In the performance console I can see the image takes 5.1 seconds to load.

When I run the same app on my local environment it is instant.

How can I troubleshoot this?

bobbyiliev

Nov 13th, 2023 05:49 AM

Hi there Brian,

What I could suggest is to open your web console, and then go to the network tab, after that sort by images and see which image exactly is taking so long to load.

It sounds like it might be the size of the image that is causing the problem.

Let me know if this is the case!

deferred-tech-debt

Nov 19th, 2023 09:28 PM

Hi Brian,

I am not an expert in Laravel Forge, but this looks to me performance issue irrespective of any language or framework. I have tried to summarize the approach I took in my past to resolve this type of issue. Please give a try, it should increase the performance.

1 - While uploading the profile picture, compress it and save (or save a copy). image compression is usually available in all languages / framework.

2 - If you are using any cloud solution, you may easily store it adding some prefix like 'dx_'.

3 - If you are using cloud, you can easily get a downloadable URL to bind it in UI page, where you want to show the same.

4 - If not cloud, create an API to pull the compressed image or its base64 version.

To view profile pic in a web site or mobile app, don't need to mor than 2mb. It is better to use compress version. I found the GIT project to optimize images, hope this help. https://github.com/spatie/laravel-image-optimizer

brianh

Nov 20th, 2023 11:18 AM

Best Answer

Hi Guys,

Thanks for the feedback. I found the issue and luckily in this case it was an issue with the hosting provider.

All is well and thanks for the support.

Report
1
bobbyiliev

Nov 23rd, 2023 12:44 AM

Hey!

Nice, happy to hear that you've got it all sorted out 👏