How to make GGTS / STS super fast? - eclipse

I am using GGTS 3.2 JUNO 4.2.2 with Grails 2.2.1. It occurs to me that the environment is very slow after a while. What can I do to make it faster?
Is there a way to use the full potential of the underlying system?
What I did was (GGTS.ini):
-Xms768m
-Xmx768m
-XX:PermSize=1024m
-XX:MaxPermSize=1024m
-XX:+UseParallelGC

Working with Grails and GGTS demands a high amount of memory provided to GGTS. The reason why your IDE is getting slower by the time is because it has to do many "stop-the-world" Garbage Collections to get the memory it needs.
Especially you can see that on opening a GSP file the first time on your IDE ...then GGTS goes dark for a while.
And you can see that on the heap status at the right bottom of your IDE (enable it at your preferences). Every time the used memory is near to your provided 1GB your GGTS is stop working for two or more seconds. After that there is some free memory again.
1GB of memory for GGTS is ridiculous low - 2GB should be the minimum with Grails and Eclipse.
But that's not all. GGTS has a memory leak with Grails Tests and automatically building. You can try to remove the Unit and Integration tests from your projects build path. That is my trick to avoid slowdowns. But if I had to write Unit Tests I have to restart GGTS every once in a while. (And I have 8192m written in my ggts.ini.)

Eclipse Foundation has published solutions for this
http://wiki.eclipse.org/Platform_UI/Juno_Performance_Investigation

Putting this: -vm C:\devsw\java\jdk7_67\jre\bin\server\jvm.dll in my GGTS.ini (and restarting GGTS) has stopped the blue circle from spinning.

Related

GWT compiler is running out of memory. How do I configure it within IntelliJ?

I'm running GWT from within IntelliJ. (Plain GWT, IntelliJ v9). I'm able to run my application via my "GWT development mode" configuration, but when I try to run it through my "local tomcat" configuration, I get a bunch of incomprehensible error messages referring to Oracle and all sorts of weird stuff that I don't use, followed by this error which is sorted to the bottom of all the others:
Error: Out of memory; to increase the amount of memory, use the -Xmx flag at startup (java -Xmx128M ...)
I'm guessing that this error is the root cause.
According to my understanding, there is a GWT compilation step which runs in a JVM separate to both IntelliJ and tomcat, and so I'm unsure where to set the -Xmx parameter.
My question is: where do I find this -Xmx parameter? (And: am I on the right track, taking this error message at face value, or is it a symptom of deeper problems?)
You can configure the heap in the GWT facet settings:
As CrazyCoder just said you can increase the amount of memory for gwt compiler in the GWT Facet settings. The GWT Compiler running out of memory on bigger apps is very common if you don`t increase the amount of memory. Most projects should be fine with 512m, but on large projects I already needed more memory.
So this is not some out of memory error caused by some bad design on your behalf.
In my application, I set it to 1024 but it gives me out of memory after 7-9 page refresh on dev mode. And after that I tried it to optimize by doing performance hack, I separated my *.gwt.xml for every gwt module for specific browsers by setting:
MySampleModule_FF.gwt.xml
<set-property name="user.agent" value="gecko1_8"/>
And I run my dev mode with this gwt.xml for Firefox. In addition to it also separated internationalization as well.
After that my out of memory issues considerably decreased.
32 bit JDK also sometimes causes Out Of Memory error. Try using 64 bit JDK.
To those who get the same error under Eclipse, try to restore cache files (if they were removed accidentally in WAR folder ), this way I solve the same problem under my Eclipse project.

STS slow build when loading xyz-context.xml files

i recently started using STS on a 64 bit Windows machine. Often when i "clean" my project STS gets unresponsive or just takes minutes to build while loading context.xml. files.
How can I fix this? Is it looking for resources on the web and waiting for timeouts.?
EDIT: I noticed that during the build process my network usage goes up. Not sure yet what is going on there...
EDIT: Possibly STS is loading all of the referenced springsource XSD files for XML validation?`If so, how can I disable this validation (apart from copying the files and referencing them locally, of course)? I've already tried disabling all of the Preferences related to "Validation" in STS - to no avail.
Often it is, because java is running out of free memory and need to run the garbage collector very often.
You can see the free memory in the bottom right corner of eclipse if you enable Window/Prefercences/General/"Show heap status".
If you can confirm that it is a memory problem, then you can increase the memory in sts.ini (-Xmx).
It is said that the 64bit java version needs up to 1/3 more memory than the 32bit version. But I don't know if this rumour is right or not.

