Jvm memory growth troubleshooting examples and jvm troubleshooting examples
Troubleshoot jvm memory Growth
Troubleshoot the problem that the jvm memory usage continues to increase. record it and take it as a warning.
The O & M team found that the jvm memory usage of the application fell back after the release and continued to increase. After dumping, it analyzed:
Public <T> T getScriptedObject (String scriptName, String scriptSource, Class <T> cls) {if (StringUtils. isEmpty (scriptSource) throw new RuntimeException ("service script" + scriptName + "blank"); policyobject goo = null; Class clz = null; try {clz = policyclassloader. parseClass (scriptSource); goo = (policyobject) 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 new RuntimeException (ex);} if (cls. isAssignableFrom (goo. getClass () {return (T) goo;} else {throw new RuntimeException ("script" + scriptName + "error ");}}
The bean Generation Code must be multiple examples:
BeanFactory. autowireBeanProperties (goo, 1, true );
Sure enough:
The solution is to add a cached map on the outer layer to ensure the singleton. This will lead to the loss of the advantage of convenient logic modification without the release of scripts. Therefore, we need to implement a map clearing function, it can be triggered manually or periodically.
The problem is solved because the internal implementation of spring api is not well understood during development.
--------------------------
Thank you ~