Java Memory Monitoring in Web Application

Hi All,
Request you to please review the below mentioned suggestion and provide inputs:
Over the years, I have been involved in some projects involving web development in J2ee. JAVA memory usage is an issue that is common amongst all.
Following are some of the questions that come across to a developer regarding the JAVA memory:
Memory Usage Statistics.
Trending of Memory statistics.
Memory Leak.
Performance optimization in case memory leaks occur.
When it comes to answering the above, the most common suggestion is to enable heap dumps and analyze it using a heap analyzer tool. However, there are times and projects where these options are not approved off and developer is always asked to review code again and again. This is again a frustrating option for someone who has just joined a maintenance project and reading through code is not a feasible option. It has happened to me and I did the following to solve some of my problems and eventually all.
Instead of analyzing heap dumps, I decided to do the following:
Add a request filter to my J2EE application.
Add following log statements in the filter:
URL fired.
Runtime.getRuntime().freeMemory()
Runtime.getRuntime().totalMemory()
Runtime.getRuntime().maxMemory()
Gather data from daily app usage and build some trending statistics.
Not only were we able to decide an optimum memory setting for our server, we were able to detect leaks as well. However, i agree detecting leaks wasn't as simple as it's with other tools considering the debugging effort that's involved.It is not a conventional approach but come sin handy when projects don't want to involve costs and maintain equilibrium at production systems as well.

Hi,
Few questions!
1> Have you tweaked your jvm?
2> What are the values given for Xms and Xmx?
3> What is the size of XX:MaxPermGen?
4> How much RAM is available on the system where you have deployed your app?
5> Are you using pre-complied JSPs for faster response?
6> Which JDK are you using?
7> Have you tried using latest version of Tomcat?
8> If these doesnt help, use any profiler to find the leak. <JProfiler, JVMTI, YourKit profiler etc>
I hope answering these questions would help you :)
njoy!

