Search: For:
Browsing Single Category

so you want mod_gzip for your MOD_PLSQL Oracle AS?

Topic ID: 3059
Created By: 2008-FEB-26 19:14:55 [Vitaliy]
Updated By: 2008-FEB-26 19:15:07 [Vitaliy]
Status: Open
Severity: Normal
Read Only: No
8948
2008-FEB-26 19:14:55
Moderator
 
 
Registered On: Mar 2006
Total Posts: 194
Premise
I've always wanted to setup all of our Oracle AS installations with GZIP 
compression -- "Content-Encoding: gzip".  Oracle's take on this is that 
they do not provide mod_gzip.so with their Application Server distros --
instead recommending to use Oracle WebCache in front of AS.  Yeah right 
that's exactly what I will do ... not really.

Don't get me wrong Oracle WebCache is not bad -- I have quite a bit of 
experience with it since we are running Oracle Portal for our Customer 
Support site and I've setup WebCache in the DMZ strictly for the purpose of 
maintaining SSL certs outside of Oracle AS.

But to willingly setup Oracle WebCache just to be able to use GZIP 
compression is just ridiculous suggestion especially considering that there 
are great solutions available for Apache such as -- mod_gzip.
Installing mod_gzip on ORACLE
The first thing you need to realize is that Oracle does not directly 
support mod_gzip.so (or any other 3rd-party module for that matter) with 
the version of their Oracle AS.

They do however say that they will support Oracle AS that has mod_gzip.so 
configured but "might" require a customer to disable it if they suspect 
it's causing problems during troubleshooting.

I have been holding off on this for while until I saw that ASKTOM is now 
happily running GZIP compression on their APEX based site which pretty much 
gave me the green light to try it.

Here are the step by step instructions on compiling and installing mod_gzip 
on Oracle EL 4.6 32bit:

## download mod_gzip
##
http://sourceforge.net/projects/mod-gzip/
get mod_gzip-1.3.26.1a.tgz


## modify apxs (the one that ORACLE shipped with this Linux distro is from SOLARIS -- WTF!)
##
vi $ORACLE_HOME/Apache/Apache/bin/apxs
-------- change as follows -----
##my $CFG_CC            = q(cc -O -xildoff  -DMACHINE64  -DNO_RC2 -DNO_RC5 -DNO_IDEA -DBSAFE -KPIC);                # substituted via Makefile.tmpl
my $CFG_CC            = q(cc -O -DMACHINE64  -DNO_RC2 -DNO_RC5 -DNO_IDEA -DBSAFE);                # substituted via Makefile.tmpl
##my $CFG_CFLAGS        = q( -DSOLARIS2=260 -DMOD_SSL=206104 -DMOD_PERL -DUSE_PERL_SSI -I/include -DEAPI -DUSE_EXPAT -I../lib/expat-lite `../apaci`);            # substituted via Makefile.tmpl
my $CFG_CFLAGS        = q( -DMOD_SSL=206104 -DMOD_PERL -DUSE_PERL_SSI -I/include -DEAPI -DUSE_EXPAT -I../lib/expat-lite `../apaci`);            # substituted via Makefile.tmpl
##my $CFG_CFLAGS_SHLIB  = q(-KPIC -DSHARED_MODULE);      # substituted via Makefile.tmpl
my $CFG_CFLAGS_SHLIB  = q(-DSHARED_MODULE);      # substituted via Makefile.tmpl



## create the shared object file mod_gzip.so
##
cd /u01/app/oracle/work
gunzip mod_gzip-1.3.26.1a.tgz
tar xvf mod_gzip-1.3.26.1a.tar

cd /u01/app/oracle/work/mod_gzip-1.3.26.1a
PERL5LIB=$ORACLE_HOME/perl/lib; export PERL5LIB
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/app/oracle/work/mod_gzip-1.3.26.1a; export LD_LIBRARY_PATH

make APXS=$ORACLE_HOME/Apache/Apache/bin/apxs

