Does Cloudfoundry support apps that require larger memory? - grails

I have been developing a website using grails and demo'ing it using Cloudfoundry. Grails and Cloudfoundry are awesome! The are easy to use with support from grails plugins and tools in STS. My app uses MySQL, MongoDB, SpringSecurity, and more. I have only used it with one user logged in and I periodically get java.lang.OutOfMemoryError: PermGen space I have increased the memory to 1G using the grails plugin. I tried to set JAVA_OPTS to increase the memory and this did not work. I am going to examine where the memory is being used, but it seems that one user and a tiny set of demo data should not be pushing the memory limits.Does Cloudfoundry support apps that require larger memory? After reading this post I set the MaxPermSize to 512M and I no longer have out of memory errors. I'm using grails cmdline on windows and I cannot get more than one JAVA_OPTS set, only the first in a list is used. grails cf-env-add JAVA_OPTS "-XX:MaxPermSize=512m -Xms512M -Xmx512M" This one setting has added stability to my demo site.

The original poster has an answer in the original question:
After reading this post I set the MaxPermSize to 512M and I no longer have out of memory errors. I'm using grails cmdline on windows and I cannot get more than one JAVA_OPTS set, only the first in a list is used. grails cf-env-add JAVA_OPTS "-XX:MaxPermSize=512m -Xms512M -Xmx512M" This one setting has added stability to my demo site

It's a PermGen space, and at this case it's in development mode only (or when you're using Tomcat and redeploy your app few times, its not a CloudFoundry case).
See official FAQ: OMG I get OutOfMemoryErrors or PermGen Space errors when running Grails in development mode. What do I do?

Related

Grails 4.0.3 memory allocation in deployment

I deploy my applications in Grails 4.0.3 using an embbebed Tomcat as a micro service. I have noticing recently that the application is being down a lot of times. It looses cotectiom with the database.
So I woull like to know two things. The first one is, what the default Grails memory allocation when deplying an app is. Te second one: could I increase the efault memory alloctaion when deploying my app, I mean, when I tun the comman java -jar (in order to deploy the app)?
Thanks.
Alfredo

Simple Grails 2.5.1 application leaks classloaders with Groovy 2.4.4

I have problems hot-redeploying a simple Grails application in Tomcat 8.
My setup is the following:
Grails 2.5.1 Brand new application, just created with create-app
Tomcat 8.0.28 (64 bit Linux binary version)
Java 1.8.0_65-b17 HotSpot server VM
Tomcat is also a brand new installation, only modified two things (as I want to use them in production):
server.xml
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" undeployOldVersions="true">
context.xml
<Context antiResourceLocking="true">
I've restarted the Tomcat server. According to JVisualVM it had 2398 classes loaded. After copying the war file produced by grails prod war, and waiting for the deploy to finish, it had 10 022 classes loaded. After copying the war again, thus triggering a redeploy, it had 16 300 classes.
I made heap dumps after the fist deploy, and the second, and analyzing the classloaders with eclipse MAT, I can see that there is one extra org.apache.catalina.loader.WebappClassLoader with 6 138 loaded classes (so there are two of them in total).
The heap space remained pretty constant, only the MetaSpace usage increased significantly (at about the same rate as the number of classes).
Update
Using MAT to dig deeper, I've noticed that there are always 9 instances keeping the classloader alive. They are instances of org.codehaus.groovy.reflection.ClassInfo (one for each primitive java type wrapper and Void). These ClassInfos are only referenced by java.lang.ClassValue$Entry, which extends WeakReference, so I'm really puzzled how these instances are not getting garbage collected.
Has anyone had similar issues? What could cause this loader to hang around?
This issue is related to https://issues.apache.org/jira/browse/GROOVY-7591
I do not completely understand the issue, but I will try to describe it shortly:
The use of ClassValue (due to a JDK bug) prevents objects from being garbage collected. A commit in Groovy 2.4.5 temporarily disabled the use of ClassValue while the JDK bug gets fixed.
Grails 2.5.1 uses groovy 2.4.4 by default, so to solve the issue I replaced it in BuildConfig.groovy, and rebuilt the application.
build 'org.codehaus.groovy:groovy-all:2.4.5'
compile 'org.codehaus.groovy:groovy-all:2.4.5'

Java Mission Control with windows services: disabled functionality

I am trying to use the "Log historical data" functionality provided by Java Mission Control to record information about:
- Used Java Heap Memory
- Commited Java Heap
- Maximum Java Heap
of a local tomcat instance running as a Windows service.However I can't add any new graph using the "Add..." button.
It is fine if I try the same with a local application, but some parts of JMC seem to be disabled when connecting to windows services. The Java options that I am using for Tomcat are:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=6666
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.local.only=false
-XX:+UnlockCommercialFeatures
-XX:+FlightRecorder
Any help/suggestion would be appreciated.
Hopefully you've already got an answer for your question, but if not, I have some questions for you:
Which version of JMC are you using?
Can you run JMC with -consoleLog (JDK\bin\jmc -consoleLog | more), so see if you get any - output?
Can't you find the MBeans, or what happens when you want to add them to a graph?
Can you see the MBeans if you connect with jconsole?
//Klara, JMC dev

outofmemory error due to quartz scheduler when deploying grails project war on weblogic server 10.3.6

When I deploy my grails application war on weblogic server (I am using Quartz scheduling)
I get the permgen space error when I deploy it on weblogic. the application works fine from IDE or tomcat deployment of WAR.
the error is:
Exception in thread "main" java.lang.OutOfMemoryError: PermGen space
Exception in thread "QuartzScheduler_quartzScheduler-one_MisfireHandler" java.lang.OutOfMemoryError: PermGen space
The tomcat server your IDE is using my be configured differently than the Weblogic server your using in production. The first thing you should check is the JVM options the server is using.
Generally speaking the below JVM options should work for you assuming you have around 1.5gb of ram available.
-Xms1024m -Xmx1024m -XX:MaxPermSize=256m
The MaxPermSize is really the focus here but lets make sure we're using around 1gb of ram for the app (Xms and Xmx). If you have more then make them bigger!
If your unsure how to set or even check what the current values are, google around and get to know your application server a little better as well as other JVM options.
Enjoy

aws memory high usage

Recently I configured my instance into a micro environment in EC2 with glassfish and mysql in windows..
I deployed my war and i was able to access my site through http.
I changed my application and redeployed the war and it also worked.
When I was about to redeploy the war for 4th or 5th time, the application got deployed, I saw the message in the log file. But I was unable to access the site through http.
Then I tried the command "asadmin list-applications" and I got the following message.
Error occurred during initialization of VM
Could not reserve enough space for object heap
After that I was not able to connect to my instance through RDP and I had to reboot, I was able to access it again after that. I started the servers again (glassfish mysql), but no luck.
I noticed that the memory usage is around 90% or more. CPU isage is low.
now I can not access my site through http. what shall i do ?
Thanks in advance !
Honestly, there are a couple issues working against you here:
1) Windows requires FAR more RAM than Ubuntu to run at a minimum decent level.
2) GlassFish has a much larger footprint than Tomcat or Jetty.
Is there any particular reason you need Windows? Like is there a specific need that your server run some executables for file processing or something like that outside the JVM? Most would agree that Linux (Ubuntu or other) will give you much better results in performance and stability to run an App Server like GlassFish in any environment.

Resources