Solved

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

Posted on 2016-08-02
12
336 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 
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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Windows 10 Creator Update has just been released and I have it working very well on my laptop. Read below for issues, fixes and ideas.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
This video teaches viewers about errors in exception handling.

695 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