JVM Args in java web start application - java-8

I have a Javafx application which is deploybed via java webstart.
I need to pass GC vm args for the application and I have issues in doing so.
I have the following in my jnlp
<j2se version="1.8+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="1024m" max-heap-size="1024m" java-vm-args="-XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=75 -XX:+UseCMSInitiatingOccupancyOnly -XX:+HeapDumpOnOutOfMemoryError -XX:+DisableExplicitGC"/>
When the application starts, it looks like most of them are not passed to the VM
ps -ef | grep java gives the below output
133768645 2448 1 0 4:31PM ttys020 0:37.80 /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -XX:+DisableExplicitGC -XX:CMSInitiatingOccupancyFraction=75 -Xmx1g -Xms1g
The min & max heap gets set as expected but not all the other VM arguments.
Can u please let me know why the other vm args are not being passed to the VM ?
Am I doing something wrong ?
Appreciate your help.
Thanks

Make sure your jnlp file that you changed is the one javaws is using. If it has an href attribute in the jnlp file header, it will take the jnlp file from there even if you launch it from your local machine.

Related

Java overload procesor

I am installed geonetwork 4.0.6 with ElasticSearch in Debian 11. But i have a problem, the Java overload the procesor and i am cannot login to my server through ssh. I am limit Java usage of memory in /etc/default/tomcat9 file config and /etc/elasticsearch/jvm.options. My configs are:
In /etc/default/tomcat9
JAVA_OPTS="-Djava.awt.headless=true -Xmx6144m -XX:MaxPermSize=1536m -Dfile.encoding=UTF-8"
In /etc/elasticsearch/jvm.options
-Xms2048m
-Xmx2048m

Setting the sonar file, sonar.properties, no useful after restarting the service

sonar bulild sucess
but analysis error java.lang.OutOfMemoryError: Java heap space
set sonar.properties but not use
sonar.web.javaOpts=-Xmx6144m -Xms128m -XX:+HeapDumpOnOutOfMemoryError
sonar.ce.javaOpts=-Xmx6144m -Xms128m -XX:+HeapDumpOnOutOfMemoryErro
sonar.search.javaOpts=-Xms512m -Xmx6144m -XX:+HeapDumpOnOutOfMemoryError
check ui setting is not use
Increase the memory via the SONAR_SCANNER_OPTS environment variable:
export SONAR_SCANNER_OPTS="-Xmx512m"
On Windows environments, avoid the double-quotes, since they get misinterpreted and combine the two parameters into a single one.
set SONAR_SCANNER_OPTS=-Xmx512m
is unuseful ,mypoject is scan (by maven) sucess but SonarQube background task fails with an out-of-memory error.
https://docs.sonarqube.org/display/SONARqube71/Java+Process+Memory
As it is stated in official documentation,
You need to define SONAR_SCANNER_OPTS as environment variable with desired heap space.
Documentation link here

How to set Heap size for Jmeter Slave instance

I have a distributed Jmeter Master-Slave set up. On increasing the throughput to a higher number, I started getting OOM exception for heap space.
I found this post:
How to Increase Heap size
to increase the HEAP size in the jmeter.bat file (windows in my case). However for Jmeter slave machines we don't launch jmeter via jmeter.bat but rather via jmeter.server.bat file. I checked this file doesn't have any HEAP memory parameter.
Any suggestions on how to increase the Heap memory size on Slave instances?
Looking into jmeter-server.bat source code:
It respects JVM_ARGS environment variable
It calls jmeter.bat under the hood which in its turn respects HEAP environment variable
So given you're on Windows you can do something like:
set HEAP=-Xms1G -Xmx10G -XX:MaxMetaspaceSize=256M && jmeter-server.bat
and the JVM heap will be increased to 10 gigabytes for the slave instance.
Above instructions are applicable to JMeter 4.0, the behavior might differ on previous versions.
The command to start the Jmeter slaves looks like:
nohup java -jar "/bin/ApacheJMeter.jar" "-Djava.rmi.server.hostname=127.0.0.1" -Dserver_port=10000 -s -j jmeter-server.log > /dev/null 2>&1
So if you want to change Java parameters just pass it after java:
nohup java -Xms512m -Xmx512m -XX:+UseCMSInitiatingOccupancyOnly ...

modify Idea vm memory option on my OSx system didn't change anything

