Grails 2.0 run-app very slow performance - performance

I'm using Grails 2.0. I used to develop under Grails 1.3.7 but when running an application under Grails 2.0 the performance is very slow. A page can take more than 30 seconds to show and it's very embarrassing and unproductive.
I googled and I found that GSPs in 2.0 are in some cases 10 times slower than 1.3.7 ;
Greame explained that there is a new way of handling GSPs in dev mod, but when executing grails prod run-app I have almost the same problem.
What should I do to speed up development process ? I'm loosing too much time.
PS : My GRAILS_OPTS are "-‬server‭ -‬Xmx600M‭ -‬Xms600M‭ -‬XX:MaxPermSize=250m‭ -‬Dfile.encoding=UTF-8 -Dserver.port=9090‭"‬

I posted an small announcement on the mailing list about 20 minutes ago:
http://grails.1312388.n4.nabble.com/GSP-Compilation-tt4632864.html#a4635595
This issue was fixed:
http://jira.grails.org/browse/GRAILS-9423
Please test the performance of the latest 2.1.x snapshot build.
Try these
export GRAILS_OPTS="-server -noverify -XX:PermSize=256m
-XX:MaxPermSize=256m -Xmx600M -Xms600m -XX:+UseParallelGC -Djava.net.preferIPv4Stack=true
-Dsun.reflect.inflationThreshold=100000"
For me, the trick was to set Xmx and Xms to the same value and set the PermSize and MaxPermSize to the same value. sun.reflect.inflationThreshold helps with the permgen. (http://jira.grails.org/browse/GRAILS-7878?focusedCommentId=66447&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-66447 in the Grails jira for the explanation)
btw. I filed this issue 10 mins ago:
http://jira.grails.org/browse/GRAILS-9444
If it's interesting, please vote on the issue.

Grails 2.x is slower than 1.3.x for development mode because of the reloading improvements. It uses Spring-Loaded reloading agent that is similar to JRebel.
Make sure that your development laptop has enough memory (>4GB), a SSD and a fast i7 CPU.
Get a recent laptop with 16GB memory & a fast SSD and you won't be thinking of slowness anymore. I'd also recommend a i7 series CPU. That costs only about $1200 currently.

To make sure you are using the latest fixes to the Spring-Loaded reloading agent, use Grails 2.1.x instead of Grails 2.0.x . For Grails 2.1.1 you might want to upgrade the Spring-Loaded reloading agent to a snapshot version.
You can get the latest snapshot from:
https://repo.springsource.org/snapshot/com/springsource/springloaded/springloaded-core/
Currently it's https://repo.springsource.org/snapshot/com/springsource/springloaded/springloaded-core/1.1.1.BUILD-SNAPSHOT/springloaded-core-1.1.1.BUILD-20120821.173635-2.jar .
Replace $GRAILS_HOME/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-1.0.6.jar with the downloaded snapshot (rename the snapshot to the same file name springloaded-core-1.0.6.jar).
This answer will be outdated as soon as springloaded-core version 1.1.1 gets released.

Related

Intellij Too much memory consumption in Spring boot app

When I open intellij IDE with my spring boot app, I can see too much cpu and memory usage of my system. Facing this problem from last 1-1.5 month. Earlier, it was running smoothly.
I am using the latest intellij version in ubuntu 18.04 LTS.
I have increased intellij heap size to 6144. But still get hung after running the app for some time.
Below is the resource consumption stats:

Flutter - Slow gradle build

I have recently started Flutter development and on my machine, and the gradle build seemingly takes forever when completely restarting the app or running it for the first time, at times it gets quite frustrating. I am using an Ubuntu 20.04 (KDE Plasma env) with 8 GB RAM/ 240 GB SSD and using VS Code for running the app. Is there any way to optimize this? Would appreciate any suggestion on the same. Thanks in advance.
According to this documentation by developer.android.com there is a way to optimize gradle build by using JVM Garbage collector.
Add this parameter to your gradle.properties in your android folder you can find it on /{your-project}/android/:
org.gradle.jvmargs=-XX:+UseParallelGC
and if there are already value set in this field, just add a new option:
org.gradle.jvmargs=-Xmx1536m -XX:+UseParallelGC

Gradle throws OutOfMemoryException on build

I'm trying to setup / clone an existing grails-project. I managed to install it fine on several windows/macos computers and also 3-4 servers running Ubuntu (ranging from 16.04 to 20.04). But the newest vServer I rented seems to have some problems regarding the gradle-build, as it always throws an OutOfMemoryException, no matter what I try to do.
I already tried increasing the maximum memory size, that grails / gradle are allowed to use but I still get the OutOfMemoryException. I managed to narrow it all down to gradle, which seems to have a problem with the vServer, which has no swap-memory - that's what I read out of everything gradle told me in the error-log:
There is insufficient memory for the Java Runtime Environment to continue.
Cannot create GC thread.
Out of system resources.
Possible reasons:
- The system is out of physical RAM or swap space
Other than that, i noticed, that gradle uses around one to 1,5GB of memory before crashing - but I assigned him with up to 6GB using -Xmx6G (note that the system has 8GB availaible)
Maybe someone here can help me and tell me what I can do to solve this / get grails up and running (I tried everything I could find).
Attached I have the stacktrace of the (failed) build: https://pastebin.com/Kv2c4gu0
Thanks in advance.
EDIT:
The server has 8GB of memory; 4 cores;
I installed Java 1.8.0_252 through the openjdk 8
Gradle should be the version 4.4.1
Grails is installed with the version 4.0.1
The problem has been resolved:
The vServer had 0b of swap-storage, which led to gradle/grails throwing an error of insufficient memory.
All I needed to do was create a swap-partition to have gradle compile.

Saiku Memory Issues after Upgrading to MySQL 5.7

We are running the standalone version of Saiku 2.6. Since upgrading our server to MySQL 5.7 most queries that we run in Saiku (unless they are very basic) stall out and throw the following error:
OutOfMemoryError: Java heap space
Is anyone aware of compatibility issues with older versions of Saiku with MySQL 5.7? Is there anything else that might cause this issue?

Does Apple support Java 6 yet?

A while back I released an application in Java. While I targetted it for Java 6, I realized that there was a significant Macintosh user base. At the time, Apple had not gotten around to creating a JRE 6 for their users, so I had to make the application compatible with both Java 5 and 6.
Now I've returned to that project and realize that I can't support those users any more; Sun won't let me download the JDK 5 anymore because it's end of life. So I'm caught at a crossroads; as far as I can tell, PPC Mac users still don't have a JRE 6 to use.
So I ask this question: How do I resolve this predicament? I still want to support those users, but I simply don't have a JDK with which to build. Has Apple released a JRE 6 for their PPC users? Is there an alternate way to get JDK 5 (other than becoming a business member of Sun)? Is there some alternative recommendation to supporting these users?
Regards,
-- Shirik
EDIT: Some additional info, if Apple has released Java 6 for PPC, how easy is it to get? I ask this because I'm still constantly seeing logs from my users which indicate PPC architecture with a Java 5 VM.
You could use -target 1.5 -source 1.5 with your Java 6 JDK, to generate 1.5-compatible class files.
You can download Java 5 from Sun. You just have to look in the right place.
http://java.sun.com/javase/downloads/previous.jsp - J2SE 5.0, 1.4.2, 1.3.1
http://java.sun.com/products/archive/ - all releases going back to JDK 1.1
Note that these are all existing public releases. The material you got from Sun would have said there would be no new public releases of Java 5.0. They were pointing out that if you needed patches for recently discovered security issues and other bug fixes for Java 5.0 etc, you would have to pay for them.
Obviously, JDKs for Apple platforms are not available from Sun, but this is nothing to do with the fact that Sun have "end-of-lifed" Java 5.0. The fact is that they have never been available from Sun ...
Having said that, in the long term you need to be able to migrate your application to Java 6.0, 7.0 (due out later this year) and so on. At some point you are going to have to draw the line and say "sorry ... no more updates" for the shrinking number of users with old PPC and 32-bit Intel Macs.
As far as I know, Apple has only released Java 6 for x86-64, and I'd be willing to bet my hat that they will never release Java 6 for either PPC or for plain old 32-bit x86 (note that every Mac released after about mid-2007 or so is x86-64).
Soylatte might work (I have not tried it myself).
If you want to support older platforms, including PowerPC macs, it is a good idea to write code that can run on older Java releases. These days Java 5 is a relatively safe bet, but you may want to go even further and e.g. use retroweaver to generate Java 1.4.
You can download a version of the OpenJDK 1.7 from intricatesoftware.com
it is, unfortunately, a headless build of the JDK; i.e., can't open a display, and hence can't use to run IntelliJ, but Eclipse runs on it just fine.
I'm running it on 10.5.8, on a PPC ("cheese grater",) with Eclipse 4.3.2 / Kepler, and it all seems to work fine. :-)
(though, in honesty, a new configuration on the box, so we'll see how it goes over time)

Resources