Set up Apache Httpd 2.2 to cache static contents from Weblogic / Tomcat / Jboss backend

Configuration:

Add below to conf.d/backend.conf

<IfModule mod_cache.c>
<IfModule mod_disk_cache.c>
CacheRoot “/var/cache/mod_proxy/”
CacheEnable disk “/”
CacheDirLevels 2
CacheDirLength 1

CacheLock on
CacheLockPath “/tmp/mod_cache-lock”
CacheLockMaxAge 5
</IfModule>

# These only valid for Apache httpd 2.4
#CacheQuickHandler off
#CacheHeader on
#CustomLog “logs/cached-requests.log” common env=cache-hit
#CustomLog “logs/uncached-requests.log” common env=cache-miss
#CustomLog “logs/revalidated-requests.log” common env=cache-revalidate
#CustomLog “logs/invalidated-requests.log” common env=cache-invalidate

</IfModule>

 

How to check:

1) Check access logs for Apache as well as the backend

2) Confirm that there are files in CacheRoot

#ls -R /var/cache/mod_proxy

 

References:

https://httpd.apache.org/docs/2.2/caching.html

https://httpd.apache.org/docs/current/mod/mod_cache.html

 

Advertisements

Get ulimit of a running process in AIX

In RHEL or any recent Linux kernel, getting a running process limit is just a matter of checking /proc/<pid>/limits.

In AIX, it is a bit more complicated.

 

1) Get the process ID

# ps -ef | grep java
jboss 53215284 17301698 0 22:02:42 – 1:29 /usr/java71_64/bin/java -D[Standalone] -server -XX:+UseCompressedOops …

 

2) Convert PID to HEX

# i=53215284; perl -e “printf (‘%x’, $i)”
32c0034

 

3) Grep the PID to get the slot id of threads

# pstat -A | grep -i 32c0034 | more
627 s 273007b 32c0034 unbound other 52 0 10027340 java
720 s 2d00023 32c0034 unbound other 52 0 1002d040 java

 

4) Use the slot id and pass to kdb to get the process limit

# echo “user 627” | kdb | grep rlimit | grep -v “_”
rlimit[CPU]……….. cur 7FFFFFFF max 7FFFFFFF
rlimit[FSIZE]……… cur 7FFFFFFF max 7FFFFFFF
rlimit[DATA]………. cur 7FFFFFFF max 7FFFFFFF
rlimit[STACK]……… cur 02000000 max 7FFFFFFF
rlimit[CORE]………. cur 3FFFFE00 max 7FFFFFFF
rlimit[RSS]……….. cur 7FFFFFFF max 7FFFFFFF
rlimit[AS]………… cur 7FFFFFFF max 7FFFFFFF
rlimit[NOFILE]…….. cur 000007D0 max 7FFFFFFF
rlimit[THREADS]……. cur 7FFFFFFF max 7FFFFFFF
rlimit[NPROC]……… cur 7FFFFFFF max 7FFFFFFF

 

Simple SSL Perfomance Comparison

Command used to test:

# openssl s_time -connect localhost:$PORT -new

Tomcat APR/Native:
2011 connections in 10.67s; 188.47 connections/user sec, bytes read 0
2011 connections in 31 real seconds, 0 bytes read per connection

JBoss Java connector:
460 connections in 11.01s; 41.78 connections/user sec, bytes read 0
460 connections in 31 real seconds, 0 bytes read per connection

Apache:
2753 connections in 14.43s; 190.78 connections/user sec, bytes read 0
2753 connections in 31 real seconds, 0 bytes read per connection

Weblogic:
797 connections in 3.81s; 209.19 connections/user sec, bytes read 0
797 connections in 31 real seconds, 0 bytes read per connection

Conclusion:

  1. Using APR/Native is better for performance.
  2. Weblogic is quite OK, performance better than JBoss, considering that it is using JDK 6 (will try with JDK 7 & 8 later).

Updates (26 Oct 2016)

Weblogic + JDK 7
1103 connections in 2.86s; 385.66 connections/user sec, bytes read 0
1103 connections in 31 real seconds, 0 bytes read per connection

Weblogic + JDK 8
889 connections in 4.27s; 208.20 connections/user sec, bytes read 0
889 connections in 31 real seconds, 0 bytes read per connection