Thursday, December 18, 2008

IHS or Apache 2 Performance Tuning

Ok, How to improve Apache performance, i´ll show you some tips:

1- Use mod_gzip to compress html, text, css... here is a example:

DeflateCompressionLevel 9

AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/atom_xml
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/x-httpd-php
AddOutputFilterByType DEFLATE application/x-httpd-fastphp
AddOutputFilterByType DEFLATE application/x-httpd-eruby
AddOutputFilterByType DEFLATE text/html


2 - Enable Apache cache, example:

LoadModule disk_cache_module modules/mod_disk_cache.so

CacheRoot /www/cache

## 1 Gb ##
CacheSize 100000000

##6 Mb ##
CacheMaxFileSize 6400000

## 640 bytes ###
CacheMinFileSize 640

## Expires in 1 hour ###
CacheDefaultExpire 3600
## Things to do cache ##
CacheEnable disk /

CacheDirLevels 5
CacheDirLength 3



3 - Combination of mod_headers and mod_expires, example:

LoadModule headers_module modules/mod_headers.so

Header set Cache-Control "public"

### Enable mod Expire ###

LoadModule expires_module modules/mod_expires.so

# turn on the module for this directory
ExpiresActive on
Header set Cache-Control "public"

# cache common graphics for 3 days
ExpiresByType image/jpg "access plus 3 days"
ExpiresByType image/gif "access plus 3 days"
ExpiresByType image/jpeg "access plus 3 days"
#ExpiresByType application/pdf "access plus 3 days"
ExpiresByType application/x-javascript "access plus 3 days"
ExpiresByType application/x-shockwave-flash "access plus 3 days"
ExpiresByType video/x-flv "access plus 3 days"
ExpiresByType text/plain "access plus 3 days"
ExpiresByType text/javascript "access plus 3 days"
ExpiresByType application/javascript "access plus 3 days"

# cache CSS for 3 days
ExpiresByType text/css "access plus 3 days"

# set the default to 24 hours
ExpiresDefault "access plus 3 seconds"



All this things will reduce in 30%-40% you network traffic and improve the speed.
In my opinion the best module is mod_gzip, cause no impact on the applications, all almost all web browsers support it.
Good Luck

Wednesday, December 10, 2008

Log4j and WAS 6.1 Problems

¿Problems with log4j after updating your WAS?
If your applications writes to a log file defined in log4j.properties and after install any IBM fix pack those applications stop to write in this log and writes in system.out just follow the next steps:
1- create a file called: commons-logging.properties and place this into it:
priority=100
org.apache.commons.logging.LogFactory=
org.apache.commons.logging.impl.LogFactoryImpl
org.apache.commons.logging.Log=
org.apache.commons.logging.impl.Log4JLogger
2- Copy this file in this directory: [profile_dir]/properties/
3- Stop and Start your servers and that´s it¡¡¡