How to log Apache requests conditionally

Today a small Apache configuration trick.

I’m using a fancy Amazon ELB ( to loadbalance (duh) two Apache nodes. In order to check whether the nodes are alive, the load balancer requests a static html page every few seconds. In my case this is elb-ping.html. Soon you will notice that this results in a your Apache acces.log being flooded with those ping requests.  Don’t worry, just tell Apache to log the requests conditionally.

To do so add the following lines to your virtualhost or apache configuration in general:

SetEnvIf Request_Uri “elb-ping.html” dontlog
CustomLog logs/access_log common env=!dontlog

Restart Apache and voila!

Boosting I/O throughput of a process

Almost 6 years ago, when Windows Vista was released, I decided to switch to Linux on a day-to-day basis. I had been using Linux before, but was still using Windows on my desktop machine (I know…pretty foolish). The other day I was glad I made that switch a few years ago.

I was creating a HEAP dump, that is a snapshot of all objects in memory, of a JBoss server. A HEAP dump really dumps everything, so if your JBoss (or Tomcat or whatever) process is occupying 4GB of memory, it will dump the whole 4GB in a nice file for you to analyze later on (which is the whole idea behind dumping the HEAP).

Really cool stuff, but not so cool if you see that the dump file only grows 2MB each 10 seconds. What the hell?! I’ll be old and gray before the dump has finished!!! Linux power to the rescue!

The Linux operating system has an I/O scheduler ( that tries to prioritize process I/O requests in the best possible way. It’s clear that it isn’t giving my dump process the highest priority, so let’s tell Linux to do so: Say hi to ionice.

ionice -c class -n classlevel -p PROCESS_ID


1 (real time): First priority is given to the process, regardless of other I/O requests.

2 (best-effort): The default priority class for a process

3 (idle): The process will only get I/O time when no other program has requested I/O time.


A number from 0 to 7 indicating the time slice the process will receive on each scheduling window, where 0 is the highest priority (process gets more I/O time) and 7 is the lowest (process gets less I/O time).

Depending the class and level, the process is given a priority. Beware using the real time priority class as it might choke other processes needing some I/O time.

In my case I used the best-effort class with the highest priority (0). Magic happened, instead of seeing the dump file increased by 2MB per 10 seconds, it was now bumped up to a rate of 10MB/s, AWOOT!!

The importance of disabling auto deploy in JBoss

Recently I was investigating the memory usage of a JBoss application server (I have a post about this pending btw), and while I was preparing everything to launch a stress test, I was surprised to see how the Eden Space kept growing around 80MB each 5 seconds while JBoss was totally idle.

Garbage collection Eden Space

In the above image you can observe how the Eden Space fills up continuously when the autodeployer is activated. Changing the autodeployer’s check period to 60 seconds, we can observe that the Eden Space is filling at a very different rate. Disabling it completely results in almost no growth…

Conclusion: Disable the autodeployer on a production server!

To disable it (at least in JBoss 5), simply delete the following file: