questions about compressing web page downloads with Gzip

M

Mike S

I just read an article about speeding up web page downloads using
compression:

http://webdesign.about.com/od/speed/ht/website-compression.htm

The article includes the url of a compression test site:

http://www.gidnetwork.com/tools/gzip-test.php

I work on several PHP sites that I could use this on if it's beneficial,
but I thought I'd ask for suggestions here first. Does anyone have
experience using this, and is there a down side? Are there more settings
available than the article mentions, since the increasing levels of
compression have decreasing returns is it possible to choose the level
of compression you want?

TIA,
Mike
 
I

id|e

I just read an article about speeding up web page downloads using
compression:

http://webdesign.about.com/od/speed/ht/website-compression.htm

The article includes the url of a compression test site:

http://www.gidnetwork.com/tools/gzip-test.php

I work on several PHP sites that I could use this on if it's beneficial,
but I thought I'd ask for suggestions here first. Does anyone have
experience using this, and is there a down side? Are there more settings
available than the article mentions, since the increasing levels of
compression have decreasing returns is it possible to choose the level
of compression you want?

TIA,
Mike

http://www.whatsmyip.org/http_compression/phpgzip/
;) Easy stuff.
Test it out.
http://www.whatsmyip.org/http_compression/
 
M

Mike S

One thing to note: The php code must go above everything else in the php
document /including/ the DOCTYPE.
Thanks Ed,

The author of whatsmyip.org made that clear. He also mentioned,

"The advantages (of mod_deflate) are that you don't have to add more
code to every page. Plus it will compress things like css and JavaScript
and XML too. And "they" say that mod_deflate is slightly faster than
compressing in php."

Do you know of any modern browsers that have an issue with mod_deflate,
if I can get the ISPs to enable it that is?

Thanks,
Mike
 
R

rf

Mike S said:
I just read an article about speeding up web page downloads using
compression:

http://webdesign.about.com/od/speed/ht/website-compression.htm

The article includes the url of a compression test site:

http://www.gidnetwork.com/tools/gzip-test.php

I work on several PHP sites that I could use this on if it's beneficial,

Why do you think it might be beneficial?

Let's look at http://www.gidnetwork.com/tools/gzip-test.php for example.

There is 5KB of HTML on that page of which only 3K comes from gidnetwork.

There is 12 KB of CSS.

There is a massive 220KB of javascript, only 2KB comes from gidnetwork. The
rest comes from all over the place, from sources that gidnetwork probably
have no control.

So, out of a total of 244KB of downloaded stuff gidnetwork can only compress
19K. The rest is out of their control. If they can compress their 19K to a
half they have saved 9.5KB out of a total of 244KB. A saving of 3.8%.

And what is the overhead in time of sending that extra 9.5KB? My ISP
downloads stuff to me, once the connection is made, at over 5 megabytes per
second. That 9.5KB would take about an extra 4 milliseconds. But, it takes
me at least 30 milliseconds to make a connection to a local web site. For a
site that is in the US (which I assume gidnetwork is) it takes me at least
300 milliseconds for the round trip. 4 milliseconds extra over and above 300
milliseconds is not much.

Is it really worth it?
 
N

Neredbojias

Why do you think it might be beneficial?

Let's look at http://www.gidnetwork.com/tools/gzip-test.php for
example.

There is 5KB of HTML on that page of which only 3K comes from
gidnetwork.

There is 12 KB of CSS.

There is a massive 220KB of javascript, only 2KB comes from
gidnetwork. The rest comes from all over the place, from sources that
gidnetwork probably have no control.

So, out of a total of 244KB of downloaded stuff gidnetwork can only
compress 19K. The rest is out of their control. If they can compress
their 19K to a half they have saved 9.5KB out of a total of 244KB. A
saving of 3.8%.

And what is the overhead in time of sending that extra 9.5KB? My ISP
downloads stuff to me, once the connection is made, at over 5
megabytes per second. That 9.5KB would take about an extra 4
milliseconds. But, it takes me at least 30 milliseconds to make a
connection to a local web site. For a site that is in the US (which I
assume gidnetwork is) it takes me at least 300 milliseconds for the
round trip. 4 milliseconds extra over and above 300 milliseconds is
not much.