Eclipse uses 100 % CPU randomly

My eclipse sometimes starts using 100 % of my CPU very spontaneously.
I can't figure out why it needs that much CPU usage. There is no background task like "building workspace" running.
After some time the CPU load drops to 0 and everything is normal.
I can't find any information related to the problem in workspace/.metadata/.log file.
Has anybody some tip how I can figure out which part of eclipse is using the CPU so heavily? Is there a way to get a thread dump of eclipse? The kill -3 on the eclipse process doesn't do anything.
Eclipse Version: Galileo JavaEE
Operating System: Linux 2.6.31
Sounds like garbage collection
You could try changing the settings in your eclipse.ini, maybe with a higher Xmx value
--launcher.XXMaxPermSize
256m
-vmargs
-Xms256m
-Xmx1024m
-XX:PermSize=64m
-Xss1M
-server
-XX:+DoEscapeAnalysis
-XX:+UseConcMarkSweepGC
You can use visualvm to profile eclipse, get a heap dump or a thread dump, see which threads are running, etc.
If anyone else is having this problem, I fixed it for myself.
Set the option "auto build project" to off. That should remove a lot of the CPU used by Eclipse.
For my installation, I noticed the heap status indicator (Enabled VIA Window>Preferences "Show heap status" under General) was displaying less max heap than allocated in eclipse.ini (the -Xmx setting). The status indicator was bouncing around indicating that garbage collection was struggling to keep memory low.
Increasing the initial/min heap size (the -Xms setting) seems to have caused Eclipse/Java to stop trying to manage memory as much.
Eclipse is loading and unloading information from memory whenever this is required. If you workspace is big and you work with multiple projects and also your eclipse is configured to use low ammount of memory this is normal. Someone suggested above to change the xmx and xms values so that your eclipse uses more memory (if you have available) I suggest u put the same value to both of them. For example -Xms4048m and -Xmx4048m (or more) in your eclipse.ini file. This way your system will attempt to make use of that space once you start your IDE and the Garbage Collector (GC) takes less time to process data.
For me, the solution was to give Eclipse fewer threads. From my really long answer here:
Solution: decrease the max number of threads Eclipse can use, down to 1/2 as many as your computer has. So, if your computer has 8 physical "cores" (actually: hyperthreads), then decrease the max number of threads that Eclipse can use to 4, or <= half of your number of cores for your system, as follows:
In $HOME/eclipse/cpp-2022-09/eclipse/eclipse.ini on Linux Ubuntu, or equivalent for your OS, make this change (reducing from 10 threads max, to 4, in my case):
Change from:
-Declipse.p2.max.threads=10
to:
-Declipse.p2.max.threads=4
Restart Eclipse.
Now, Eclipse can only take up to 4 of my 8 threads, and my system runs much better!
Read my long answer for more details and other changes I made to help: High CPU usage in Eclipse when idle

Out of Memory error starting JBoss with Portal from Eclipse

