Out of Memory and Hazelcast

OOM is a real trouble for distributed environment. A node having trouble may pull down whole cluster’s performance.

Hazelcast’ general policy on OOM condition is trying to isolate the problem and shutdown instance as soon as possible.

Here as you can see below, it will first try close connections, stopping threads and shutting down JVM instances. Logging the error is the last thing; so you may not see the OOM log.

This is the default action. Closing connections is the first thing being tried. Otherwise other nodes can still consider the problematic node alive till operations’ timeout.

You can have your own action executed when OOM. You can do some cleanup, log error, call System.exit() etc.

Here an example to define a custom OOM handler:

Problem: Hazelcast can detect OOM, when hazelcast threads experience the problem. So if OOME is thrown by an external thread; it can not be handled by hazelcast.