java - 如何让Eclipse 4.7在Linux(Ubuntu)上的server-jre-1.8...上流畅运行?

标签 java eclipse ubuntu java-8

我阅读了大量有关 Oracle jre-8 的文档和规范。想让 Eclipse 在长时间使用运行时运行得更快,意味着启动时间不那么重要——使用更多内存。对于 6GB 电脑,我决定 IDE 最大使用 2GB,因为浏览器和 Web 服务器也需要一些。

安装了 Eclipse PDT 4.7 和许多模块。使用 jre-8 的 Eclipse 版本应该是相同的。从 oracle 安装了 server-jre-1.8。安装程序 jre 将其打包到主文件夹中,而系统 java 是另一个,并将 eclipse ini 指向该安装位置。

最佳答案

这仅适用于oracle最新的Java 8和Eclipse 4.7.2。 (较旧的 eclipse 版本也可能工作,如果它们使用 oracle jre-1.8)使用大约 1gb 内存,最大(从未达到)2g。它可以通过修改在更少或更多的内存上运行,而不仅仅是xmx、xms。 GC 运行频率较低,因此使 Eclipse 运行更加流畅。开始很长,而且第一次打开一些视角很快,但下次要快得多。

这也适用于 Oracle 9,但需要一些修改。

eclipse.ini:(有文档,如果引起问题可以将其删除)