Is it really worth it?

I tried the line on one of my existing pages. Compressed ~40k down to
under 10k but there is roughly 25-30k loaded in remote css and js
files. Anyway, the compressed file loaded slightly *slower* (-very
slightly) than the other (which is an .html file and that might matter.
I didn't bother comparing .php to .php because I'm not going to do it
after seeing the test.) I suppose on a *very* slow connection there
might be a positive benefit but that would be moot since it's a video
page.
 
M

Mike S

I tried the line on one of my existing pages. Compressed ~40k down to
under 10k but there is roughly 25-30k loaded in remote css and js
files. Anyway, the compressed file loaded slightly *slower* (-very
slightly) than the other (which is an .html file and that might matter.
I didn't bother comparing .php to .php because I'm not going to do it
after seeing the test.) I suppose on a *very* slow connection there
might be a positive benefit but that would be moot since it's a video
page.

You and rf raise a good point. Maybe you missed the post where I quoted
the author of whatsmyip.org, who mentioned,

"The advantages (of mod_deflate) are that you don't have to add more
code to every page. Plus it will compress things like css and JavaScript
and XML too. And "they" say that mod_deflate is slightly faster than
compressing in php."

But not all ISP's let you enable mod_deflate, and I have web pages that
contain a lot of text, that do download noticeably faster using
ob_start("ob_gzhandler");

But as you point out it's not appropriate to every situation.

Mike
 
N

Neredbojias

You and rf raise a good point. Maybe you missed the post where I
quoted the author of whatsmyip.org, who mentioned,

"The advantages (of mod_deflate) are that you don't have to add more
code to every page. Plus it will compress things like css and
JavaScript and XML too. And "they" say that mod_deflate is slightly
faster than compressing in php."

But not all ISP's let you enable mod_deflate, and I have web pages
that contain a lot of text, that do download noticeably faster using
ob_start("ob_gzhandler");

But as you point out it's not appropriate to every situation.

Yes, I checked that on the server and mod_deflate is explicitly
enabled. As you say, though, a really large text page (or several in a
row) would probably show some speed improvement.
 
D

Dylan Parry

rf said:
Why do you think it might be beneficial?
...
Is it really worth it?

The only real benefit I see is that it could help reduce your own
bandwidth costs as you'd be sending less data to the user from your
server. Of course this is probably only worth it if you are using lots
of bandwidth, yet processor usage isn't causing any issues.

The benefit to the end user, i.e.. the visitor, is probably negligible
or nonexistent, but there may be benefits to you personally as the site
owner.

As always, YMMV!
 
J

Jonathan N. Little

Neredbojias said:
I tried the line on one of my existing pages. Compressed ~40k down to
under 10k but there is roughly 25-30k loaded in remote css and js
files.

You can compress those as well, either in your httpd.conf if you have
control, or in an .htacess file:

# Compress JS & CSS
AddOutputFilterByType DEFLATE text/css text/javascript

# Why not other text files
AddOutputFilterByType DEFLATE text/html text/plain text/xml
 
M

Mike S

You can compress those as well, either in your httpd.conf if you have
control, or in an .htacess file:

# Compress JS & CSS
AddOutputFilterByType DEFLATE text/css text/javascript

# Why not other text files
AddOutputFilterByType DEFLATE text/html text/plain text/xml

Thanks for mentioning that!
 
J

Jonathan N. Little

Mike said:
On 9/2/2010 6:16 AM, Jonathan N. Little wrote:

Thanks for mentioning that!

Depending on your sever setup for javascript you may also need:

application/x-javascript
 
N

Neredbojias

You can compress those as well, either in your httpd.conf if you have
control, or in an .htacess file:

# Compress JS & CSS
AddOutputFilterByType DEFLATE text/css text/javascript

# Why not other text files
AddOutputFilterByType DEFLATE text/html text/plain text/xml

I'll have to try that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top