Getting total used memory of a running JVM under Linux - jvm

I'm looking for an efficient way to measure the memory used by a running jvm.
A single command line with the pid of my jvm returning a reliable value of the consummed size of the memory.
Thx

You can run
ps aux | grep java
This will show you the memory usage of each application containing java in their launch-string, which should be most if not all java apps.
The output from my server is the following:
servername:~ servername$ ps aux | grep java
servername 50122 0.3 1.7 2832968 89236 ?? S Thu08AM 117:55.94 /usr/bin/java -jar /srv/eurekaj/Proxy/eurekaJ.Proxy-1.0.RC1-jar-with-dependencies.jar
servername 72399 0.0 25.9 4978676 1355616 ?? S 29Jul11 1560:43.70 /usr/bin/java -Xmx2g -Xms1g -Djava.io.tmpdir=/tmp -Dbtrace.agent=HudsonAgent -javaagent:/srv/btrace/1.2/btrace-agent.jar=scriptdir=/srv/btrace/scripts,stdout=false,fileRollMilliseconds=7500 -jar hudson.war --httpPort=8093
servername 72392 0.0 8.3 3169604 437192 ?? S 29Jul11 120:41.42 /usr/bin/java -Xmx256m -Xms256m -Djava.io.tmpdir=/jettytmp -Dbtrace.agent=JSFlotDemoAgent -Dlog4j.configuration=file:/srv/jsflot/demo/log4j.xml -javaagent:/srv/btrace/1.2/btrace-agent.jar=scriptdir=/srv/btrace/scripts,stdout=false,fileRollMilliseconds=7500 -classpath :very_verbose_classpath org.jsflot.server.JettyServer
servername 97501 0.0 0.0 2425712 276 s000 R+ 4:58AM 0:00.00 grep java
What you can read from this is PID, CPU Usage (%) and Memory Usage (%) for each of the processes.
You can also use the
top
command to get similar results.

Related

Apache Ignite - Unmatched Argument

I'm trying to create a tensorflow cluster on top of the Ignite cluster in my local multi-node environment.
I followed the tutorials and found tried the following command:
./ignite-tf.sh start TESTDATA models python /usr/local/grid/cifar10_main.py
This gives me an unmatched error as follows:
Unmatched argument:
Usage: ignite-tf [-hV] [-c=<cfg>] [COMMAND]
Apache Ignite and TensorFlow integration command line tool that allows to
start, maintain and stop distributed deep learning utilizing Apache Ignite
infrastructure and data.
-c, --config=<cfg> Apache Ignite client configuration.
-h, --help Show this help message and exit.
-V, --version Print version information and exit.
Commands:
start Starts a new TensorFlow cluster and attaches to user script process.
stop Stops a running TensorFlow cluster.
attach Attaches to running TensorFlow cluster (user script process).
ps Prints identifiers of all running TensorFlow clusters.
I'm not sure which is the umatched argument. Need help getting this to work.
I have downloaded this specific version and tried to run this command, I don't get any error messages, it would try to start a node:
311842 pts/12 S+ 0:00 | | \_ bash ./ignite-tf.sh start TESTDATA models python /usr/local/grid/cifar10_main.py
311902 pts/12 Sl+ 0:03 | | \_ /usr/lib/jvm/java-8-openjdk-amd64//bin/java -XX:+AggressiveOpts -Xms1g -Xmx1g -server -XX:MaxMetaspaceSize=256m -DIGNITE_QUIET=false -DIGNITE_SUCCESS_FILE=/home/user/Downloads/gridgain-community-8.7.24/work/ignite_success_20e882c5-5b64-4d0a-b7ed-9587c08a0e44 -DIGNITE_HOME=/home/user/Downloads/gridgain-community-8.7.24 -DIGNITE_PROG_NAME=./ignite-tf.sh -cp /home/user/Downloads/gridgain-community-8.7.24/libs/*:/home/user/Downloads/gridgain-community-8.7.24/libs/ignite-control-utility/*:/home/user/Downloads/gridgain-community-8.7.24/libs/ignite-indexing/*:/home/user/Downloads/gridgain-community-8.7.24/libs/ignite-opencensus/*:/home/user/Downloads/gridgain-community-8.7.24/libs/ignite-spring/*:/home/user/Downloads/gridgain-community-8.7.24/libs/licenses/*:/home/user/Downloads/gridgain-community-8.7.24/libs/optional//ignite-tensorflow/*:/home/user/Downloads/gridgain-community-8.7.24/libs/optional//ignite-slf4j/* org.apache.ignite.tensorflow.submitter.JobSubmitter start TESTDATA models python /usr/local/grid/cifar10_main.py

