Answer the question
In order to leave comments, you need to log in
Static HTML compression and templates?
For client-side optimization, static or dynamic file compression using the gzip method is often used . There are no questions with dynamic on-the-fly compression, everything is clear: we turn on the appropriate directives in the server settings and it compresses it before sending the response.
With static compression (when we pre-compress all the files ourselves and put them on the server), there are no questions only regarding CSS, JS and static pages. Is it possible to somehow combine static compression and a dynamic site (i.e. the HTML code is generated by a PHP script that takes Smarty templates and substitutes data into them)?
This whole question is about the fact that dynamic compression can quickly eat up all the server resources.
UPD:the question was of interest purely theoretically, it is clear that in reality such a problem is not worth it. Thanks to all.
UPD2: I understand that the question sounds somewhat absurd (it is not clear what can be compressed if the site is dynamic), but let's look at the details. Smarty compiles templates in advance - this is a kind of cache No. 1. Some kind of bytecode cacher (the same APC) caches scripts. And if there is already some “compiled / cached” version for the received request, then it is returned. Those. It turns out that even for a dynamic site, in some cases there are some conditionally static files, right? So I’m wondering, maybe they came up with some techniques that neatly compress such files without violating the integrity of the entire system (the work of Smarty, APC, etc.)
Answer the question
In order to leave comments, you need to log in
Why do you need compression? Do you want to save on traffic or upload speed?
In theory, you can’t do it in any way, except as a module for the web server.
I don’t understand something, how can dynamic compression quickly eat up all server resources? I took a 65kb page, multiplied it to 64 megabytes in one file, measured the speed: 25 megabytes per second, which is 384 original pages per second. Do you have at least 20 generated per second?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question