1

I am trying to Tune one of my applications on JAVA. I am using JAVA-Profiler and got some reports from it. I saw that the number of page -faults for application are ranging from 30000 to 35000 range. How can I decide if this number is too high or normal ? I am getting same data for initial one minute and after half an hour as well.

My RAM is 2 GB and I am using application with single thread.

Thread is only trying to read messages from queue every 3 seconds and queue is empty.

Since no processing is being done, I think that page faults should not occur at all. Please guide me here.

Learn More
  • 1,535
  • 4
  • 29
  • 51
  • You can use something like `sar` to test number of PF with and without your program being run on your computer. See http://www.cyberciti.biz/faq/linux-command-to-see-major-minor-pagefaults/ – Victor Sorokin Feb 09 '13 at 21:24

2 Answers2

2

When you start your JVM, it reserves the maximum heap size as a continuous block. However, this virtual memory is only turned into main memory as you access those pages. i.e. every time your heap grows by 4 KB, you get one page fault. You will also get page fault from thread stacks in the same manner.

Your 35K page faults suggests you are using about 140 MB of heap.

BTW You can buy 8 GB for £25. You might consider an upgrade.

Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • Thanks for answering. You are close when you say my Heap size is around 140 MB. My Max Heap Memory is 250 MB. I need to know what are other alternatives to optimize page fault scenarios. I need to know possible optimizations here. RAM can be increased. I agree. Apart from this, would it help to increase SWAP memory. Would it help if I increase CACHE ? Is there any other optimization, which does not require hardware upgrade ? – Learn More Feb 15 '13 at 15:43
  • 1
    java can use large pages for the heap (has to be supported by the OS as well), less TLB entries/misses, less memory on page tables – bestsss Feb 16 '13 at 08:54
0

What's your JVM? If it's HotSpot, you can use JVM options like -XX:LargePageSizeInBytes or -XX:+UseMPSS to force desired page sizes in order to minimize page swapping. I Think there should be similar options for other JVMs too.

Take a look at this: http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

zaerymoghaddam
  • 3,037
  • 1
  • 27
  • 33