Hostgator and Compression

I posted a question and got no response and search the forum for ‘hostgator’ one of the world’s biggest hosting companies and found ‘Sorry, but no results were returned using the query information you provided’

Hostgator doesn’t support mod_gzip or gzip, as far as I know, with their shared plans.

What should a good fellow do to get good text and image compression?

Wow, that’s almost criminal at this point. (sorry, was swamped so I didn’t get a chance to reply to your earlier post).

Assuming you aren’t willing to switch hosting providers at this point there are a few things you can do:

  • Use a CDN for your static assets. Most will auto gzip for you (MaxCDN does and is quite reasonably priced)
  • If you main page is php you can use php’s built-in support for gzipping but that will only work for things that are php

Images don’t get gzipped so you don’t have to worry about those (though they would also benefit from being served from a CDN).

Do you pay for bandwidth at hostgator? If so I could see why they might not have incentive to enable compression because it would reduce the used bandwidth significantly. I know both Dreamhost and Bluehost support gzip and have it enabled by default.

Thanks for the comparison on host companies. I’ll check them out.

Have you heard of a form of compression using a php.ini ? I have no idea what it involves.

If your entire site is cached all the time, and the pages load fast, what would the benefit of CDN be?
Also, there is a free CDN with pluggin http://www.coralcdn.org/plugins

It didn’t do my site much good, but MAXCDN said because several pages are loading offsite, CDN wouldn’t help anyway.

I spoke to Max and they said $40/1st yr for 10GIG and $100/year for thereafter. They have a money back deal, and require that you use W3 or was it supercache, neither work well, in fact slow down uncached pages on my site. What can I say?

Anyway, thanks for answerin the question

CoralCDN isn’t much of a CDN for performance, they are better at dealing with load spikes but suck for performance.

I’m taking it that your site is wordpress-based given the plugins MaxCDN suggested. If so, there are a couple of ways to get gzip enabled for the php content.

In wordpress itself: visit your wordpress options.php (yourdomain.com/wp-admin/options.php) and enter ‘1’ in the field of gzipcompression (1 stands for true, 0 is false).

In .htaccess: php_flag zlib.output_compression On

Unless I’m missing something, the pricing MaxCDN gave you doesn’t look right: http://www.maxcdn.com/pricing.php (it’s 1TB instead of 10GB). You don’t want to use a push zone, use pull zones and have it pull the content from your servers. Are the pages that load offsite also from HostGator? If not and you’re having gzip problem with them you should be able to get those addressed.

It also looks like they recommend W3 but any CDN plugin that does the url rewriting will work because of how pull zones work. It looks like the My-CDN plugin will do JUST the CDN url rewriting if you don’t want any of the other things W3 does.

The way pull zones work is that you assign a domain to MaxCDN (or they give you one but I usually like to have my own host names) and you configure MaxCDN with where the REAL pages are served from.

For example, I have cdn.webpagetest.org configured as a pull zone on MaxCDN that is configured to get it’s content from http://www.webpagetest.org/ - that way any content on webpagetest can be pulled from a CDN just by changing the url to refer to cdn.webpagetest.org instead of www.webpagetest.org.

When the browser requests http://cdn.webpagetest.org/js/jquery.min.js it goes to the closest MaxCDN server and if the server doesn’t already have it, it goes back to webpagetest and downloads it. It also handles sending it compressed back to the browser and keeps it local so the next time it is requested it can be served directly from the CDN (until the file expires).

This is my site test. I see no compression improvement after making the options.php change
http://www.webpagetest.org/result/100611_258e436e2f52336094d750983570f1bd/

Thanks

If you look at the first 2 requests they are being gzipped - http://www.webpagetest.org/result/100611_258e436e2f52336094d750983570f1bd/1/performance_optimization/

That is all that the php is responsible for, the rest are static files and unless you can get mod_deflate working you would either need to use a CDN to do it for you or use a wordpress plugin that would take care of combining and compressing them.

Patrick - I already use Minify and like it. I am battling some on minifying external js and css files. Tends to mess things up.

Hostgator says they offer Gzip, but it appears that the speed comes from the ‘MOD’ which they don’t offer on a shared plan. I went a gzip some stuff throught the CPanel, but I don’t think it changes anything.

This is from YSLOW: “If you use Apache, the module configuring gzip depends on your version: Apache 1.3 uses mod_gzip while Apache 2.x uses mod_deflate”

Right, to enable gzip you would need for them to have mod_deflate enabled on their apache install and from what I can tell they don’t have it enabled for their shared hosting plan.

Something like MaxCDN would be able to do the compression even if Host Gator doesn’t because they would be serving the files even if it is hosted on Host Gator (using a pull zone and a plugin that would rewrite the urls to go through the CDN).

Dreamhost and bluehost both have mod_deflate enabled on their shared hosting plans so it’s a shame that host gator is choosing not to. Maybe if enough people left and said they were leaving because of it they might actually do something but I don’t expect that to really happen.

If you want to stay with host gator you have a few choices:

  • Switch to one of their VPS plans where they do allow it (I can’t say I’d recommend rewarding them for their behavior by giving them more money though)
  • Use a CDN to front your site and take care of GZip for you (among other performance benefits you’d get)
  • Find a Wordpress module that would serve the external files through php allowing you to compress it in php instead of at the apache layer

