วันอาทิตย์ที่ 6 ตุลาคม พ.ศ. 2556

Grails: ConfigSlurper Memory Leak

Last month, my team started load-testing a project which using Grails framework. Unexpected result happened, while it's load-tested for a couple of hour. "Out of memory" exception occurred in the log file. Firstly, my team suspected that jvm has low memory because what I'd search from internet said that Grails need minimum memory at 512mb when my server has 2 Grails-war in 512mb. But when memory’s incresed to 768mb, it’s still throw “Out of memory” exception. So we suspected which instance consume all of our memory.



We use VisualVM to investigate our CPU usage and memory usage. In the above picture, you’ll see that memory usage increase rapidly from 500mb to 768mb, maximum allowed memory, and never decrese although GC process.



From Heap histogram view, we see that org.codehaus.groovy.runtime.metaclass.MetaMethodIndex$Entry used all of our memory. We found that many of these instances reference to ConfigSluper$_parse_closure5.



When we search “grails configsluper memory leak” in google, we found some people have same problem with us. The blog that we found is below.
  • http://stackoverflow.com/questions/14200415/grails-configslurper-memory-leak
  • So we fix how we create ConfigSlurper and this is the result.





    Viola!

    Log4j didn't work when use Grails 2.2.1 with Jboss AS 7.1.1

    I’ve found that grails 2.2.1 has some issue with Jboss AS 7.1.1. Since this version of Jboss include some of logging libraries, grails will use libralies of Jboss instead of its own. So log doesn’t print into file that I’ve set in config.groovy. To solve this problem I’ve to change jboss-deployment-structure.xml such the below setting.

    วันเสาร์ที่ 5 ตุลาคม พ.ศ. 2556

    Useful git command

    git clone <URL>
    git rm file.txt
    git rm --cached file.txt
    git rm -r directory
    git rm -r --cached directory
    git add -u .
    git branch -b dev origin/dev
    git push  <REMOTENAME> <BRANCHNAME>


    # Ignore everything in this directory
    *
    # Except this file
    !.gitignore