Good day. I have a multifunctional site. I'm thinking about optimization, as the site loads> 5 seconds, which is not good. The site uses both images from its server, and from someone else. There is no opportunity to transfer all the images to yourself, since there are more than 4000 of them (of course, not all are used on the page). I tried caching, compressing my images, cloudflare, minimizing js, css. Anyway, the speed does not suit, maybe there are any other methods? Oh yes, I use the Laravel framework
- oneI can not understand where is the photo from another server and the speed of page return by the server? Can you write something more? what's going on with you? Do you use barryvdh / laravel-debugbar? What do you have there for database requests? - Orange_shadow
- oneThe client does not have to pull pictures and scripts that he previously downloaded and that did not change on the server. And this happens on most web servers automatically if the links are static. And the formation of the page 3 seconds into any gate does not climb, it is necessary to analyze the code of the server part of the application to reduce the time of formation of the page - Mike
- onePut the component run Debugbar see where you have shoals with queries, 3 seconds is hard. Look, the server may not be configured, nginx if you need to see how the file upload is configured , there must be an instant couple of milliseconds of response - Orange_shadow
- oneWell, if from 3 seconds, it became 430 ms that is certainly better :) It remains for you to work with requests - Orange_shadow
- oneAnd he is so vital to you? Is it possible to execute this info after loading the page using an ajax request and cache this request for at least 10 minutes at least? Or is accuracy so important to you? then I would advise on the trigger which thread the table should put in the number of rows :), and another question and is that table indexed by the field that you are counting or filtering? - Orange_shadow
|
1 answer
1) Set barryvdh / laravel-debugbar for the intrusion of "long" requests
2) Check server settings, especially how static files are given.
3) If there are "heavy" requests to solve this problem in one of the ways:
- cache request for valid range
- if possible, make part of the code associated with this data, in a separate request, after the page is displayed.
- also check the indexing of the table for the columns that are filtered and count the number of
- or create a table with data that will store the values of such queries, but update on the triggers changes in these tables
- I’ll appeal to you again. I’ve encountered this problem again. I’m unable to understand why this happens for the user who first visits the site for a very long time. I clear the cache, I go to the site for 1-2 seconds and the page is loaded. And the others have at least 10 seconds. The problem is global, about half of the new users have such a problem. What other options might there be? - Ilya78rus
- And how much do your scripts weigh? Requests you watched? Try setting the long requests in the database settings. - Orange_shadow
- 2.6 mb I do not have long casts (if I drop the entire cache), since I’m not going to repeat the problem for everyone - Ilya78rus
- Images take 1.6 mb, and there is no way to remove them - Ilya78rus
- I do not understand, and what do you give the images through the path? Well, in terms of not directly? and through file_get_contents? Why do images slow down the system? Or do you reduce them on the go? what's wrong with them? - Orange_shadow
|