HANA index server won't start

I've installed HANA Express edition from binary in a VM (4 cores and 8GB of RAM) when I run HDB info it give me
USER PID PPID %CPU VSZ RSS COMMAND
hxeadm 12253 12252 0.0 115512 2024 -bash
hxeadm 12305 12253 0.0 113256 1616 \_ /bin/sh /usr/sap/HXE/HDB01/HDB info
hxeadm 12340 12305 0.0 151060 1804 \_ ps fx -U hxeadm -o user,pid,ppid,pcpu,vsz,rss,args
hxeadm 4641 1 0.0 23044 1708 sapstart pf=/usr/sap/HXE/SYS/profile/HXE_HDB01_amds-bd
hxeadm 4788 4641 0.0 232064 36552 \_ /usr/sap/HXE/HDB01/amds-bd/trace/hdb.sapHXE_HDB01 -d -nw -f /usr/sap/HXE/HDB01/amds-bd/daemon.ini pf=/usr/sap/HXE/SYS/profile/H
hxeadm 5239 4788 6.2 3184688 2271760 \_ hdbnameserver
hxeadm 10672 4788 1.1 1121576 416644 \_ hdbcompileserver
hxeadm 10681 4788 0.2 1028188 297320 \_ hdbpreprocessor
hxeadm 10826 4788 0.3 1336672 519228 \_ hdbwebdispatcher
hxeadm 3562 1 0.0 432156 26000 /usr/sap/HXE/HDB01/exe/sapstartsrv pf=/usr/sap/HXE/SYS/profile/HXE_HDB01_amds-bd -D -u hxeadm
as you can see, the hdbindexserver is not started, and to be more sure I've checked the port number 30015, ant it's not used at all.
I've tried with the Virtual machine provisioned by HANA installer, but I've got the same results.
My question is how to start the index server?
Thank you in advance.
Yes, that's ok. HXE is installed as MDC system by default (with tenants disabled if I remember it right). In the system DB the nameserver takes over the task of the index server.
Check those links:
https://archive.sap.com/discussions/thread/3961778
https://www.youtube.com/watch?v=DbaO_-Hlq98
It was a RAM problem,
I added some more RAM, now with 18GB of RAM everything is fine.
Since you have an OS level access, you can try to start it manually:
/usr/sap/HXE/HDB01/exe/hdbindexserver
and see why it fails in logs, which are located at
/usr/sap/HXE/HDB01/<name_of_your_server>/trace/indexserver_alert_sixtb.trc
You can check other files in the same folder as well.
It is also possible to start indexserver from HANA Studio. Right click on the instance (with SYSTEM user) --> Configuration and Monitoring --> Open Administration --> Landscape
The logs are available under --> Diagnosis Files in the Administration.
New comers to this issue... for the sake of consistency you can allocate a dedicated Memory in "Docker Desktop > Preferences > Resource > Memory" (usually Tenant creation consumes memory during the initial setup as it fires up the Indexserver taking up to 12GB of Ram). Cheers 😇

Apache rotatelogs not working

Trying to use Apache's rotatelogs utility for rotating my Subversion access and error logs and below is my configuration:
ErrorLog "|/opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_errorlog.%Y-%m-%d-%H_%M_%S 5M"
CustomLog "|/opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_accesslog.%Y-%m-%d-%H_%M_%S 5M" common
and have commented out the default ErrorLog and CustomLog entries and did a restart.
but I don't see log rotation happening on the target directory.
I grepped the process id and rotatelogs process is alive
ps -ef|grep rotatelogs
root 25385 25384 0 08:16 ? 00:00:00 /opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_errorlog.%Y-%m-%d-%H_%M_%S 5M
root 25386 25384 0 08:16 ? 00:00:00 /opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_accesslog.%Y-%m-%d-%H_%M_%S 5M
root 25858 25384 0 08:16 ? 00:00:00 /opt/CollabNet_Subversion/bin/rotatelogs /var/opt/CollabNet_Subversion/logs/svn_accesslog.%Y-%m-%d-%H_%M_%S 5M
2585 25827 24938 0 09:27 pts/0 00:00:00 grep rotatelogs
I'm not sure where and how to debug and I'm looking to use the rotatelogs option not the logrotate utility.
OS - RHEL 6.8
svn server - svn, version 1.9.4 (r1740329)
[CollabNet flavor, not the CollabnetEdge]
(P.S: Installed using the follwing
rpm:CollabNetSubversion-server-1.9.4- 2.x86_64.rpm )
Did the log file size reach 5 MB? It won't rotate until then with the 5M setting you have.

ps call missing processes in Yocto