-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.551.v20171108-1834
-product
org.eclipse.epp.package.php.product
#Turn off splash. Better for Ubuntu Unity
-nosplash
#-showsplash
#org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
#
#client or server VM
#-client
-server
-vm
/home/lenya/Java/server-jre-1.8.0_162-oracle/bin
-vmargs
-Dosgi.requiredJavaVersion=1.8
-Dosgi.instance.area.default=@user.home/eclipse-workspace
#
#Enable the G1 Collector
#Configured for oracle java 8, lower response time
#Using docs: https://docs.oracle.com/javase/8/docs/technotes/guides/vm/gctuning/
-XX:+UnlockExperimentalVMOptions
-XX:+UseLargePages
-XX:+UseCompressedOops
-XX:+UseStringDeduplication
-XX:+UseFastAccessorMethods
-XX:-DontCompileHugeMethods
-XX:-UseLoopPredicate
-XX:+UseG1GC
#
#This is interpreted as a hint to the garbage collector that pause times of <nnn> milliseconds or less are desired.
#The garbage collector will adjust the Java heap size and other parameters related to garbage collection in an
#attempt to keep garbage collection pauses shorter than <nnn> milliseconds. By default there is no maximum pause
#time goal. These adjustments may cause garbage collector to occur more frequently, reducing the overall throughput
#of the application. The garbage collector tries to meet any pause time goal before the throughput goal. 
#In some cases, though, the desired pause time goal cannot be met.
#__For lower response time - more maximum pause__ __Larger heap needed__
-XX:MaxGCPauseMillis=5000
#
#The throughput goal is measured in terms of the time spent collecting garbage and the time spent outside of garbage
#collection (referred to as application time). The goal is specified by the command-line option -XX:GCTimeRatio=<nnn>.
#The ratio of garbage collection time to application time is 1 / (1 + <nnn>). For example, -XX:GCTimeRatio=19 sets
#a goal of 1/20th or 5% of the total time for garbage collection.
#
#The time spent in garbage collection is the total time for both the young generation and old generation collections combined.
#If the throughput goal is not being met, then the sizes of the generations are increased in an effort to increase the time
#that the application can run between collections.
# __Larger heap needed__
-XX:GCTimeRatio=99
#
#Sets the Java heap occupancy threshold that triggers a marking cycle.
#Percentage of the (entire) heap occupancy to start a concurrent GC cycle. It is used by G1 to trigger a concurrent GC
#cycle based on the occupancy of the entire heap, not just one of the generations. 
#A value of 0 denotes 'do constant GC cycles'. The default value is 45
-XX:InitiatingHeapOccupancyPercent=70
#
#Sets the occupancy threshold for an old region to be included in a mixed garbage collection cycle.
-XX:+UnlockExperimentalVMOptions
-XX:G1MixedGCLiveThresholdPercent=80
#
#Sets the percentage of heap that you are willing to waste. The Java HotSpot VM does not initiate the 
#mixed garbage collection cycle when the reclaimable percentage is less than the heap waste percentage
-XX:G1HeapWastePercent=10
#
#Sets the target number of mixed garbage collections after a marking cycle to collect old regions with
#at most G1MixedGCLIveThresholdPercent live data. The default is 8 mixed garbage collections.
#The goal for mixed collections is to be within this target number
#-XX:G1MixedGCCountTarget=64
#
#Sets an upper limit on the number of old regions to be collected during a mixed garbage collection cycle.
#The default is 10 percent of the Java heap
-XX:G1OldCSetRegionThresholdPercent=5
#
#G1 creates a false ceiling by trying to leave the reserve memory free in case more 'to-space' is desired
#__Ajust depending on heap size__
-XX:G1ReservePercent=15
#
#Sets the percentage of the heap to use as the minimum for the young generation size. The default value is 5 percent of your Java heap
-XX:+UnlockExperimentalVMOptions
-XX:G1NewSizePercent=5
#Sets the percentage of the heap size to use as the maximum for young generation size. The default value is 60 percent of your Java heap
-XX:+UnlockExperimentalVMOptions
-XX:G1MaxNewSizePercent=50
#
#Sets the number of parallel marking threads. Sets n to approximately 1/4 of the number of parallel garbage collection threads (ParallelGCThreads).
#Number of threads concurrent garbage collectors will use. 
#The default value varies with the platform on which the JVM is running
-XX:ConcGCThreads=2
#
#Sets the value of the STW worker threads. Sets the value of n to the number of logical processors. 
#Sets the number of threads used during parallel phases of the garbage collectors.
#The default value varies with the platform on which the JVM is running.
-XX:ParallelGCThreads=4
#
#With G1 the Java heap is subdivided into uniformly sized regions. This sets the size of the individual sub-divisions.
#The default value of this parameter is determined ergonomically based upon heap size. 
#The minimum value is 1Mb and the maximum value is 32Mb. The goal is to have around 2048 regions based on the minimum Java heap size.
-XX:G1HeapRegionSize=1m
#
#Sets the thread stack size.
-Xss16m
#
#Specifies the initial size, in bytes, of the memory allocation pool. The default value is chosen at runtime based on system configuration.
#__Disable it for auto configuration, changed at run time__
-Xms1g
#
#Specifies the maximum size, in bytes, of the memory allocation pool.
#__Do avoid swapping__ __Set less, and tune GC__
-Xmx2g
#
#Sets the mode of the bytecode verifier. Bytecode verification ensures that class files are properly formed and
#satisfy the constraints listed in section 4.10, Verification of class Files in the The Java Virtual Machine Specification.
#Do not turn off verification as this reduces the protection provided by Java and could cause problems due to ill-formed class files.
-Xverify:none

关于java - 如何让Eclipse 4.7在Linux(Ubuntu)上的server-jre-1.8...上流畅运行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48668001/

相关文章:

java - 如何在JFrame中设置glasspane的位置?

javascript - 使用 Eclipse 突出显示 Coffeescript 文本

eclipse - FindBugs Eclipse : specyfying exclude filter files relatively to project

C 代码在 archlinux 上运行,但不能在 ubuntu 10.04 上运行

python - Pyenv 指向正确的版本, "python"但不是 "python3"

python - 命令提示符导致标签。 python 2.7

java - 有没有办法在 for 循环中访问 String 变量?

java - 使用 Saxon 进行转换时处理 XML 中的特殊字符

java - Wicket:动态添加 TextField/Panel

java - 如何正确实现IAdaptable?