jruby web application deployed on glassfish server becoming slow as time passes

I have deployed war file of my jruby application on glassfish server. i have noticed that my application becomes slow as time passes. My server is of 30GB RAM but still application is very slow.

Every ruby method in my application is creating array which contains around 1 millions of records. i think creating such big array is causing memory issue and hence application is becoming slow. if this is true then what setting can be done to avoid such memory issue.

Below is my memory setting for java

uintx AdaptivePermSizeWeight                    = 20              {product}
 intx CompilerThreadStackSize                   = 0               {pd product}
uintx ErgoHeapSizeLimit                         = 0               {product}
uintx HeapSizePerGCThread                       = 87241520        {product}
uintx InitialHeapSize                          := 1055640320      {product}
uintx LargePageHeapSizeThreshold                = 134217728       {product}
uintx MaxHeapSize                              := 16890462208     {product}
uintx MaxPermSize                               = 174063616       {pd product}
uintx PermSize                                  = 21757952        {pd product}
 intx ThreadStackSize                           = 1024            {pd product}
 intx VMThreadStackSize                         = 1024            {pd product}
java version "1.7.0_101"
OpenJDK Runtime Environment (IcedTea 2.6.6) (7u101-2.6.6-0ubuntu0.14.04.1)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)

Thanks

Answer

I recommend setting Xms16G Xms16G with -server option for production environment.
Some metrics are needed to help identify the problem, provide these informations when the server is start getting slow :

System Memory for Java processs (RSS in Top)

PermGen Size (use jmc or jvisualm)

CodeCahe Size (use jmc) : probably the issue also print max size (java -XX:+PrintFlagsFinal | grep ReservedCodeCacheSize ).

Attribution
Source : Link , Question Author : Sanjay Salunkhe , Answer Author : hoshoh

Leave a Comment