2

I am trying to to detect what causes massive spikes in our Java struts bases web application deployed in Jboss. I have used Yourkit and visualVM to take dumps and have analysed dumps but these spikes are momentary and by the time the dump is taken nothing remains.

Question is - is there a way to detect what is causing a spike in the runtime?

4
  • Check what operations are getting performed by your app when you see spike..
    – rai.skumar
    Jan 24, 2013 at 14:07
  • when GC runs there are chances of spike. Check that. Jan 24, 2013 at 14:13
  • What kind of spikes are you referring to? CPU usage?
    – ppeterka
    Jan 24, 2013 at 14:22
  • Heap Memory spike - which means large objects or numerous objects are getting created. CPU is fine
    – Soumya
    Jan 24, 2013 at 14:59

2 Answers 2

3

Here are a couple of ideas:

  • Examine your request logs to see if there is any correlation with the spikes and either request volumes or specific request types.

  • Run the JVM with GC logging enabled and look for correlations.

  • Enable your debug-level logging in your application and look for correlations. (Be cautious with this one because turning on more application logging could change performance characteristics.)

  • (On Linux / Unix) run vmstat and iostat and look for correlations with extra disc activity or swapping/paging.


If you have a spike in the object creation rate or in the number / size of non-garbage objects, this is most likely caused by your application rather than the JVM or operating system. There is a good chance that it is due to a transient change in the nature of the application's workload; e.g. it is getting a spike in the requests, or it there is some unusual request that involves creating a lot of objects. Focus on the request and application logs.

1
  • It's a Windows machine. Yes I guess I can turn on more logging in the application to see what is happening at that time. However the application has several pages and modules - all being used at the same time. So it's a bit tedious doing it that way. I was looking for tool that I can inject into the application which can log when some thread tries to create a lot of objects... or something in that line. Easier said than done probably :(
    – Soumya
    Jan 24, 2013 at 15:02
2

As most likely garbage collection can cause such an issue, I'd recommend enabling the garbage collection logging in the JVM using these command line options:

  • -Xloggc:<path and filename to log to>
  • -XX:+PrintGCDetails
2
  • Thanks. Sorry did you mean turning these ON will have an adverse effect on performance in the Live app?
    – Soumya
    Jan 24, 2013 at 15:00
  • @Soumya no, sorry if it was not clear. Though GC logging might need some disk IO, I don't think turning them on would make any significant performance issues. I rephrased the answer to be clearer.
    – ppeterka
    Jan 25, 2013 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.