Troubleshooting JVM Memory Growth issues

Source: Internet
Author: User

Troubleshooting JVM Memory Growth Issues

Check for a continuous increase in the memory footprint of the JVM, record it, warning.

Operations Discovery Application JVM memory consumption after release, and then continue to increase, after the dump analysis:

Most of the memory is the bean with similar names, where does it produce so many similar beans?

The app uses the dynamic language groovy, which dynamically gets the script execution when the logic is requested.

The core code is that the groovy script is turned into a spring IOC-managed bean and needs to be injected with other beans:

 Public<T> T getscriptedobject (String scriptname, String scriptsource, class<t>CLS) {    if(Stringutils.isempty (scriptsource))Throw NewRuntimeException ("service script" + scriptname + "Empty"); Groovyobject Goo=NULL; Class CLZ=NULL; Try{CLZ=Groovyclassloader.parseclass (Scriptsource); Goo=(Groovyobject) clz.newinstance (); if(NULL!=beanfactory) {beanfactory.autowirebeanproperties (Goo,1,true); }    } Catch(Unsatisfieddependencyexception ex) {//ex.printstacktrace ();}Catch(Exception ex) {Logger.error ("Script {} exception: {}", ScriptName, ex); Throw NewRuntimeException (ex); }    if(Cls.isassignablefrom (Goo.getclass ())) {return(T) goo; } Else {        Throw NewRuntimeException ("script" + scriptname + "error"); }}

The code that produces the bean must be a number of examples:
beanfactory.autowirebeanproperties (Goo, 1, True);
Sure enough

The solution is to add a cached map in the outer layer, to ensure that the singleton, so will lose the script without the advantages of convenient modification logic, so to do a clear map of the function can be triggered manually, can also be timed trigger.
The problem is solved because the development is not well understood in the Spring API implementation.

--------------------------

Thanks for having you all the way

Troubleshooting JVM Memory Growth issues

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.