I'm trying to report on running processes in Yocto (Poky). ps aux doesn't work here, but standard ps call return much of what aux would in Debian. But it won't report my .sh script processes. Is there an argument that works here, or another call I can try? Thanks in advance.
You are probably using busybox. Busybox contains its own version of ps and might not have support for the flags you're using. A simple ls -l /bin/ps should give you indications whether or not it's symlinked to busybox or not.
My suggestion would be to include the package procps in your recipe (which contains the ps you're more familiar with).
Busybox ps should show you all your processes.
I've created this test script, pstest.sh:
#!/bin/sh
while true; do
sleep 10;
done
Which I've been running, both on a Debian box, aon a qemux86 based core-image-minimal, and on a custom embedded device built with OpenEmbedded / Yocto. (I.e. the last one is not running the Yocto kernel). On all of these devices, the following holds true:
# ./pstest.sh &
# ps
PID USER VSZ STAT COMMAND
1 root 4196 S {systemd} /sbin/init
2 root 0 SW [kthreadd]
3 root 0 SW [ksoftirqd/0]
5 root 0 SW< [kworker/0:0H]
.....
633 root 2452 S {pstest.sh} /bin/sh ./pstest.sh
634 root 2732 S sleep 10
638 root 3044 R ps
As you can see, I'm seeing the script process, as well as the sleep command. (Note: on Debian ps above has been replaced with busybox ps).
If you still can only see the sleep, could you try the following:
# cat /proc/`pidof sleep`/status | grep PPid
PPid: 633
By running that line, you should be able to see the parent PID of the sleep command; check which process that corresponds to.

Why can't I stop Solr from running?

The sunspot_solr version that I am using is 1.3.3.
I am using sunspot_solr gem to start and stop a local instance of Solr. I use the following command to start it:
rake sunspot:solr:start
and the following command to stop it:
rake sunspot:solr:stop
However, stop is not working. I noticed that the pid written in the pids folder is not the correct one.
When I start, I can see the following as output on the ps -ef | grep 'java' command:
1000 4758 4752 0 20:32 ? 00:00:00 sh -c java -Djetty.port\=8982 -Dsolr.data.dir\=/home/panayotis/my_documents/ezMTA/solr/data/development -Dsolr.solr.home\=/home/panayotis/my_documents/ezMTA/solr -Djava.util.logging.config.file\=/tmp/logging.properties20120902-4758-13patuu -jar start.jar
1000 4761 4758 7 20:32 ? 00:00:01 java -Djetty.port=8982 -Dsolr.data.dir=/home/panayotis/my_documents/ezMTA/solr/data/development -Dsolr.solr.home=/home/panayotis/my_documents/ezMTA/solr -Djava.util.logging.config.file=/tmp/logging.properties20120902-4758-13patuu -jar start.jar
This means that the real server process is the one with pid "4761". Process "4758" is only there to start the server in a shell.
When I cat the pid file I see:
cat solr/pids/development/sunspot-solr-development.pid
4758
Which means that rake sunspot:solr:stop is killing "4758" and leaves "4761" up and running.
it's a bug!
1000 4758 4752 0 20:32 ? 00:00:00 sh -c java -Djetty.port\=8982 - Dsolr.data.dir\=/home/panayotis/my_documents/ezMTA/solr/data/development -Dsolr.solr.home\=/home/panayotis/my_documents/ezMTA/solr -Djava.util.logging.config.file\=/tmp/logging.properties20120902-4758-13patuu -jar start.jar
1000 4761 4758 7 20:32 ? 00:00:01 java -Djetty.port=8982 -Dsolr.data.dir=/home/panayotis/my_documents/ezMTA/solr/data/development -Dsolr.solr.home=/home/panayotis/my_documents/ezMTA/solr -Djava.util.logging.config.file=/tmp/logging.properties20120902-4758-13patuu -jar start.jar
because process 4758 is a foreground process, but process 4761 is a background process,so if you kill pid 4758,it will not destroy his child process 4761, the init process will become process 4761's parent!
in sunspot_solr/lib/sunspot/solr/server.rb #line 103
exec(Shellwords.shelljoin(command))
Shellwords.shelljoin(command) is a string,but Kernel#exec descrip:
exec([env,] command... [,options])
If single string is given as the command, it is taken as a command line that is subject to shell expansion before being executed.The standard shell means always "/bin/sh" on Unix-like systems.
so,it will start two process.
use this:
exec(*command)
will start one process,so rake sunspot:solr:stop will work correct.
see this pull request
I have downgraded to 'sunspot_solr', '1.3.1' and now it works ok.
Set env like this - RAILS_ENV=production rake sunspot:solr:stop