Solved

How to find Tomcat initial memory and Max memory through command line windows

Posted on 2016-08-02
12
233 Views
Last Modified: 2016-08-22
Hi,
We have the tomcat variables set in the tomcatw.exe  JAVA options on windows, but I want to get the Java Initial memory and Java Max memory settings results in command line.

I tried jinfo -flags pid and catalina.exe version

Please help me with the command to get the initial memory and max memory pool settings of a tomcat instance.

Thanks
0
Comment
Question by:DevSupport
12 Comments
 

Author Comment

by:DevSupport
ID: 41740026
I am attaching the screenshots of the values which I am trying to retrieve through command line in windows, if my question is not clear enough.

Any help would be highly appreciated!.

Thanks
xmx-and-xms-settings-of-tomcat.jpg
0
 

Author Comment

by:DevSupport
ID: 41744447
May I know why this question is neglected? Is there no way to accomplish this? or is my question not clear enough?

Thanks
0
 
LVL 27

Expert Comment

by:rrz
ID: 41744886
I have been listening. I don't have a solution. I do wonder if you know about Tomcat's pre-installed manager app ? If you click on the "Server Status" button on Tomcat's home page, then you will see memory usage info(if you entered name and password in tomcat-users.xml file). Although that proves that the info can be obtained programmatically, I don't know how it is done.  I realize that you wanted to access the info on command line. I don't know about that.
1
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 41745152
Hi,

Give it a try with wmic + find command.

wmic process | find "java" | find "catalina"

Open in new window


I tried in my computer (on Win 7) and i can able to get the information (refer attached snap).

Basically, please play with wmic process command and check the list of processes it displays. Then
You may need to add more text to find specific (tomcat) process from the list if you multiple java processes are running.

Hope it helps.
0
 

Author Comment

by:DevSupport
ID: 41748843
I tried it in a single java application instance with tomcat 8 and its not working
0
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 41748880
On a command window, can run below command (by keeping tomcat running) and share generated text file ?

wmic process >> processes.txt
0
 

Author Comment

by:DevSupport
ID: 41748947
Please find attached result. I took this while tomcat is running as a service.
0
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 41748992
Seems you missed to attach a file.
0
 

Author Comment

by:DevSupport
ID: 41749138
Sorry! Here it is.

Thanks
processes-results.txt
0
 

Accepted Solution

by:
Roger Wilko earned 250 total points
ID: 41762894
Hi,

first, I am not a Windows expert, but probably the easiest way is to query the registry as these values are stored there. On Windows 2008 R2 server, the java params are stored within the following key(s):

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation

Open in new window


So getting the values needed, use the command "REQ QUERY":

REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation" /s /f "JvmM" 

Open in new window


The output will look like this:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\Procrun 2.0\tomcat06\Parameters\Java 
    JvmMs    REG_DWORD    0x400 
    JvmMx    REG_DWORD    0x800 

Open in new window


This is an example for a tomcat instance called "tomcat06".  Having more instances will result in an extended output, but anyway you will need to parse the output. The "REG_DWORD" value is stored in HEX, so there is a need to convert it. In this case JvmMs (initial Ram) => 1024 MB and JvmMx (max Ram) => 2048.

Specifying  the "/f" filter, can narrow down the output.

I am pretty sure, you can manage to parse the output via powershell or even batch. My expertise would be more unix orientated parsing languages.

Greetings
0
 
LVL 21

Assisted Solution

by:Amitkumar Panchal
Amitkumar Panchal earned 250 total points
ID: 41762920
Agree with Roger. This one is better than I suggested. Here, we don't require tomcat to be started.
0
 

Author Closing Comment

by:DevSupport
ID: 41765342
The response from Roger worked really well for my requirement. Thank You!
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question