I cannot get JBoss Portal to start from Eclipse, though the AS alone starts fine, and the Portal starts correctly as well, when started from the command line as opposed to from within Eclipse. I'm running in Windows, with 3GB. Suggestions? Thank you.
I've spend hours to discover this, and almost gave up and started to use JBoss out of Eclipse.
In order to increase your JBoss vmargs when starting it from Eclipse you have to change JBoss launch configuration. If you change standalone.conf, nothing happens because Eclipse doesn't use it.
So, to change JBoss vmargs in Eclipse, you have to go to "Servers" tab, right click on your Jboss instance, and select "Open".
It will appear a new window. In the first section, you have a option: "Open launch configuration". When you click there, you'll see the textbox to change vmargs.
Hope this helps you!
There are different types of OutOfMemory errors:
java.lang.OutOfMemoryError: Java heap space
Increase the -Xms and -Xmx. I'd make sure they are set at least 256m and generally it's a good idea to set them to the same value.
java.lang.OutOfMemoryError: PermGen space
Add either -XX:+CMSPermGenSweepingEnabled or increase the PermGen size: -XX:PermSize=256m
java.lang.OutOfMemoryError: GC overhead limit exceeded
Add more heap, the garbage collector can't free enough memory with each cycle. Also try turning on GC logging.
java.lang.OutOfMemoryError: unable to create new native thread
Decrease your heap :) This means that you have too much memory allocated to the heap that the OS doesn't have enough memory to create threads..
Two last things, the above can be configured in jboss/bin/run.conf.
Also when starting JBoss see what -X parameters are being passed to the JVM, it prints this information by default, verify that it's what you expect it to be.
You need to increase the memory you're allocating to Java, in particular heap space and PermGen. This article is highly relevant. It mentions that this issue often occurs with Eclipse and JBoss (since both are fairly large), and provides a solution (adjusting the command-line flags).
What are you using for running portal from eclipse? Maybe Jboss tools can help you
http://www.jboss.org/tools
According to my experiments, all options of vmargs set in eclipse.ini, plays only once - when creating a new workspace. When you want to change the options in the existing workspace, use run/debug configuration as in https://stackoverflow.com/a/10814631/715269. vmargs in ini won't be read any more.
Be careful, you should set -XX:MaxPermSize=...M, not -XX:PermSize=..., the last sets minimal, starting PermSize.
ad. Jeremy. It is senseless to put mins and maxs to the same value. You deprive Eclipse of adaptability. -Xms and -Xmx ( heap) and PermGen and MaxPermGen should be different. (MaxPermGen =256 by default)

Is Eclipse 3.4 (Ganymede) memory usage significantly higher than 3.2?

I was happily using Eclipse 3.2 (or as happy as one can be using Eclipse) when for a forgotten reason I decided to upgrade to 3.4. I'm primarily using PyDev, Aptana, and Subclipse, very little Java development.
I've noticed 3.4 tends to really give my laptop a hernia compared to 3.2 (vista, core2duo, 2G). Is memory usage on 3.4 actually higher than on 3.2, and if so is there a way to reduce it?
EDIT: I tried disabling plugins (I didn't have much enabled anyway) and used the jvm monitor; the latter was interesting but I couldn't figure out how to use the info in any practical way. I'm still not able to reduce its memory footprint. I've also noticed every once in a while Eclipse just hangs for ~30 seconds, then magically comes back.
Yes memory usage can get real high and you might run into problems with your JVM, as the default setting is a bit to low.
Consider using this startup parameters when running eclipse:
-vmargs -XX:MaxPermSize=1024M -Xms256M -Xmx1024M
With those options, I manage to limit the memory used to 700Mo (which is quite high, but still workable with my 2 Go)
-vmargs
-Xms128m
-Xmx384m
-Xssv2m
-XX:PermSize=128m
-XX:MaxPermSize=128m
-XX:CompileThreshold=5
-XX:+UseParallelGC
-Dcom.sun.management.jmxremote
And consider also to launch
C:\[jdk1.6.0_0x path]\bin\jconsole.exe
And choose 'Connection / New connection / 'eclipse' to monitor the memory used by eclipse
(which is why I use '-Dcom.sun.management.jmxremote')
Other options are available here.
The more plugins you have, the more memory Eclipse will consume. 3.4 includes more plugins by default than 3.3, and so on, and so on, as more and more developers clamor for features to be included.
Go to Window->Show View, and start typing "plug in", and one of the options will be the Plug In Registry. Open that view, and click on the arrow to show active plugins only. These are the plugins actually loaded into memory. My Eclipse 3.3 currently has 89 out of 445 or so plugins loaded. You can then selectively start disabling plugins from the Help menu, once you see which ones you won't use (right now, for instance, I"m not using Mylyn, but I hope to in the future).
To add to my previous answer and to your recent update:
Eclipse just hangs for ~30 seconds, then magically comes back.
That is usually a sign for a failed network access with a timeout (and the associated 'freeze' while the application is waiting for said timeout).
try typing 'net use' in a DOS prompt, and check if you have net path declared there, some of them you could get rid off ('net use /D aUselessPath'). To be sure, check also the shares that you declare (net share).
Since you are with Vista, try also to deactivate superfetch and see if you still experience those freezes (both for eclipse and Firefox).
Open a CMD prompt with administrative privileges and enter "net stop superfetch" to stop the SuperFetch service.
It is not a good long-term solution though, just a quick check to make. Superfetch should be kept on, and will actually restart on your next reboot, since the service is set to start automatically at each Windows session.
Again, this is just to see if there is any connection between that service and your freezes.