Exceptions and performance issues java 8 [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Recently, i have noticed some unsual OutOfMemoryError exceptions in the customer logs and a performance issues. It comes probably from JVM (Heap or stack) that using java 8.
My questions are as follows :
1. how can i get the source of the exception?
2. What's the JVM options should i use (in production)?
3. Should i configure the garbage collector's cycle?

Chasing the source of the exception down can be tough in the case where there is a memory leak. You can configure java to do a heap dump when an OutOfMemoryException happens by adding the -XX:+HeapDumpOnOutOfMemoryError flag to your java command. More details about where the heapdump is stored can be found on this question Using HeapDumpOnOutOfMemoryError parameter for heap dump for JBoss. Then the customer can give you the heapdump next time things crash and you can use a tool like Eclipse MAT to see what objects are consuming memory. This will give you a hint as to what is going on.
It's pretty common to use custom heap sizes. How to do this is described in this question What are the Xms and Xmx parameters when starting JVMs? .
Configuring garbage collection should only be done when you are encountering a performance issue. Since the issue is running out of memory and not performance, I would not recommend changing anything here.

Related

JVM + LEAK + JEMALLOC = Unsafe_AllocateMemory [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 17 days ago.
Improve this question
It is being a lot of hour re-searching and try find wth is calling a unsafe.allocateMemory and no success at all. Kind of disappointed :-(
Im not a expert or profile or with jemalloc but here is what I did so far and hopefully someone can see/find what I could not...
Heap and non-Heap memory are all good...I used yourkit.
General memory on the box increase crazily until 100% and the jvm crash.
Using Jemalloc and let the app run for a lot of time I was able to get some JEPROF files and converted some of them into PDF to see the memo/function stack calls:
I see that something is calling the unsafe.allocateMemory and not calling the unsafe.freeMemory after done, so it will eat all my memory.
I did a thread dump from the application (link to the txt with the thread dump) but unfortunately I was not able to find anything related to the unsafe.allocateMemory. Can anyone see something that I was not able to see or helping me by giving me any clue or pointing me in the right direction ?
Thank you....
Try async-profiler. It can show you complete Java stack traces of all callers of Unsafe_AllocateMemory0.
Example:
./profiler.sh -e Unsafe_AllocateMemory0 -f alloc.html <pid>
The output file alloc.html will be a flame graph of all Unsafe_AllocateMemory0 calls:
For more information about finding native memory leaks in Java, see this question and this discussion.

How to remove java program's garbage collection time? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I wanna do empirical time complexity analysis to a java program. But how do I remove the garbage collection time?
You can disable the garbage collector in Java 11+ using the Epsilon No-Op Garbage Collector, introduced in 'JEP 318: Epsilon: A No-Op Garbage Collector (Experimental)'.
Add the following flag to your java command:
java -XX:+UseEpsilonGC ...
Ensure you understand the limitations of this garbage collector flag (explained in the linked JEP). There is one major caveat:
Once the available Java heap is exhausted, the JVM will shut down.
You could try running with the Epsilon GC; see #concision's answer.
But the empirical complexity for a Java program should include the GC overheads. So maybe a better approach is to make your measurements by running your program repeatedly in the same JVM and averaging the times so that the GC overheads are amortized. Consider using a benchmarking framework like JMH.
See the other answers which directly answer your question, but in general if you want to check performance characteristics, the garbage collector is just one of half a billion things that can mess with your timings.
Use JMH, which will try to mitigate or outright eliminate most of those things, and it will take care of waiting out hotspot warmup and the like. Any benchmark not based around JMH or similar is unlikely to mean much.

Methodology to evaluate any change in android aimed at performance gains [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
When making a change in an android application and wanting to evaluate if it actually improves anything in performance, what are some standard steps to do?
There must be some standard things to check using either Android Studio or MAT.
My main interest is about checking that memory usage has been improved.
Update:
Just to clarify. I am not running into some big issue with memory that I need to improve. I am interested in testing with something that I believe will optimize the memory usage but I am not sure how to verify it
Android Studio Device Monitor is the first step to go.
1) Check How much memory it is using before and after your change via Android Monitor(memory tab)
2) By MAT, check if there can be any code which can cause OOM/MemoryLeak, check before and after change hprof files to understand.
For memory these two options can be checked, other than these, can check CPU/GPU usage as well.

Jetty JVM is freezing [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I have 2 Jetty servers with the same problem,
The Jetty web app gets "freeze" every couple of hours.
(Freeze means that the console is not doing anything/unable to receive new requests)
During the "Freeze" I noticed that the JVM is using more swap than it usually does.
It seems like sort of a memory leak, even tough the system has enough memory.
I run the JVM with those run parameters:
-Xms8000m -Xmx280000m
Those are the RAM graphs (blank lines are what I called "freeze"):
See reference number 1 below
I also noticed the the garbage collector is not running very frequent.
Maybe it is related?
See reference number 2 below
I'd appreciate any input regarding a proper use of the garbage collector and any other ideas that would help resolve it
This is a spring/Hibernate based Application.
http://i.stack.imgur.com/VGOkM.jpg
http://i.stack.imgur.com/eI1mt.jpg

How do I profile applications on Windows and Linux to get CPU and RAM usuage values? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I am busy doing some research and I need to do a comparison between two methods of system monitoring. I have to compare the total memory of overhead and computation required when queries are made to an external software package (i.e one that I did not create but running on the same system) as well the overhead in my software package (written in JAVA) when including all the libraries and making all the queries.
Does anyone have any suggestions on how I can approach this task to achieve these goals? Are there any general profiling solutions available that just "plug" into your system monitor and retrieve the system statistics this way? Or just a pointer in the right direction would be more than helpful right now as I am completely stuck :/
Thanks in advance.
You can use VisualVM (For sure in Windows, but don't know about Linux) (or) You can write a simple program using JMX API.

Categories