Solved

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

Posted on 2016-08-02
12
113 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 20

Expert Comment

by:Amitkumar Panchal
Comment Utility
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
Comment Utility
I tried it in a single java application instance with tomcat 8 and its not working
0
 
LVL 20

Expert Comment

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

wmic process >> processes.txt
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

Author Comment

by:DevSupport
Comment Utility
Please find attached result. I took this while tomcat is running as a service.
0
 
LVL 20

Expert Comment

by:Amitkumar Panchal
Comment Utility
Seems you missed to attach a file.
0
 

Author Comment

by:DevSupport
Comment Utility
Sorry! Here it is.

Thanks
processes-results.txt
0
 

Accepted Solution

by:
Roger Wilko earned 250 total points
Comment Utility
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 20

Assisted Solution

by:Amitkumar Panchal
Amitkumar Panchal earned 250 total points
Comment Utility
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
Comment Utility
The response from Roger worked really well for my requirement. Thank You!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
OfficeMate Freezes on login or does not load after login credentials are input.
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This video teaches viewers about errors in exception handling.

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now