VOOZH about

URL: https://www.javacodegeeks.com/2014/06/the-real-way-to-make-eclipse-run-faster-on-ubuntu.html

⇱ The REAL way to make Eclipse run faster on Ubuntu


If you are still one of those people who are frustrated with the crawling speed of eclipse IDE (especially after the recent clunky releases of Juno/Kepler), then you are in good company! Most of the advice you might have read until now for speeding up Eclipse must have involved tweaking the following parameters in eclipse.ini file:

 
 
 
 
 
 

-Xmn512m
-Xms1024m
-Xmx1024m
-Xss2m
-XX:PermSize=1024m
-XX:MaxPermSize=1024m
-XX:+UseParallelGC

Since Eclipse is pretty much a RAM hungry monster, feeding it with lots of RAM should surely make it run fast, right? Wrong! Until recently I had spent a lot of time tweaking those parameters, but no substantial performance could be gained (though I have 4GB of RAM with i3 which is not a bad configuration). The main issue here is that the underlying linux won’t provide the required boost to eclipse no matter whatever the parameters you provide. For instance, the system monitor shows that eclipse is only consuming 500Mb RAM, now what difference will it make if I provide 2048m to -XX:MaxPermSize?

πŸ‘ System Monitor
System Monitor

My search lead me to another better approach to solving this problem. If somehow we can load JDK into a shared memory or a RAM-Disk instead of it starting from the local hard-disk, both startup time and performance could be drastically improved.

But how do we create a RAM-Disk on linux? Well, if you using ubuntu, then you are in luck! Ubuntu has a working RAM-Disk folder called /dev/shm that could be globally used by any application as a temporary storage. If you go to that folder, you can see lots of files stored by pulseaudio.

I asked myself, why not copy the JDK folder to /dev/shm and provide that as a -vm parameter to eclipse. Lo and behold! Eclipse runs about 10 times faster on my ubuntu machine. Try it yourself and let me know (If you are having performance issues with Eclipse, that is…).

Reference: The REAL way to make Eclipse run faster on Ubuntu from our JCG partner Prahlad Yeri at the Prahlad Yeri blog.
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy

Thank you!

We will contact you soon.

πŸ‘ Photo of Prahlad Yeri
Prahlad Yeri
June 10th, 2014Last Updated: June 10th, 2014
16 619 1 minute read

Prahlad Yeri

Prahlad is a freelance software developer working on web and mobile application development. He also likes to blog about programming and contribute to opensource.
Subscribe

This site uses Akismet to reduce spam. Learn how your comment data is processed.

16 Comments
Oldest
Newest Most Voted
12 years ago

Thanks for the tips.
Could you please show how to copy the JDK folder to the RAM-disk and it would look like the Eclipse.ini with the -vm option?

0
Reply
Bruno Viana
12 years ago
Reply to  Thiago Ponte

sudo cp -R /opt/jdk1.7.0_40/ /dev/shm/

eclipse.ini

-vm
/dev/shm/jdk1.7.0_40/bin/java

0
Reply
12 years ago

Hey Thiago, >>Could you please show how to copy the JDK folder to the RAM-disk If you are on ubuntu, all you have to do is: cp -r /path/to/jdk1.8.0_05 /dev/shm In the above path, please replace the first part, i.e. β€œ/path/to/jdk1.8.0_05” to path to your own jdk. You can usually get this by issuing β€œwhich java” on a command line. >>and it would look like the Eclipse.ini with the -vm option? First, backup your eclipse.ini at some place. Then open eclipse.ini file and search for a string called β€œ-vm”. Just below that there should be a path for a jdk.… Read more Β»

0
Reply
11 years ago

Good article. Only one problem – you cannot really rely on /dev/shm being persistent, since it’s just a temporary file system. So every time you computer restarts, there is a chance that your jdk installation will be removed by Ubuntu (sometimes it almost always gets removed). How do you think this problem can be solved?

0
Reply
11 years ago
Reply to  Sayem Ahmed

@Sayem,
Yes, thats true. But all you have to do is create a bash script such as this:

cp -r ~/programs/jdk-1.7 /dev/shm

and put it in your ubuntu startup (you can find it in the dash).

0
Reply
Aakash Agarwal
11 years ago
Reply to  Prahlad Yeri

@Prahlad, yeah sure. We can do that since it is very simple, but won’t it slow down the booting operation?

0
Reply
11 years ago
Reply to  Aakash Agarwal

@ – Copying jdk to /dev/shm takes about 6-7 seconds on my machine. So, yes it might increase your booting time by that amount. However, if you put it in a starutp script such as /etc/rc.local, then the copy should happen sooner as it will be β€œmulti-tasked” along with your other usual startup scripts.

0
Reply
Aakash Agarwal
11 years ago
Reply to  Prahlad Yeri

Thanks Prahlad. I didn’t knew about the multi-taksed property of booting process. Thanks for the hack.

0
Reply
Gaurav
8 years ago
Reply to  Prahlad Yeri

After Sayem’s comment, I want to know what all should be done to finally solve the problem. The problem I’m facing is that when i create new class/project/package it doesn’t respond.

0
Reply
Abhi
11 years ago

thanks you very much

0
Reply
Milos
10 years ago

On Windows 7/8. Open Control panel.
Find Windows Defender.
Go to settings
Exclude all folders where is your Spring/Eclipse and workspace and also Java in Program files folder
Also exclude process. Find out eclipse STS and java

Restart eclipse / spring
IN process you will find out that eclipse use small memory and more cpu, and also is much faster

0
Reply
Arunabh Hejib
10 years ago
Reply to  Milos

I dont have any Anti Virus running as of now. Any other solution? I am sure this has better solutions than disabling Virus scan on the workspace.

0
Reply
Arunabh Hejib
10 years ago

Can you please suggest a solution for Windows system also. I am having a lot of performance issues with Eclipse. It takes a lot of time for everything. Be it setting build path, building workspace or publishing to Tomcat server. My system has 8 GB of RAM and the Task Manager shows java processes using only up to 2 GB even though I have configured it for 4 GB usage in eclipse.ini file as following.

-Xms256m
-Xmx6144m
-Xverify:none

Thanks for the help.

0
Reply
Arunabh Hejib
10 years ago
Reply to  Arunabh Hejib

Correction: It is configured to be 6 GB as per eclipse.ini

0
Reply
wen
9 years ago

hi, all:

I don’t see keyword β€œvm” in eclipse.ini

and I used β€œwhich java”, but it doesn’t show jdk path

how to deal with this?

thanks!

0
Reply
RB
9 years ago

Thanks a lot!! This helps speeding the eclipse.

0
Reply
Back to top button
Close
wpDiscuz