Anand's programming Blog

Thoughts and comments on Java software development.

Sunday, January 16, 2005

JMX for OOM warning : Helpful but Useful?

Javaspecialist put up a good article on using java management API to introspect the JVM memory pool. A listener can be registered to the management bean which is a call back for the bean if the memory usage is exceeding the threshold value. Threshold value can be set by using MemoryPoolMxBean.setUsageThreshod(long) method.

This is all great, I can have some auto script warn the primary engineer or operations about memory related issue in advance. But what does it buy us apart from the advance notice. In my experience I have seen following actions for a OOM in live server

Script action:
A) Setup a back ground script on the server which looks for OOM exception on server log.
B) If the script finds an OOM exception , a restart is performed.
C) Script also alerts the production control for further action.

Engineer action:
D) Doh! I got a pager, damn why is it that pager rings on darn weekend. Ahh OOM, wish I had not replaced the pager battery.
E) Hum... Let me look at for some temporarily solution so I can buy some time. How about heap size increase or may be scale the server.
F) Back to office, setup profiler tool and figure out if there is a memory leak.
G) Send out an email with finding and resolution.

So having said this, I would be interested to know if you see any additional benefit from the management bean for OOM related issues? Also if you have some other ways to deal with live production OOM issues let me know.

Cheers
Anand

0 Comments:

Post a Comment

<< Home