Re: Monitoring memory usage of JVM
Hi all, I don't know if this is useful but apart from utilities/commands already mentioned, I use the following to monitor the GC of the particular generations in JVM: /usr/jdk/jdk1.5.0_12/bin/jstat -gc $TOMCAT_PID 5000 10 Of course you need to substitute the appropriate JDK installed on your system and the time interval the stats should be printed. Cheers, Igor On Fri, May 27, 2011 at 6:07 PM, Mikolaj Rydzewski wrote: > On Fri, 27 May 2011 09:50:06 +0200, André Warnier wrote: > > Searching the WWW, I am finding (too) many interpretations of the >> output of "-verbose:gc" (or "-verbosegc", none of them starting from >> exactly the format above. >> I can kind of guess what the above means, but where can I find an >> "authoritative" interpretation for Sun/Oracle Java 1.6 ? >> >> Also, does anyone know if there is a way to specify that instead of >> the unreadable leading timestamp above, one can get a nicely-formatted >> one ? >> (-XX:+PrintGCTimeStamps ?) >> > > I use the following options: > > -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps > > We use nice tool from HP (HPJmeter) at work. It parses GC logfile and > produces various graphs. I guess you can download it for free from > www.hp.com/go/java > > -- > Mikolaj Rydzewski > > > - > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >
Re: Monitoring memory usage of JVM
On Fri, 27 May 2011 09:50:06 +0200, André Warnier wrote: Searching the WWW, I am finding (too) many interpretations of the output of "-verbose:gc" (or "-verbosegc", none of them starting from exactly the format above. I can kind of guess what the above means, but where can I find an "authoritative" interpretation for Sun/Oracle Java 1.6 ? Also, does anyone know if there is a way to specify that instead of the unreadable leading timestamp above, one can get a nicely-formatted one ? (-XX:+PrintGCTimeStamps ?) I use the following options: -Xloggc:gc.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps We use nice tool from HP (HPJmeter) at work. It parses GC logfile and produces various graphs. I guess you can download it for free from www.hp.com/go/java -- Mikolaj Rydzewski - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Monitoring memory usage of JVM
Pid wrote: On 26/05/2011 21:50, André Warnier wrote: André Warnier wrote: Pid wrote: On 26/05/2011 20:16, Caldarale, Charles R wrote: From: André Warnier [mailto:a...@ice-sa.com] Subject: Monitoring memory usage of JVM I am thinking of a couple of command-line options for the JVM, to dump for example some information each time a GC happens, Try -verbose:gc and -Xloggc: The jmap & jstat commands shipped with the JDK are also useful. Thanks to both. I'll try these out. For now, I have used the "-verbose:gc and -Xloggc:" command-line options, and added the jmap command into one of the other monitoring shell scripts I created. I'll have to wait for the next GC to see the output of the switches. As the application isn't doing anything right now, that could take a while. But a question about "jstat" in the meantime : In the documentation of jstat, it has this to say about the /lvmid/ part : port The default port for communicating with the remote server. If the hostname is omitted or the protocol specifies an optimized, local protocol, then port is ignored. Otherwise, treatment of the port parameter is implementation specific. For the default rmi protocol, the port indicates the port number for the rmiregistry on the remote host. If port is omitted, and protocol indicates rmi, then the default rmiregistry port (1099) is used. Is this the same port which I otherwise set for jconsole, iow via the option : -Dcom.sun.management.jmxremote.port= Yes, AFAIK. There's also a companion utility 'jstatd'. I'll just continue adding here, so that everything stays together. the output of the "-verbose:gc" switch looks as follows : ... 36980.453: [GC 479482K->271910K(994752K), 0.0135340 secs] 37085.411: [GC 511334K->269236K(992320K), 0.0130770 secs] 37750.377: [GC 508660K->276295K(999168K), 0.0124960 secs] 38078.813: [GC 524999K->286052K(997184K), 0.0077580 secs] 38187.341: [GC 534756K->295781K(1004032K), 0.0096650 secs] 38341.838: [GC 553765K->300854K(1001600K), 0.0230050 secs] ... Searching the WWW, I am finding (too) many interpretations of the output of "-verbose:gc" (or "-verbosegc", none of them starting from exactly the format above. I can kind of guess what the above means, but where can I find an "authoritative" interpretation for Sun/Oracle Java 1.6 ? Also, does anyone know if there is a way to specify that instead of the unreadable leading timestamp above, one can get a nicely-formatted one ? (-XX:+PrintGCTimeStamps ?) By the way, I know that there is an over-abudance of articles on the WWW about Java memory tuning, but here is one I found serendipitiously : http://fedora.fiz-karlsruhe.de/docs/Wiki.jsp?page=Java%20Heap%20%26%20GC%20Tuning Even if it appears to have been written mainly for one kind of application, it is short, readable, to-the-point, and I think usable in a broader context. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Monitoring memory usage of JVM
On 26/05/2011 21:50, André Warnier wrote: > André Warnier wrote: >> Pid wrote: >>> On 26/05/2011 20:16, Caldarale, Charles R wrote: >>>>> From: André Warnier [mailto:a...@ice-sa.com] Subject: Monitoring >>>>> memory usage of JVM >>>>> I am thinking of a couple of command-line options for the JVM, >>>>> to dump for example some information each time a GC happens, >>>> Try -verbose:gc and -Xloggc: >>> >>> The jmap & jstat commands shipped with the JDK are also useful. >>> >>> >> Thanks to both. >> I'll try these out. >> > For now, I have used the "-verbose:gc and -Xloggc:" command-line > options, and added the jmap command into one of the other monitoring > shell scripts I created. > I'll have to wait for the next GC to see the output of the switches. As > the application isn't doing anything right now, that could take a while. > > But a question about "jstat" in the meantime : > In the documentation of jstat, it has this to say about the /lvmid/ part : > > port > The default port for communicating with the remote server. If the > hostname is omitted or the protocol specifies an optimized, local > protocol, then port is ignored. Otherwise, treatment of the port > parameter is implementation specific. For the default rmi protocol, the > port indicates the port number for the rmiregistry on the remote host. > If port is omitted, and protocol indicates rmi, then the default > rmiregistry port (1099) is used. > > Is this the same port which I otherwise set for jconsole, iow via the > option : > -Dcom.sun.management.jmxremote.port= Yes, AFAIK. There's also a companion utility 'jstatd'. p signature.asc Description: OpenPGP digital signature
Re: Monitoring memory usage of JVM
André Warnier wrote: Pid wrote: On 26/05/2011 20:16, Caldarale, Charles R wrote: From: André Warnier [mailto:a...@ice-sa.com] Subject: Monitoring memory usage of JVM I am thinking of a couple of command-line options for the JVM, to dump for example some information each time a GC happens, Try -verbose:gc and -Xloggc: The jmap & jstat commands shipped with the JDK are also useful. Thanks to both. I'll try these out. For now, I have used the "-verbose:gc and -Xloggc:" command-line options, and added the jmap command into one of the other monitoring shell scripts I created. I'll have to wait for the next GC to see the output of the switches. As the application isn't doing anything right now, that could take a while. But a question about "jstat" in the meantime : In the documentation of jstat, it has this to say about the /lvmid/ part : port The default port for communicating with the remote server. If the hostname is omitted or the protocol specifies an optimized, local protocol, then port is ignored. Otherwise, treatment of the port parameter is implementation specific. For the default rmi protocol, the port indicates the port number for the rmiregistry on the remote host. If port is omitted, and protocol indicates rmi, then the default rmiregistry port (1099) is used. Is this the same port which I otherwise set for jconsole, iow via the option : -Dcom.sun.management.jmxremote.port= ? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Monitoring memory usage of JVM
Pid wrote: On 26/05/2011 20:16, Caldarale, Charles R wrote: From: André Warnier [mailto:a...@ice-sa.com] Subject: Monitoring memory usage of JVM I am thinking of a couple of command-line options for the JVM, to dump for example some information each time a GC happens, Try -verbose:gc and -Xloggc: The jmap & jstat commands shipped with the JDK are also useful. Thanks to both. I'll try these out. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Monitoring memory usage of JVM
On 26/05/2011 20:16, Caldarale, Charles R wrote: >> From: André Warnier [mailto:a...@ice-sa.com] >> Subject: Monitoring memory usage of JVM > >> I am thinking of a couple of command-line options for the JVM, >> to dump for example some information each time a GC happens, > > Try -verbose:gc and -Xloggc: The jmap & jstat commands shipped with the JDK are also useful. p signature.asc Description: OpenPGP digital signature
RE: Monitoring memory usage of JVM
> From: André Warnier [mailto:a...@ice-sa.com] > Subject: Monitoring memory usage of JVM > I am thinking of a couple of command-line options for the JVM, > to dump for example some information each time a GC happens, Try -verbose:gc and -Xloggc: - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Monitoring memory usage of JVM
Hi. Tomorrow morning (European time), we are planning a moment of peak usage of one Java daemon application. It is not Tomcat, but it behaves in a manner similar to Tomcat, in the sense that it listens on a TCP port, processes quasi-HTTP requests, creates threads as needed to process these requests, manages kind of sessions etc.. It is not our application and we do not have the source code. Our biggest concern is the amount of memory it will use under the predicted high load, as for each "session" it needs to parse and keep in memory the contents of a moderate-size XML file. We would like to monitor the memory usage of that JVM, but in a way that in itself does not impact the performance too much. Basically what we want, is to keep some information in a logfile, which in case of serious problem with memory would allow us to get a clue as to what is happening via some post-mortem analysis. So not just a dying dump, nor a nice GUI interface, but more in-between, like a trace log that gives us some "snapshots" on a minute-by-minute base (on on a GC-cycle base) of the evolution under load. Preferably also, not something that takes a big effort to set up. I am thinking of a couple of command-line options for the JVM, to dump for example some information each time a GC happens, but among the array of available switches I do not really know what to pick as a reasonable compromise. Since this place is packed with Java gurus (what we are not), any quick suggestions anyone ? Thanks. Oh, and here is the environment info : # java -version java version "1.6.0_22" Java(TM) SE Runtime Environment (build 1.6.0_22-b04) Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode) The JVM of the application is started with "-Xms1024M -Xmx2048M", and no additional non-standard GC-related options right now. The host has a total of 12 GB RAM, of which only maybe half is really used for now. # uname -a Linux vixen2 2.6.26-2-amd64 #1 SMP Tue Jan 25 05:59:43 UTC 2011 x86_64 GNU/Linux - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org