perftools查看堆外内存并解决hbase内存溢出
- d0ngd0ng - 蓝色时分 最近线上运行的hbase发现分配了16g内存,但是实际使用了22g,堆外内存达到6g. 堆外内存用一般的工具很难查看,可以通过google-perftools来跟踪:. 它的原理是在java应用程序运行时,当调用malloc时换用它的libtcmalloc.so,这样就能做一些统计了.
Total: 3263.2 MB 3145.2 96.4% 96.4% 3145.2 96.4% zcalloc 83.8 2.6% 99.0% 83.8 2.6% os::malloc 30.0 0.9% 99.9% 30.0 0.9% init 2.2 0.1% 99.9% 2.2 0.1% ObjectSynchronizer::omAlloc 1.0 0.0% 100.0% 3144.1 96.4% Java_java_util_zip_Deflater_init 0.6 0.0% 100.0% 0.7 0.0% readCEN
import static com.sun.btrace.BTraceUtils.*; import com.sun.btrace.annotations.*; import java.nio.ByteBuffer; import java.lang.Thread; @BTrace public class TestRegion1{ @OnMethod( clazz="java.util.zip.Deflater", method="deflate" ) public static void traceCacheBlock(){ println("deflate?"); } }
I don't know very much about how to install DLLs on Windows, so you'll have to figure out that part for yourself.