Patrick I am on box 519 at bluehost and 90% of the time BH dose zip the content, they tell me it has something to do with the CPU.

This test shows compressed http://www.webpagetest.org/result/100612_2NC/

And this test shows not compressed, test where only minutes apart.
http://www.webpagetest.org/result/100612_2NH/

Thank you for providing so much useful info, my head is spinning.

I have stuck with hostgator primarily for the tech support in wordpress.

Most tech have a good knowledge while I called, I think it was blue (Maybe dream didn’t even have a #) and just to get the version Apache and if they offer the ‘mod’ was an issue. I asked their tech if I had an issue getting a custom cron or script to work could they help if they knew how and the answer was NO.

Hostgator has helped me so much and save me so much in custom advise, it’s been awesome. But, I’m also now monitoring with a service downtime http://www.pingdom.com give 1 free account as I’ve been concerned about zero hits in the wee hours of the morning, white Britain is hard at work, we sleep, Ahhh

I tried the free CDN and it almost crashed my site. Maybe I did it wrong, but I’m hestitant now.[hr]
Dayton, how did you get such a high score on the ‘no etags’? I’ve tried changing the .htaccess with

disable etags

FileETag none

But I don’t know if it makes much difference

I also use this below, but really have no clue what works

<FilesMatch “.(gif|jpg|js|png|ico|css)$”>
ExpiresActive On
ExpiresDefault “access plus 10 years”

This is what I have Graham
Header unset ETag
<FilesMatch “.(gif|png|jpg|jpeg|js|swf|bmp|ico)$”>
ExpiresActive On
ExpiresDefault “access plus 2 years”
Header set Cache-Control “public, no-transform”

    <FilesMatch "\.(xml|txt|html|js|css)$">
           ExpiresActive On
	ExpiresDefault "access plus 2 months"

Header set Cache-Control “public, no-transform”

Hello Dayton. I inserted your code into my .htaccess file and, while it didn’t do anything for my “NoEtags” score…it worked wonders for my “Cache Static Content” score. I thank you for the code.

Tom

Unless you’re running a multi-server load balanced site (which you aren’t on shared hosting) I wouldn’t worry about looking at the ETags at all. It is only a potential problem for multi-server installs (not sure I even want to continue checking for it which is why it is not exposed in the main grades).

Well…apparently they do. I just talked with Hostgators tech support (via chat) and was assured that they did, in fact, support both mod_gzip and gzip on their shared hosting servers. The guy then went on to say that “Compression would not really help loading speed. It is very situational, actually.” Right then I knew I was in trouble. I said, “There seems to be a whole host of “geeks” online who disagree with you and swear that text compression will speed up loading time.” Then he gave me a link to this site http://www.samaxes.com/2008/04/htaccess-gzip-and-cache-your-site-for-faster-loading-and-bandwidth-saving/ which contains some code snippets. I added the code for gzip to my .htaccess (attached here) and loaded onto my server…ran the test again and saw no improvement in the “Compress Text” score. Would you take a look at my .htaccess file and see if I made any errors. Many thanks.[attachment=51]

Just FYI…I just finished talking at length by phone with Hostgator tech support and was assured that Persistant Connection - Keep Alive was enabled on their shared hosting servers by default. I steered him to your site and had him run the test for himself and, sure enough, he got the same results. No explanation for the low score for “Keep Alive” was forthcoming…a service tickets was started…more later.

Depending on the version of Apache they are using it will be mod_gzip (1.x) or mod_deflate (2.x). Looking at the response headers from your test earlier in the thread it looks like they are on 2.2.15:

Server: Apache/2.2.15 (CentOS) mod_ssl/2.2.15 0.9.8l DAV/2 mod_auth_passthrough/2.1 FrontPage/5.0.2.2635

The is useless since 2.2 doesn’t use mod_gzip.

For mod_deflate it should look more like this:

AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript

but that is assuming they have it installed (and given the quality of answers you have received so far I’d be worried).

Finally…a definitive answer from Hostgator. Here’s what they said: “As you can see at http://support.hostgator.com/articles/pre-sales-questions/compatible-technologies mod_gzip and mod_deflate are only for VPS and dedicated servers. It is not best to use persistent connections as they are set to be killed off if they go over 15 seconds though you are able to change this on VPS and dedicated servers.” Obviously the tech support team missed that memo. :blush:

Needless to say, I’m currently host shopping. Many Thanks.

Tom

Wow, I added the cache code in my htaccess with modification to plus 1 month and BAM - almost an immediate page load on return. Thanks so much for sharing. I assume if changes are made to the web page, these changes can be seen within the cache expiration date (eg user visits today, website has a change later today, user visits tomorrow and then see the modification made to the site).

Depends on the change and how your site works. If a given file (image, css, javascript) changes and is set to cache then the users will NOT see the change and could potentially experience a broken site.

You need to change the file name of resources for users to get the updated version. Most plugins that do the acceleration for you will take care of it automatically but if you just manually set the expiration in .htaccess you should change it back until you fully understand the ramifications for your site (images are usually not a problem - though logos sometimes change - css and javascript are usually the ones you want to watch out for).

Thanks Patrick. Text will probably the major changes on the pages and with this htaccess setup, you’d say the users will see the changes?