简体   繁体   中英

My Laravel Website is very slow How can I make it fast?

I have build a matrimony website using laravel but now I am facing a problem with loading time. It's look lot of time to load. First I thought it's because of lot's of query but I have optimize the query to make it's fast but it's quite same. And it's same both on my local and server. What can I do that for it?

It is very difficult to answer why a Laravel website is slower. There are many reasons behind a slower Laravel application. You have to debug and take decisions where you need to improve in your application. Here a list I focus on when I develop an application.

1. Database

How may database query load on each page? you have to ensure any recursive query not exist. Make efficient data cache. Check queries takes a little time to execute.

2 Network Connection

If you are using different network connections with your Redis, database, queue then make sure those connections are well optimized and taking a little time to connect and serve data.

3. Cache Files

Make Cache you blade HTML files, routers, config files, and optimize those cache. Also, reduct autoloads services as much as possible.

4. Optimize your Images

Optimize your images. I recommend not to use local files. try to use a cloud service.

5. Minify CSS and JS file

You should minify your CSS and js files. and try to use libraries from CDN.

6. Use Queue

Use queue where possible like email send, PDF Generate...

First try to remove CSS and Javascript files which are not necessary for each page.

Second use image thumbnails (when you upload image, create thumbnails of every image), for displaying all images call image thumbnails.

Third try to remove join from your queries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM