look at pic 3
Time in seconds, this adsl line 2.5Mb
So, what do we have? There are 37 requests and 18 seconds. of time. Lot!
The first request is actually html itself (if <1 sec = do not touch)
then send css, js and pictures
as you can see from the screen, the pictures are given in parallel, but css and js are not !
Conclusion one: Reduce the number of requests for css and js
In the fifth drupal, the css compression chip into one file is a build-in, that is, just go to performance and set it up there.
look rice one
Instead of 9 file requests and 6 seconds. we receive 1 request and 1.5 seconds of time. Not bad… :)
Now turn js.
Download the javascript_aggregator module - instalim, and get the same feature in js for the same js
look rice 6 and see that all our js files now take only 1.5 seconds. instead of the same 6 seconds. Almost good ... :)
It is also possible to add to the number of requests that if you have a lot of similar images on the site (icons, pictograms)
It is worth looking in the direction of css sprites. That is, all these pictures are shoved into 1 file in a row, and then in css for the right place we do offset. As a result, we have 1 query instead of 5-10.
And finally, if you have a digg level site, insert all your css and js inline in html, this will save 2-3 more requests. (Yes, they are not cached, but so much faster. + You can insert them on internal pages when the pictures are already in the cache)
Forget about any ob_start ("ob_gzhandler");
Why bother php and yourself if you can compress all the web server automatically?
Put \ turn on mod_deflate or mod_gzip for apache and that's it! all your content will be compressed automatically (almost :)).
(php compression rolls only if there are no rights to edit the apache)
We look and compare rice. 3 and Fig. 6. (first request)
in one case 22kb and in another 6kb. almost 4 times!
This monster begins to terribly slow down under heavy loads.
To upload pictures (and the same css, js, flash, etc.) use the nginx web server
There are 3 options for setting it up:1 option:
separate subdomain for staticsOption 2:
like a front end3 option:
as the primary (single) web server
Source: https://habr.com/ru/post/19647/
All Articles