DataStax Help Center

lsof shows Apache Cassandra is holding a large amount of files open

Summary

Some users might monitor the output of the lsof command to check the amount of file descriptors Apache Cassandra is using

Symptoms

The output of the command lsof | grep <cassandra pid> shows an alarming number of file descriptors. For example if we count the amount of references to the "stress.jar" (cassandra-stress tool):

$ cat lsof.out |grep stress.jar |wc -l
242

Cause

Some versions of lsof include a thread id. This can be determined by the TID column header apparent in the output. Such an output will give rise to a duplication of entries since lsof will potentially show duplicated entries one for each thread.

Solution

It is recommended to use lsof with the -p option:

lsof -p <cassandra pid>

For example:

$ sudo lsof -p $(ps -ef | awk '( !/awk/ && /cassandra/ ){print $2}') | grep "stress"

java 1647 datastax mem REG 253,0 395156 785358 /home/datastax/dse-4.7.5/resources/cassandra/tools/lib/stress.jar
java 1647 datastax 48r REG 253,0 395156 785358 /home/datastax/dse-4.7.5/resources/cassandra/tools/lib/stress.jar

 

Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk