Speed Up Traffic from APEX servers

April 18, 2008  |  apex, linux

The Oracle HTTP Server or the Embedded PL/SQL Gateway does not come configured with any form of HTTP compression to speed up the traffic between the APEX server and the client computers.

HTTP compression is the ability built into webservers and/or browsers, to use better the bandwidth. When using it, the HTTP data is compressed before the server sent it to the browsers. Most of the browsers “say” to HTTP server what method are supported before downloading data from servers. After acknowledge of the compression mode, data is compressed, for instance with mod_deflate (Apache 2.x) or mod_gzip (Apache 1.x), and the browser decompresses it after downloading and before showing the HTML page to the user.

When I set Apache to use HTTP compression, the main objective is to reduce the size of the data that will be transfered between the server and the browser. Some types of files are more susceptible of beeing compressed than others. For instance, we’ll have good results compressing html, css and xml data… but poor results compressing pdf, jpeg, gifs and any other compressed file types.

Mod_deflate (Apache version 2) comes with  the ability to specify what file types we don’t want to compress. For instance, if I don’t want that some image files to be compressed (cause they already are compressed in their native format) I will put this line in the http mod_deflate section:

 
...
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
...

So, let’s go to the configuration part of using HTTP compression… First you must check that you have enabled the mod_deflate in httpd.conf:

...
LoadModule deflate_module modules/mod_deflate.so
...

After that you must  set the filter which will process responses from the server before they are sent to the client. You do this with the SetOutputFilter directive. To use the deflate filter add this line:

...
SetOutputFilter DEFLATE
...

There are other instructions you can set… For instance with DeflateFilterNote I can say if I will add info about compression ratio to the access log info.  This is usually used for statistical purposes. I also use to add this line:

...
DeflateFilterNote ratio
...

After that I only use to set what files types I don’t want to be compressed:

...
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
...

In conclusion, If you already use Apache for HTTP reverse-proxy APEX calls, you can also add the following lines to speed up the traffic from your web server:

...
SetOutputFilter DEFLATE
DeflateFilterNote ratio
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
...

I hope this can be an useful tip… If you already do some kind of speed improvement just comment this 🙂 I want comments on my blog 😉


3 Comments


  1. Virtual Private SEnuke X Servers

    Anyone knows of a reliable VPS (Virtual Private Server) hosting solution for a business application? Recommendations are welcome. Thanks..

  2. I use revion for oracle hosting
    if you’ll need to contact them for managed VPS

Leave a Reply