Similar Messages

  • How to capture memory usage for web application

    In OATS openscripts, how to capture memory usage for web application? Does it have the exisitng java method that we can call to get the memory data (e.g. peak bytes, private bytes) consumed by web application?

    JProbe

  • Possible for JRockit Mission Control to Monitor Multiple Web Applications

    I have some questions regarding JRockit and Weblogic Server.
    The JRockit Mission Control allows users to monitor JRockit JVMs.
    If a JVM runs a Weblogic server instance which runs a couple of web aplications, is it possible to monitor individual web applications separately?
    If it's possible, is there any kind soul who can guide me through the process in setting up.
    Please assist. Many Thanks!
    Thanks,
    Benjamin

    Hi,
    You can use *"wlnav.war"* which is freely available on net. to monitor Servers along with some of the Application attributes like application state/ Session count/ ...etc
    "wlnav.war" actually uses WebLogic MBeans to get the details of the Server and Applications...Same thing we can do using our own MBean JMX Codes as well... But still these JMX codes will not be able to tell exactly that which object belongs to which Application.
    Thanks
    Jay SenSharma
    http://weblogic-wonders.com/weblogic/jmx_weblogic/  (WebLogic Wonders Are Here)

  • Memory Leak in web application created using j2ee

    Hi,
    Our company has one web application, provided by "X" vendor. this application has many JSPs and many TLDs used. The basic behaviour of the apoplication is to connect to the database (Oracle) get the information and show it to the user.
    We deployed this web application in Tomcat 5.0.25 in the windows environment. One thing we observed here is, when we login to the application the tomcat5.exe process increses its memory. and when we logout, it does not come down to the original position. similar things happen when we search for some of the data using there provided searches.
    We have some code developed which uses httpclient to login to this web application (created for performace testing). This code initially logs in 50 users which goes fine, then logs in 100 users which also goes fine but after this 100 users we ran the code for 50 users agian but this time it threw OutOfmemory exception:Java heap space error.
    we are observing the memory in the Task Manager in windows.
    Can anyone tell me what could be the cause of this? is it the web application causing problem or is tomcat caching some pages into the memory and is not releasing them?

    Hi,
    Few questions!
    1> Have you tweaked your jvm?
    2> What are the values given for Xms and Xmx?
    3> What is the size of XX:MaxPermGen?
    4> How much RAM is available on the system where you have deployed your app?
    5> Are you using pre-complied JSPs for faster response?
    6> Which JDK are you using?
    7> Have you tried using latest version of Tomcat?
    8> If these doesnt help, use any profiler to find the leak. <JProfiler, JVMTI, YourKit profiler etc>
    I hope answering these questions would help you :)
    njoy!

  • Clear memory in my web application

    HI,
    In my web application I need to keep the memory as much minimum as possible. among the 2 gb memory when all the componnets of my application are running it takes 300 MB. Is there anyway that I could flush out the unused memory from the jvm.
    Garbage colllector will take care of that but I have some other requirement where I need more memory hence I would to flush the unused memory periodically
    Thanks,
    R.Ramesh.

    GC will worry about it. Don't worry about it yourself.
    If you run out of memory, then the GC has really already done its work. Trust it. There is simply nothing more to free. So either your code is simply eating/leaking memory or you really need to supply more memory.

  • Java.lang.NoClassDefFoundError in web application

    Hello all,
    We have a J2EE app running in OC4J 903. One Struts action class uses our custom build jsp tag library (dataview.jar). Compilation no errors. After deploying all the action classes are in WEB-INF\classes dir and out tag library (dataview.jar) is in WEB-INF\lib directory (and no where else in the project).
    When we run the application in the browser, whenever we hit the code related to the tag library, it gives the following error:
    java.lang.NoClassDefFoundError: com/xyz/tag/dataview/GridTag
    Thank you so much for helping out.
    Regards,
    Prasad.

    kept the jars under APP-INF/lib

  • Java Script in Bex Web Application Designer

    I have created a web template in Bex WAD, written some java script function, i want to call this function on page load of every page,currently this function is getting called as soon as the first page is loaded but when i click on Next page or Prev page to show next 100 records then this function is not getting called, is there any way where in this function should be called always when user moves from one page to another.

    Hi thirumurugan
    The following link will solve your problem..
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c01e9b01-abab-2d10-6687-96fc7bc39084?quicklink=index&overridelayout=true
    Regards,
    Ranganath.

  • Passing Parameters via Post Method from Webdynpro Java to a web application

    Hello Experts,
    I want to pass few parameters from a web dynpro application to an external web application.
    In order to achieve this, I am referring to the below thread:
    HTTP Post
    As mentioned in the thread, I am trying to create an additional Suspend Plug parameter (besides 'Url' of type String) with name 'postParams' and of type Map.
    But when I build my DC, I am getting the same error which most of the people in the thread have mentioned:
    Controller XXXCompInterfaceView [Suspend]: Outbound plug (of type 'Suspend') 'Suspend' may have at most two parameters: 'Url' of type 'string' and 'postParams' of type 'Map'.
    I am using SAP NetWeaver Developer Studio Version: 7.01.00
    Kindly suggest if this is the NWDS version issue or is it something else that I am missing out.
    Also, if it is the NWDS version issue please let me know the NWDS version that I can use to avoid this error.
    Any other suggestion/alternative approach to pass the parameters via POST method from webdynpro java to an external web application apart from the one which is mentioned in the above thread is most welcome.
    Thanks & Regards,
    Anurag

    Hi,
    This is purely a java approach, even you can try this for your requirement.
    There are two types of http calls synchronous call or Asynchronous call. So you have to choose the way to pass parameters in post method based on the http call.
    if it is synchronous means, collect all the values from users/parameters using UI element eg: form and pass all the values via form to the next page is nothing but your web application url.
    If it is Asynchronous  means, write a http client in java and integrate the same with your custom code and you can find an option for sending parameters in post method.
    here you go and find the way to implement Asynchronous  scenario,
    http://www.theserverside.com/news/1365153/HttpClient-and-FileUpload
    http://download.oracle.com/javase/tutorial/networking/urls/readingWriting.html
    http://digiassn.blogspot.com/2008/10/java-simple-httpurlconnection-example.html
    Thanks & Regards
    Rajesh A

  • Problem While Deploying Java Web Application(Struts,Hiber) on NetWeaver 7.3

    Hi
    Fortunately i had a requirement to deploy my project JAVA (Struts, Hiber, DOJO)web application build as war file using Eclipse 3.4 on SAP Net Weaver 7.3
    Its showing in the Deployed Components List of NetWeaver ...
    When i tried to open the home page i found an exception ...
    The following is the log file content ... Hope its something related to hibernate ...
    >deploy s:\usr\sap\trans\EPS\in\LMSDemo.war on_deploy_error=stop
    Converting s:\usr\sap\trans\EPS\in\LMSDemo.war to sda
    s:\usr\sap\trans\EPS\in\LMSDemo.war has been successfully converted to sda
    Deploy settings:
    life_cycle=bulk
    on_deploy_error=stop
    on_prerequisite_error=stop
    version_rule=lower
    workflow=normal
    If there is an offline deployment, Telnet connection to host may be lost, but th
    e result can be seen using get_result command
    Processing deployment operation, wait...
    ===== PROGRESS START =====
    Deploying JavaEE_LMSDemo (sda) ...
    Deployment of JavaEE_LMSDemo (sda) finished.
    ===== PROGRESS END =====
    ===== DEPLOY RESULT =====
    sdu id: JavaEE_LMSDemo
    sdu file path: [S:\usr\sap\N73\J10\j2ee\cluster\server0\temp\tcbldeploy_contro
    ller\archives\31\263890545832850\SDA\LMSDemo.war]
    version status: NEW
    deployment status: Warning
    description: [
    1. Warning exception has been returned while the [] was starting. Warnings:[
    Warning occurred on server 102466650 during startApp of JavaEE/LMSDemo : com.sap
    .ASJ.web.000607 (Failed in component: JavaEE/LMSDemo, ) Initialization of servle
    t action failed. Check init() method of servlet. Error is: [javax.servlet.Unav
    ailableException: org/slf4j/LoggerFactory]
    ===== END DEPLOY RESULT =====
    ===== Summary - Deploy Result - Start =====
    Type | Status : Count
    > SCA(s)
    > SDA(s)
    - Warning : [1]
    Type | Status : Id
    > SCA(s)
    > SDA(s)
    - Warning : JavaEE_LMSDemo,
    ===== Summary - Deploy Result - End =====
    >
    Does anyone knows this ..

    In your deploy message it says that it can't initialize your servlet because it is missing a java class from the logging framework that is used by hibernate. It might also be possible that that logging framework ([SL4J|http://www.slf4j.org/]) is configured to use a logger that is not available in your Netweaver 7.3 installation. Maybe check the documentation of sl4j for details. There is also a [document|http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/bf0d57db-0c01-0010-6fa3-83503981eed4] about Hibernate on Netweaver but that was back when Hibernate did not use sl4j. Probably you just need to add the sl4j library to your libs.

  • SCOM 2012 R2 - How to create a Web Application Monitor for an URL requiring certificate authentication

    Hi All,
    It looks like in SCOM 2012 there are two ways to monitor a web application (URL monitoring):
    Way no 1: (Using the Web Application Transaction Monitoring template)
    Way no 2: (Using the Web
    Application Availability Monitoring template)
    We have created some monitors using
    Web Application Availability Monitoring to check if URL is up without any authentication method.
    However, we have few URLs for which we need Client Certificates to be used for accessing them but found no option in SCOM 2012 to configured the certificates. 
    I have searched a lot on the Tech Net library but no clue.  Does anyone know how to successfully monitor an URL requiring certificate authentication on SCOM 2012 ? or, at least, using no matter which method?
    Thanks.
    Regards,
    Raju.

    Hi,
    Based on my research, it is not possible by using the built-in monitoring templates. Both of them handles “normal”, server-side, SSL-certs, and the transaction monitor handles basic/digest/NTLM authentication, but client certificate based authentication
    is not a configurable option.
    Regards,
    Yan Li
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • How to Up load a Java project in the Web Server

    Hello friends,
    Can u please help me to sort out this problem i want to upload my java project ie a web application with some database operations like add,delete,update.
    I took webspace in the webserver and from the client system i have to upload my Application please help me.
    Thanks
    Ramesh Nagu

    Hello friends,
    Can u please help me to sort out this problem i want to upload my java project ie a web application with some database operations like add,delete,update.
    I took webspace in the webserver and from the client system i have to upload my Application please help me.
    Thanks
    Ramesh Nagu

  • What happened to the JATO forum (id=103) AKA Web Application Framework

    What happened to the Jato forum? (id=103) AKA Web Application Framework
    I was available a few weeks ago? Now I'm redirected to this forum=122.

    Hi
    Starting March 1, 2005, Sun Java Studio Standard and Web Application Framework forums are merged into Sun Java Studio Enterprise forum. All forums' content will be saved and moved to its new location.
    You can post your WAF questions here.
    Thanks
    Srinivas

  • Memory Monitor API for web application

    Hello All,
    Does any one knows any API for monitoring memory of a certain web application ??
    Thanks in advance

    Are there any other ways to monitor jvm state besides JMX? I wonder if there is a specific API to monitor jvm's memory. JMX is the specific API used to create software that monitors the memory in the JRE.
    If you want to monitor memory of an application, and don't feel like writing a program to monitor memory, you can use the JConsole application that comes with the Java JDK.

  • SSO from portal to Java based web application not happening

    Hi,
    We are trying to configure SSO from SAP Enterprise portal with Java based
    web application(Solaris on SPARC 64 bit).
    Then we downloaded library files for "Solaris on SPARC 64 bit" from
    service market place from the path "Support Packages and Patches"
    Additional Components" SAPSSOEXT".
    We are successful in sending the portal side cookie to the application.
    But while loading the library files we get the following error
    INFO | jvm 1 | 2009/04/13 04:47:00 | java.lang.UnsatisfiedLinkError:
    /usr/local/blackboard/apps/tomcat/lib/libsapssoext.so: ld.so.1: java:
    fatal: /usr/local/blackboard/apps/tomcat/lib/libsapssoext.so: wrong ELF
    class: ELFCLASS64 (Possible cause: endianness mismatch)
    Can you please suggest us what went wrong in this whole process.
    But when i tried with the 32 bit library files i was able to load libsapssoext.so file but when I
    tried to initialize libsapsecu.so i got the below message
    java.lang.Exception: MySapInitialize failed: rc= 14
    Also do we require to take"SAPSECULIB" from Support Packages and Patches" ...>Additional Components" ...>SAPSECULIB" ...>SAPSECULIB 5.4  for this SSO activity.
    Please get back on this ASAP as we are nearing the golive date.
    regards
    Bharath

    hi,
    am facing similar issue... i.e.
    java.lang.Exception: MySapInitialize failed: rc= 14
            at com.mysap.sso.SSO2Ticket.init(Native Method)
            at com.mysap.sso.SSO2Ticket.<clinit>(SSO2Ticket.java:27)
            at org.apache.jsp.index_jsp._jspService(index_jsp.java:92)
            at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
            at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
            at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
            at java.lang.Thread.run(Thread.java:619)
    static beendet.
    java.lang.Exception: MySapEvalLogonTicketEx failed: standard error= 9, ssf error= 0
    CustomeSSO: Object is null.
    pls. help me in resolving it.
    rgds,
    santosh malavade

  • Web Service data source report causes Java memory leak

    Crystal Report designer fails to preview a report whose data source is a WSDL web service.  This happens when the Java run time process has exceeded the memory limit specified in the CRConfig.xml file.  The Java memory is never released by Crystal Reports until the Crystal Reports Designer is closed.  Version is Crystal reports 2008 (product version 12.2.4.507).
    This error also occurs in the Crystal Reports Viewer when used in a Microsoft .NET application (framework 3.5) referencing CrystalDecisions.CrystalReports.Engine.dll v12.0.2000.0, CrystalDecisions.Enterprise.Framework.dll v12.0.1100.0, CrystalDecisions.Enterprise.InfoStore.dll v12.0.1100.0, CrystalDecisions.ReportSource.dll v12.0.2000.0, CrystalDecisions.Shared.dll v12.0.2000.0
    I load the ReportDocument object based on the location of the .rpt file and then set the ReportSource object of the CrystalReportViewer control:
    string FullReportName = "TestFile.rpt";
    ReportDocument reportDoc = new ReportDocument();
    reportDoc.Load(FullReportName, OpenReportMethod.OpenReportByTempCopy);
    this.crystalReportViewer1.ReportSource = reportDoc;
    reportDoc.Close();
    reportDoc.Dispose();
    GC.Collect();
    The code displays the report in the report viewer.  However, every time the report is refreshed the Java runtime memory increases until the application cannot display the results.  The error messages are "Failed to retrieve data from the database." followed by "Cannot determine the queries necessary to get data for this report. Details: Unexpected error".  If you try to refresh the data once again the following errors occur: "Failed to retrieve data from the database." then "Cannot determine the queries necessary to get data for this report. Details: Schema file is invalid   Java heap space".
    Increasing the java heap space in the CRConfig.xml file merely prolongues the onset of this error.
    Is there a service pack or hot fix for this???
    PLEASE HELP.

    Many thanks for your help.  This solved the issue for our .NET code, however the leak is still present in the report designer.  I was also wondering if you could help further: because of the limits on the java memory process is there a way to ensure that a separate java process is started for each report that is loaded in my report viewers collection?  Essentially the desktop application that i have created uses a tab control to display each type report, so each tab goes through the following code when displaying a report and closing a tab:
    Is there a way to ensure that a different Java process is kicked off each time that I display a different report?  My current code in c# always uses the same Java process so the memory ramps up.  The code to load the report and then dispose of the report through closing the tab (and now the Java process) looks like this:
        private void LoadCrystalReport(string FullReportName)
          ReportDocument reportDoc = new ReportDocument();
          reportDoc.Load(FullReportName, OpenReportMethod.OpenReportByTempCopy);
          this.crystalReportViewer1.ReportSource = reportDoc;
        private void DisposeCrystalReportObject()
          if (crystalReportViewer1.ReportSource != null)
            ReportDocument report = (ReportDocument)crystalReportViewer1.ReportSource;
            foreach (Table table in report.Database.Tables)
              table.Dispose();
            report.Database.Dispose();
            report.Close();
            report.Dispose();
            GC.Collect();
    Thanks

Maybe you are looking for

  • Can't open an iOS Numbers file

    iOS apps are now updated automatically. That's fine. But when I try to open a file on my Mac that was updated on the iPad, it tells me I need the latest version of Numbers. I don't want to spend $20 on such a low rated application. Is there anyway to

  • How long should I wait to download OS5?

    After reading all the problems some of you are having I'm in no hurry to update my iPhone 4.  This has to be a bug in iTunes, the iPhone or OS5.  Or, it's a problem with the servers being overloaded by anxious iPhone owners.  Since I can live without

  • Pass a parameter to SAPurgeCacheByDatabase()

    Hi Experts, Is there any way to pass a parameter to the funtion SAPurgeCacheByDatabase() . if so how to do it? I tried: DEFINE var="DB"; Call SAPurgeCacheByDatabase(&var); but it's throwing a syntax error I have a bat file that calls PurgeCache.sql a

  • Ipad mini charger getting very hot

    ipad mini charger getting very hot. Not the ipad. What is it? A problem, or normal?

  • AUC negetive value

    Dear SAP Experts, In the Balance sheet AUC asset value is showing negetive amount,  actually the Client is using Plant wise balance for 5 plants. The negetive value is coming in 1000, 2000,3000 and 4000 plant which should come in Plant 9000 which is