Thursday, May 15, 2008

Apache 2 Compression with mod_deflate

Today, after a report from one my users that the our APEX application was getting "slower", I decided to implement mod_deflate for content compression. The performance is noticeable faster! I went with mod_deflate since is included in the Apache 2.0.x source package. Here is what I added to my httpd.conf:

LoadFile /usr/lib/libz.so
LoadModule deflate_module modules/mod_deflate.so

<IfModule mod_deflate.c>
# Insert filter
SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
# Don't compress images
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png|htc|wsdl|exe|t?gz|bz2|sit|rar|pdf|zip)$ no-gzip dont-vary
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>

After that I all did was a quick
opmnctl restartproc ias-component=HTTP_Server
and voila!

For more information on mod_deflate go to http://httpd.apache.org/docs/2.0/mod/mod_deflate.html

16 comments:

Dimitri Gielis said...

Cool to see another Apex Blog.

John Scott said...

Yep, nice to see another APEX related blog out there.

BTW I also wrote a whitepaper last year on configuring mod_gzip and mod_deflate in relation to APEX apps, available here:

http://jes.blogs.shellprompt.net/2007/05/18/apex-delivering-pages-in-3-seconds-%20or-less/

Thanks,

John.

james said...

hi! i like the designs. check out the source of the template.
Thank you! i love it.
More templates easy to download

Sildenafil Citrate said...

I can recall that same issue when I was using your APEX application, but I did not have time to call you guys or send you an email, a friend helped to solve the issue anyway

Livrare Flori said...

It's great to see how you give us cool things that makes our jobs easier.

alfred said...

This is similar to the web-server idea and will still require Apache to be installed. Because it is just an FTP server (a place for you to store your files remotely) you will not need to setup any other complicated things like PHP or MySQL etc.

apache jobs

Math Classes Sydney said...

The learning lab is providing the best Maths and English tutor in Sydney and if you are looking for maths tutor for your child contact us now!

Melisa Marzett said...

The performance is noticeable faster! I like the way you work - it's very convenient to use your article to implement mod_deflate for content compression. There is one more question for you... who can write my paper for me?

ecommerce web developer said...

Many websites has good collection of information but this one has great collection and combination of information.ecommerce web developer

funwirks.com said...

I know your expertise on this. I must say we should have an online discussion on this. Writing only comments will close the discussion straight away! And will restrict the benefits from this information.funwirks.com

line icons said...

Thanks a ton for sharing your knowledge! It is great to see that some people still put in an effort into managing their websites. I’ll be sure to check back again real soon.line icons

http://heyprints.com/ said...

I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you.http://heyprints.com/

currency exchange rates said...

A healthy diet is not about strict nutrition philosophies, staying extremely thin, or depriving yourself of foods you love. Rather it is to get that good to have more energy and you keep healthy as possible.currency exchange rates

texas ecommerce web development said...

Pues la verdad, tampoco hay que agacharse mucho, ¿no? para darle la vuelta a la carne de vez en cuando y ya está... Es que nosotros las veces que habíamos hecho barbacoas era en el fuego a tierra, así que también nos teníamos que agachar.texas ecommerce web development

dallas web designer said...

Good website! I truly love how it is easy on my eyes it is. I am wondering how I might be notified whenever a new post has been made. I have subscribed to your RSS which may do the trick? Have a great day!dallas web designer

cheap money transfer said...

Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you could do with some pics to drive the message home a little bit, but other than that, this is great blog. A great read. I will certainly be back.cheap money transfer