EXAMPLE OUTPUT:

   /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/bin/apxs -Wc,-Wall,-O3,-fomit-frame-pointer,-pipe -c mod_gzip.c mod_gzip_debug.c mod_gzip_compress.c -o mod_gzip.so
   cc -O -DMACHINE64  -DNO_RC2 -DNO_RC5 -DNO_IDEA -DBSAFE -DMOD_SSL=206104 -DMOD_PERL -DUSE_PERL_SSI -I/include -DEAPI -DUSE_EXPAT -I../lib/expat-lite -DSHARED_MODULE -I/u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include -Wall,-O3,-fomit-frame-pointer,-pipe  -c mod_gzip.c
   In file included from /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/httpd.h:438,
                    from mod_gzip.c:96:
   /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/ap_oracle_version.h:17:8: warning: extra tokens at end of #endif directive
   mod_gzip.c: In function `mod_gzip_sendfile2':
   mod_gzip.c:5262: warning: unused variable `ok_to_send'
   mod_gzip.c: At top level:
   /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/ap_oracle_version.h:14: warning: 'oracle_version_string' defined but not used
   cc -O -DMACHINE64  -DNO_RC2 -DNO_RC5 -DNO_IDEA -DBSAFE -DMOD_SSL=206104 -DMOD_PERL -DUSE_PERL_SSI -I/include -DEAPI -DUSE_EXPAT -I../lib/expat-lite -DSHARED_MODULE -I/u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include -Wall,-O3,-fomit-frame-pointer,-pipe  -c mod_gzip_debug.c
   In file included from /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/httpd.h:438,
                    from mod_gzip_debug.c:94:
   /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/ap_oracle_version.h:17:8: warning: extra tokens at end of #endif directive
   /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/ap_oracle_version.h:14: warning: 'oracle_version_string' defined but not used
   cc -O -DMACHINE64  -DNO_RC2 -DNO_RC5 -DNO_IDEA -DBSAFE -DMOD_SSL=206104 -DMOD_PERL -DUSE_PERL_SSI -I/include -DEAPI -DUSE_EXPAT -I../lib/expat-lite -DSHARED_MODULE -I/u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include -Wall,-O3,-fomit-frame-pointer,-pipe  -c mod_gzip_compress.c
   In file included from /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/httpd.h:438,
                    from mod_gzip_compress.c:92:
   /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/ap_oracle_version.h:17:8: warning: extra tokens at end of #endif directive
   /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/include/ap_oracle_version.h:14: warning: 'oracle_version_string' defined but not used
   ld -G -o mod_gzip.so mod_gzip_compress.o mod_gzip_debug.o mod_gzip.o -o mod_gzip.so
   hostname-> echo $?
   0
   hostname-> ls -lta | head
   total 504
   drwxr-xr-x  3 oracle oinstall   4096 Feb 26 15:13 .
   -rw-r--r--  1 oracle oinstall  20068 Feb 26 15:13 mod_gzip_compress.o
   -rwxr-xr-x  1 oracle oinstall  61560 Feb 26 15:13 mod_gzip.so
   -rw-r--r--  1 oracle oinstall    908 Feb 26 15:13 mod_gzip_debug.o
   -rw-r--r--  1 oracle oinstall  35412 Feb 26 15:13 mod_gzip.o
   drwxr-xr-x  3 oracle oinstall   4096 Feb 25 19:27 docs
   drwxr-xr-x  3 oracle oinstall   4096 Feb 25 18:54 ..
   -rw-r--r--  1 oracle oinstall   4866 Oct  1  2002 ChangeLog
   -rw-r--r--  1 oracle oinstall    264 Oct  1  2002 Makefile
   

## install mod_gzip into Apache/libexec
##
cp -pi mod_gzip.so $ORACLE_HOME/Apache/Apache/libexec/


## stop procs
##
opmnctl stopall

## setup httpd.conf
## based on:
##   http://www.schroepl.net/projekte/mod_gzip/config.htm
##
cd /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/conf
vi httpd.conf
--- edit as follows ---

##
## add the following line at the end of LoadModule stack:
##

LoadModule gzip_module        libexec/mod_gzip.so

##
## add the following before "PassEnv ORACLE_HOME"
##

<IfModule mod_gzip.c>
  mod_gzip_on                   Yes
  mod_gzip_keep_workfiles       No
  mod_gzip_minimum_file_size    500
  mod_gzip_maximum_file_size    500000
  mod_gzip_maximum_inmem_size   60000
  mod_gzip_min_http             1000
  mod_gzip_handle_methods        GET POST

# JA:   HTML-Dokumente
  mod_gzip_item_include         file       \.html$
#
# NO:   include files / JavaScript & CSS (due to Netscape4 bugs)
  mod_gzip_item_exclude         file       \.js$
  mod_gzip_item_exclude         file       \.css$
#
# YES:  CGI scripts
  mod_gzip_item_include         file       \.pl$
  mod_gzip_item_include         handler    ^cgi-script$
#
# phase 2: (mime, rspheader)
# ===========================
# YES:  normal HTML files, normal text files, Apache directory listings
  ## the next line is missing $ to allow for "text/html; charset=ISO-8859-1"
  mod_gzip_item_include         mime       ^text/html;
  mod_gzip_item_include         mime       ^text/plain$
  mod_gzip_item_include         mime       ^httpd/unix-directory$
  # This was very important to get things working
  mod_gzip_item_include         uri        .*
#
# NO:   images (GIF etc., will rarely ever save anything)
  mod_gzip_item_exclude         mime       ^image/
#
  mod_gzip_dechunk              Yes
##
##
  LogFormat                     "%h %l %u %t \"%V %r\" %<s %b mod_gzip: %{mod_gzip_result}n In:%{mod_gzip_input_size}n -< Out:%{mod_gzip_output_size}n = %{mod_gzip_compression_ratio}n pct." common_with_mod_gzip_info2
  CustomLog                     "|/u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/bin/rotatelogs /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/logs/mod_gzip.log 43200" common_with_mod_gzip_info2
##
##
  mod_gzip_add_header_count     Yes
  mod_gzip_send_vary            On
</IfModule>

## start procs
##
opmnctl startall


## verify compression is working in the log file
##

cd /u01/app/oracle/product/10.1.3/OracleAS_1/Apache/Apache/logs
ls -lta mod*
[edited by: Vitaliy at 19:15 (CST) on Feb. 26, 2008]