1. Useful modules which could be used
mod_dbd -> Connection Pooling for other modules
mod_filter -> Dynamic chaing of filters, filters inserted based on request headers and response
mod_dumpio --> Dumps all IO to error log - in case of SSL dumping is done right before encryption and after decryption
mod_log_forensic --> helps in tracking request response , resulting in 2 lines of log for each request
mod_info - helps in giving info about all modules installed
2. MOD_CACHE
Enabling can improve the performance by reducing IO calls for fetching the content (since all static content are served from apache)
mod_cache --> mod_disk_cache /mod_mem_cache - determines cache implementataion
3. Rewrite rules
a. Since Rewrite rules and regular expression matching are expensive can be replaced with Proxy pass where ever possible
Example
RewriteRule ^/ws/(.*) http://localhost:8080/ws/$1 [P,L] with
ProxyPass ^/ws/ http://localhost:8080/ws/$1 [P,L]
b.Smart order of rewrite rules
The order of rewrite rules needs to be arranged in such a way that the maximum occurring instances should be available at the top , since the entire list is scanned trough for every request
Example
RewriteRule ^/(.*\.jsp) http://localhost:8080/$1 [P]
RewriteRule ^/(.*\.do) http://localhost:8080/$1 [P]
Could be replaced with
RewriteRule ^/(.*\.do) http://localhost:8080/$1 [P]
RewriteRule ^/(.*\.jsp) http://localhost:8080/$1 [P]
Since the maximum number of requests we expect will be .do requests. This will improve performance because there will be only few jsp requests and most of the times execution can stop in the above line.
4. Also other parameters for Operating systems and GC tuning will enhance the performance
5. Graceful shutdown - handle existing request , time limit can be specified in case of long time
consuming request with property GracefulShutdownTime
6. Prefork MPM- Stable but not scalable - one process per request
Worker MPM(Preferred) - more scalable , thread safeness of libs critical - one thread per request
7. Useful Parametres
Controling Idle pool - MinspareServers /MaxspareServers
MinSpareThreads/MaxSpareThreads
ThreadsPerChild
MaxRequestsPeeChild
8. KeepAlives - prevents connections (socket open close for each request)
9.Avoid DNS Lookups
10. On the Fly Compression - deflate - bandwidth reduction and faster response times
Sunday, March 15, 2009
Performance Optimization in Apache
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment