nice to use oql during trouble shooting

Introduction

To do trouble-shooting on performance or memory issue, we are possible to use visualVM to get information on suspect objects.

The problem is, sometimes, we do not know what we are expect for. In this case, OQL is a useful tools to get what you want by providing some search criteria.

It seem different version of OQL has different syntax and I am trying to use the very common way to solve my issues. Some document is quite useful which I want to have it attached in this page

How to get the memory dump file

/opt/jdk/bin/jmap  -dump:format=b,file=dump [process ID] 

Base Usage

select [target] from [classname] where [Query Criteria]

for example

select s from java.lang.String s where s.count >= 100
select file.path.toString() from java.io.File file

Here are an examples with I used to find those objects I am interesting in.

  • Find all threadpool in NAMED
select x , x.threadFactory.threadName from java.util.concurrent.ThreadPoolExecutor x where classof(x.threadFactory).name.contains("Named")
  • Find all failed response in AKKA
select x.exception.detailMessage from scala.util.Failure x