I am trying to increase the my idea IDE startup memory. So I:
right click on Intellij IDEA > show package content > Contents > bin > idea.vmoptions
and the idea.vmoptions is modified as:
-Xms256m
-Xmx2048m
-XX:ReservedCodeCacheSize=480m
-XX:+UseCompressedOops
-Dfile.encoding=UTF-8
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-Xverify:none
-XX:ErrorFile=$USER_HOME/java_error_in_idea_%p.log
-XX:HeapDumpPath=$USER_HOME/java_error_in_idea.hprof
-Xbootclasspath/a:../lib/boot.jar
But it changed nothing.I see the idea process parameter ,it is still -Xmx768m,instead of what I have configured -Xmx2048m:
/Applications/IntelliJ IDEA.app/Contents/jdk/Contents/Home/jre/bin/java -d64 -Djava.awt.headless=true -Didea.version==2017.2.5 -Xmx768m -Didea.maven.embedder.version=3.3.9 -Dfile.encoding=UTF-8 -classpath /Applications/IntelliJ ....
Also,I copy /Applications/IntelliJ\ IDEA.app/Contents/bin/idea.vmoptions to /Users/wuchang/Library/Preferences/IntelliJIdea2017.2/idea.vmoptions,also doesn't help.
Anyone could give me some suggestions?
My Idea version is 2017.2.5 and mac os version is 10.12.6.I have also tried to use Help -> Edit Custom VM Options to modify it ,also doesn't help.
The issue is that there is another process started for Maven importing and its heap size is configured elsewhere. You are checking the heap size of the Maven importer process instead of IntelliJ IDEA process.

alternative to sudo /etc/init.d/elasticsearch start

I am trying to run elasticsearch through supervisord. To do this I need a command to start elasticsearch without running it in the background. My current supervisord script looks like
[program:elasticsearch]
command=/etc/init.d/elasticsearch start
autostart=true
autorestart=true
startretries=3
user=root
stdout_logfile=/var/www/elasticsearch_std.log
but since the '/etc/init.d/elasticsearch start' command runs elasticsearch in the background, it tries to start elasticsearch again as soon as the command returns a successful launch, which results in
DEBG 'elasticsearch' stdout output:
* Already running.
...done.
Since I told supervisord to restart 3 times, it will do that three times before giving up. However, the purpose of this is of course that supervisord should restart elasticsearch in case of a crash.
So I need a command which starts elasticsearch in the foreground.
EDIT:
Following the suggestion below and the elasticsearch instruction from https://www.elastic.co/guide/en/elasticsearch/reference/current/settings.html I tried to run
/usr/share/elasticsearch/bin/elasticsearch -Epath.conf=/etc/elasticsearch -Epath.logs=/var/log/elasticsearch -Epath.data=/var/lib/elasticsearch
Error: encountered environment variables that are no longer supported
Use jvm.options or ES_JAVA_OPTS to configure the JVM
ES_HEAP_SIZE=256m: set -Xms256m and -Xmx256m in jvm.options or add "-Xms256m -Xmx256m" to ES_JAVA_OPTS
I do not understand this error message since I already set
-Xms256m
-Xmx256m
in /etc/elasticsearch/jvm.options
EDIT2: I also tried to set these parameters through the environment, which did not work either
ES_JAVA_OPTS="-Xms256m -Xmx256m" /usr/share/elasticsearch/bin/elasticsearch -Epath.conf=/etc/elasticsearch -Epath.logs=/var/log/elasticsearch -Epath.data=/var/lib/elasticsearch
Error: encountered environment variables that are no longer supported
Use jvm.options or ES_JAVA_OPTS to configure the JVM
ES_HEAP_SIZE=256m: set -Xms256m and -Xmx256m in jvm.options or add "-Xms256m -Xmx256m" to ES_JAVA_OPTS
the /etc/default/elasticsearch file has all lines commented out except
ES_STARTUP_SLEEP_TIME=5
Start elasticsearch directly with bin/elasticsearch. Using the init file will daemonize and exit immediately, which is not suitable for supervisor.
Instead, set the command attribute to something like:
command=/usr/share/elasticsearch/bin/elasticsearch
-Edefault.path.conf=/etc/elasticsearch
-Edefault.path.logs=/var/log/elasticsearch
-Edefault.path.data=/var/lib/elasticsearch
replacing the paths accordingly.
You can also set the default.path.conf and edit the YAML file inside for the data and log settings (amongst others).

Resources