After a lot of reading and coding, I managed to get a 100% grade on “Google Speed” for one of my websites, it worked a few months but lately I was shocked to see an old error that I have fixed emerging again: “Enable compression”, I have indeed told Apache to use mod_deflate to compress html, css and js files before sending them to users. After – again – a lot of reading, coding and testing I couldn’t find a solution that works so I contacted Hosmonster.
1st Chat with HM support:
mod_gzip and mod_deflate are enabled on servers, there is nothing we can help with since the modules are already enabled and working
2nd Chat, Now I understand:
This time I was smart enough to save the chat session:
[4:42:07 PM] I would like to know if HM enables mod_deflates and mod_gzip (apache modules)
Jolynn: [4:42:25 PM] Let me check
[4:45:33 PM] Just another moment
ME..: [4:46:59 PM] OK
Jolynn: [4:47:57 PM] Currently, mod_deflate is installed on all servers. No configuration options are available to our customers. mod_deflate checks with cpud to see whether it should be compressing files. If cpud dictates that the system doesn’t have enough resources, compression will not happen
ME..: [4:49:21 PM] Oh I see – where could I read more info about it – I mean how HM deals with it
Jolynn: [4:50:22 PM] This is the last bit of info that I have
[4:50:24 PM] Another thing to keep in mind is that the gzip compression that mod_deflate implements adds an output buffer that won’t flush until the entire response has been written. This means that if a customer flushes output to the browser from inside php (using the flush function), it gets flushed to mod_deflate and not to the browser. This has to do with the way that gzip works.
After more chat sessions with HM support – yes you need to talk a lot, a representative told me
Lonny: [4:01:52 PM] Sorry, but it is server-wide. The compression will only happen when there isn’t a lot of CPU load.
I’m not sure what the threshold is but it doesn’t seem to be very large [lol, I thought he said a lot of CPU load] before the compression cuts off.
I’m not sure I understand all of this, but I understand that it’s time for me to move to a better hosting provided probably HostGator which offer a better support, and maybe it’s time to upgrade from shared hosting to VPS… We’ll see…