How can I speed up the eclipse startup?

Source: Internet
Author: User
Tags log log

I do not know if everyone is like me, open eclipse is turtle speed, every click Open, I will run out to pour a glass of water back. So is there any way to speed up the start-up? My train of thought mainly has the following several:

    • Uninstall a bunch of plug-ins that are no longer used or infrequently used.
    • Do not put all the projects in a workspace inside, you can build more than a few workspace. For example, one or more of the projects to be started in a workspace in a few days.
    • Speed up eclipse by modifying the eclipse's configuration file ( eclipse.ini ).

The first two believe most people can think, do it is very simple, this article mainly introduces the third way, that is, by modifying the configuration file to speed up.

My environment:

Eclipse Version: Eclipse LUNA
JDK version: JDK 1.8.0
Native Memory: 6G

You first need to eclipse.ini add a -Xloggc:gc.log configuration inside to view the logs that are started, and then tune the parameters by analyzing the logs.

My original Vmargs parameter is configured as follows (several print log options have been added later)

-xms40m
-xmx256m
-verbose:gc
-xx:+printgcdatestamps
-xx:+printgcdetails
-xloggc:gc.log

After launching Eclipse successfully, there will be a gc.log log file in the configuration directory with the following contents:

2014-12-01t17:17:24.102+0800:1.011: [GC (Allocation Failure) [psyounggen:10240k->1528k (11776K)] 10240k-> 2573K (39424K), 0.0357842 secs] [times:user=0.00 sys=0.00, real=0.04 secs]
2014-12-01t17:17:24.695+0800:1.604: [GC (Allocation Failure) [psyounggen:11768k->1528k (11776K)] 12813k-> 6418K (39424K), 0.0163152 secs] [times:user=0.02 sys=0.00, real=0.02 secs]
2014-12-01t17:17:24.933+0800:1.843: [GC (Allocation Failure) [psyounggen:11768k->1528k (11776K)] 16658k-> 10668K (39424K), 0.0209557 secs] [times:user=0.03 sys=0.00, real=0.02 secs]
2014-12-01t17:17:25.766+0800:2.676: [GC (Allocation Failure) [psyounggen:11768k->1528k (22016K)] 20908k-> 12994K (49664K), 0.0152186 secs] [times:user=0.02 sys=0.00, real=0.01 secs]
2014-12-01t17:17:27.385+0800:4.294: [GC (Allocation Failure) [psyounggen:22008k->1521k (22016K)] 33474k-> 19971K (49664K), 0.0243423 secs] [times:user=0.03 sys=0.00, real=0.02 secs]
2014-12-01t17:17:28.515+0800:5.424: [GC (Metadata GC Threshold) [psyounggen:14910k->6286k (50176K)] 33360k- >24736k (77824K), 0.0408780 secs] [times:user=0.09 sys=0.00, real=0.04 secs]
2014-12-01t17:17:28.556+0800:5.466: [Full GC(Metadata GC Threshold) [psyounggen:6286k->0k (50176K)] [paroldgen:18450k->21574k (46080K)] 24736k-> 21574K (96256K), [metaspace:19172k->19172k (1069056K)], 0.3825136 secs] [times:user=0.75 sys=0.00, real=0.38 secs]
2014-12-01t17:17:33.134+0800:10.044: [GC (Allocation Failure) [psyounggen:40960k->9212k (50176K)] 62534k-> 34014K (96256K), 0.0848276 secs] [times:user=0.13 sys=0.00, real=0.09 secs]
2014-12-01t17:17:35.882+0800:12.792: [GC (Metadata GC Threshold) [psyounggen:37650k->12260k (61952K)] 62451k- >41391k (108032K), 0.0443515 secs] [times:user=0.05 sys=0.00, real=0.04 secs]
2014-12-01t17:17:35.926+0800:12.837: [Full GC(Metadata GC Threshold) [psyounggen:12260k->0k (61952K)] [paroldgen:29131k->31402k (68096K)] 41391k-> 31402K (130048K), [metaspace:32296k->32296k (1079296K)], 0.2952576 secs] [times:user=0.45 sys=0.00, real=0.30 secs]< /c4>
2014-12-01t17:17:40.580+0800:17.490: [GC (Allocation Failure) [psyounggen:49664k->12627k (65536K)] 81066k- >44038k (133632K), 0.0400038 secs] [times:user=0.08 sys=0.00, real=0.04 secs]
2014-12-01t17:17:43.820+0800:20.730: [GC (Allocation Failure) [psyounggen:62291k->17399k (63488K)] 93702k- >51113k (131584K), 0.0402957 secs] [times:user=0.02 sys=0.02, real=0.04 secs]
2014-12-01t17:17:44.362+0800:21.271: [GC (Metadata GC Threshold) [psyounggen:25530k->13577k (59904K)] 59244k- >47299k (128000K), 0.0291300 secs] [times:user=0.05 sys=0.00, real=0.03 secs]
2014-12-01t17:17:44.391+0800:21.301: [Full GC(Metadata GC Threshold) [psyounggen:13577k->0k (59904K)] [paroldgen:33721k->39688k (88576K)] 47299k-> 39688K (148480K), [metaspace:53933k->53933k (1099776K)], 0.4561979 secs] [times:user=0.67 sys=0.02, real=0.46 secs]< /c0>
2014-12-01t17:17:50.364+0800:27.274: [GC (Allocation Failure) [psyounggen:46080k->11833k (66048K)] 85768k- >51530k (154624K), 0.0260724 secs] [times:user=0.05 sys=0.00, real=0.03 secs]
2014-12-01t17:17:52.379+0800:29.289: [GC (Allocation Failure) [psyounggen:56889k->14031k (66048K)] 96586k- >53735k (154624K), 0.0301987 secs] [times:user=0.06 sys=0.00, real=0.03 secs]
2014-12-01t17:17:54.831+0800:31.742: [GC (Allocation Failure) [psyounggen:59087k->16928k (62976K)] 98791k- >56641k (151552K), 0.0651508 secs] [times:user=0.14 sys=0.00, real=0.07 secs]
2014-12-01t17:18:12.857+0800:49.768: [GC (Allocation Failure) [psyounggen:58912k->17695k (59904K)] 98625k- >57415k (148480K), 0.0486718 secs] [times:user=0.09 sys=0.00, real=0.05 secs]

