Is there a way to capture the RTC free memory over time ?
We are concerned with the low free memory displayed on the jts/admin server page, we have seen it often
enough below 10%, sometimes as low as 1% as illustrated below. Want to motitor the free memory, how can we log this against time ?
Uptime 9 hours, 58 minutes
Public URI https://..... Diagnostics OK VM Memory Usage Maximum Memory Allocation 10000 MB Current Memory Allocation 10000 MB Free Memory 1 % |
2 answers
If you have concern on the Java heap size usage, you can think about to enable GC log and use Garbage Collection and Memory Visualizer to analyze the memory usage.
Please have a look the link:
http://www.ibm.com/developerworks/java/jdk/tools/gcmv/
http://publib.boulder.ibm.com/infocenter/ieduasst/v1r1m0/index.jsp?topic=/com.ibm.iea.was_v7/was/7.0/ProblemDetermination/WASv7_GCMVOverview/player.html
|
I have a Perl script which I use to periodically gather memory statistics and use the results to post to a web page. I based it off other Perl scripts that have been shared here.
Here is a similar framework: https://jazz.net/library/article/1017 Here is the snipped that gets some of the info: #!/usr/bin/perl use XML::XPath; use XML::XPath::XMLParser; use Data::Dumper; use XML::Simple; use Carp; use LWP::UserAgent; # this is not the complete file, only for demonstration purpose sub getServiceInfo { my ($JazzUser,$JazzPass,$JazzURI)=@_; my $browser = LWP::UserAgent->new(); my $ur=$JazzURI; $ur =~ s/\/rootservices//; $browser->cookie_jar({ file => "$ENV{HOME}/.cookies.txt" }); push @{ $browser->requests_redirectable }, 'POST'; $response = $browser->get( $ur . "/secure/service/com.ibm.team.repository.service.internal.webuiInitializer.IWebUIInitializerRestService/initializationData"); $response = $browser->post( $ur . "/j_security_check", [ j_username => $JazzUser, j_password => $JazzPass ], ); carp "$url error: ", $response->status_line unless $response->is_success; if ($response->code != 500) { $URI = $ur . "/service/com.ibm.team.repository.service.internal.IServerStatusRestService/ServerInfo" ; $response = $browser->get($URI); $response->{'_content'}; } else { ""; } } # main program my ($id,$pw,$url);#=@ARGV; $id="a_jazz_admin_user_id"; $pw="the_password"; %friends=(); %srvrs=(); $collected_secs=time(); $collected_at=scalar localtime($collected_secs); $| = 1; print "<h2>Jazz Server Status Collected $collected_at</h2>\n"; #print "<table class='basic-table' cellspacing='1' cellpadding='0' 'border='0'> #<tr class='blue-med-dark'><th>URI</th><th>Version</th><th>Up Since</th><th>JVM Max</th><th>JVM Used</th><th>JVM Free</th></tr>\n"; $n=0; while (<>) { chomp; $url="https://".$_."/rootservices"; $host_port_contxt=$url; #$srvrs{$host_port_contxt}->{'version'}=getVersion($id,$pw,$url); #$srvrs{$host_port_contxt}->{'name'}=getName($id,$pw,$url); $info=getServiceInfo($id,$pw,$url); if ($info ne "" ) { $srvrs{$host_port_contxt}->{'metrics'}=$info; } # print Dumper ($srvrs{$host_port_contxt}); if (exists($srvrs{$url})) { $xp = new XML::XPath($srvrs{$url}->{'metrics'}); $mm = $xp->find("/soapenv:Envelope/soapenv:Body/response/returnValue/value/maxMemory"); foreach $x ($mm->get_nodelist) { $maxMemory=$xp->getNodeText($x)/1048576; } $tm = $xp->find("/soapenv:Envelope/soapenv:Body/response/returnValue/value/totalMemory"); foreach $x ($tm->get_nodelist) { $totalMemory=$xp->getNodeText($x)/1048576; } $fm = $xp->find("/soapenv:Envelope/soapenv:Body/response/returnValue/value/freeMemory"); foreach $x ($fm->get_nodelist) { $freeMemory=$xp->getNodeText($x)/1048576; } $ut = $xp->find("/soapenv:Envelope/soapenv:Body/response/returnValue/value/uptime"); foreach $x ($ut->get_nodelist) { $upTime=$xp->getNodeText($x); $collected_secs=time(); # $upSince = scalar localtime($collected_secs - $upTime/1000); ($sec,$min,$hr,$md,$mn,$yr,$wd,$yd,$dst)=localtime($collected_secs - $upTime/1000); $upSince = sprintf "%04.4d/%02.2d/%02.2d %0.2d:%0.2d:%0.2d ",$yr + 1900 ,$mn+1,$md,$hr,$min,$sec; } $ut = $xp->find("/soapenv:Envelope/soapenv:Body/response/returnValue/value/publicURI"); foreach $x ($ut->get_nodelist) { $URI=$xp->getNodeText($x); } $ut = $xp->find("/soapenv:Envelope/soapenv:Body/response/returnValue/value/version"); foreach $x ($ut->get_nodelist) { $version=$xp->getNodeText($x); } if ($n % 2 == 0) { $tr="class=\"even\""; } else { $tr = "" }; $n=$n+1; printf "%s,%s,%s,%.2f,%.2f,%.2f,%d\n",$URI,$version,$upSince,$maxMemory,$totalMemory,$freeMemory,$upTime/1000; #printf "<tr %s><td>%s</td><td>%s</td><td>%s</td><td>%.2f</td><td>%.2f</td><td>%.2f</td><td></tr>\n",$tr,$URI,$version,$upSince,$maxMemory,$totalMemory,$freeMemory; } } As input I hand a file of the URL that I'd like to collect ( e.g. https://jts01:9443/jts https://rtc01:9443/ccm https://rqm01:9443/qm and so on Search this site for "ServerInfo" or IStatusRestService to find other possible examples. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.
Comments
For Java applications, unless you encounter some obvious problems such as OOME or slowness (due to excessive GC activities), the low memory availability does not mean anything. Looking from a different angle, it may be a good thing because it means the memory is well utilized and most of the objects are in memory, not in the database or on the disk. Another thing to note is that normally JVM will only start GC when the heap is full, so high memory usage is nothing to worry about.