The number of full GC can be found to be 3 times, and the number of Minior GC is 15 times.
Further analysis reveals:

  • The reason for triggering full GC and partial GC is "Metadata GC Threshold", the people who have not used Java 8 may be unfamiliar with this, because Metaspace is a new feature of Java 8, replacing the PermGen that everyone is very familiar with, specifically to see this article: Java 8 new features Explore (ix) say goodbye to Oom:permgen.
    The above means that the size of the metaspace is set too small, causing frequent GC, which can be passed-XX:MetaspaceSizeParameter settings.
    Note: The configuration about Metaspace is not just-XX:MetaspaceSizeThis one parameter, there are other, mainly have the following:
    • -XX:InitialBootClassLoaderMetaspaceSize=32M: To increase the boot class loader metaspace;
    • -XX:MinMetaspaceFreeRatio=50: To do metaspaces grow more agressively;
    • -XX:MaxMetaspaceFreeRatio=80: To reduce the chance of metaspaces shrinking;
    • -XX:MinMetaspaceExpansion=4M: The minumum size by which a metaspace is exanded;
    • - XX:MaxMetaspaceExpansion=16M : The maximum size to expand a metaspace is without full GC.
  • Most minor GC has an AF (Allocation Failure) error, and AF does not indicate what is wrong with the code, but simply cannot allocate enough space from the heap. It is also understandable that in the default configuration of Eclipse above, XMS (the initial heap size) only 40M,-XMX (the maximum heap size) is only 256m, where the configuration of these two parameters can be increased.

After the above analysis, I modified the configuration parameters as follows:

-xms512m
-xmx1024m
-xx:metaspacesize=128m
-verbose:gc
-xx:+printgcdatestamps
-xx:+printgcdetails
-xloggc:gc.log

After restarting eclipse, we found a little bit faster and the print log is as follows:

2014-12-01t18:14:11.134+0800:7.991: [GC ( Allocation Failure) [psyounggen:131584k->21493k (153088K)] 131584k->35355k (502784K), 0.1561477 secs] [times: user=0.30 sys=0.02, real=0.16 secs]
2014-12-01t18:14:18.805+0800:15.662: [GC (Allocation Failure) [Psyounggen: 153077K->21494K (284672K)] 166939k->67517k (634368K), 0.1496186 secs] [times:user=0.16 sys=0.05, real=0.15 secs]

found that the full GC disappeared, leaving 2 minor GC at the end. However, this 2 times AF problem I can not be adjusted, no matter what parameters modified, the final will still appear in the 2 GC, compared to the previous is very good, so far. If you have a better setup method (such as being able to eliminate the last two GC), or correct the error in the text, please leave a message.

Resources
    • An analysis of the Eclipse method with faster configuration
    • What's the Metadata GC Threshold and how do I tune it?
    • 7 Tips for accelerating eclipse

How can I speed up the eclipse startup?

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.