Eclipse 开发中优化使用 Ramdisk

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1838018/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 14:11:43  来源:igfitidea点击:

Optimize Use of Ramdisk for Eclipse Development

eclipseramdrive

提问by Eric J.

We're developing Java/SpringSource applications with Eclipse on 32-bit Vista machines with 4GB RAM. The OS exposes roughly 3.3GB of RAM due to reservations for hardware etc. in the virtual address space. I came across several Ramdisk drivers that can create a virtual disk from the OS-hidden RAM and am looking for suggestions how best to use the 740MB virtual disk to speed development in our environment.

我们正在 4GB RAM 的 32 位 Vista 机器上使用 Eclipse 开发 Java/SpringSource 应用程序。由于虚拟地址空间中的硬件等保留,操作系统公开了大约 3.3GB 的 RAM。我遇到了几个可以从操作系统隐藏的 RAM 创建虚拟磁盘的 Ramdisk 驱动程序,我正在寻找如何最好地使用 740MB 虚拟磁盘来加速我们环境中的开发的建议。

The slowest part of development for us is compiling as well as launching SpringSource dm Server.

对我们来说,开发中最慢的部分是编译和启动 SpringSource dm Server。

One option is to configure Vista to swap to the Ramdisk. That works, and noticeably speeds up development in low memory situations. However, the 3.3GB available to the OS is often sufficient and there are many situations where we do not use the swap file(s) much.

一种选择是将 Vista 配置为交换到 Ramdisk。这是有效的,并且在低内存情况下显着加快了开发速度。但是,操作系统可用的 3.3GB 通常就足够了,并且在很多情况下我们不会大量使用交换文件。

Another option is to use the Ramdisk as a location for temporary files. Using the Vista mklink command, I created a hard link from where the SpringSource dm Server's work area normally resides to the Ramdisk. That significantly improves server startup times but does nothing for compile times. There are roughly 500MB still free on the Ramdisk when the work directory is fully utilized, so room for plenty more.

另一种选择是使用 Ramdisk 作为临时文件的位置。使用 Vista mklink 命令,我创建了一个硬链接,从 SpringSource dm 服务器的工作区通常驻留在 Ramdisk。这显着缩短了服务器启动时间,但对编译时间没有任何作用。当工作目录被充分利用时,Ramdisk 上仍有大约 500MB 可用空间,因此还有更多空间。

What other files/directories might be candidates to place on the Ramdisk? Eclipse-related files? (Parts of) the JDK?

还有哪些文件/目录可以放在 Ramdisk 上?Eclipse 相关文件?(部分)JDK?

Is there a free/open source tool for Vista that will show me which files are used most frequently during a period of time to reduce the guesswork?

是否有适用于 Vista 的免费/开源工具可以向我显示在一段时间内最常使用哪些文件以减少猜测?

采纳答案by Eric J.

Here's what I did

这是我所做的

Moved to the Ramdisk:

移至 Ramdisk:

  • JDK (deleted some unnecessary files e.g. demos, src.zip)
  • Eclipse plugins directory
  • SpringSource work directory
  • SpringSource library directories
  • JDK(删除了一些不必要的文件,例如 demos、src.zip)
  • Eclipse 插件目录
  • SpringSource 工作目录
  • SpringSource 库目录

There's a neat trick that lets you move folders (or files for that matter) to the virtual disk without making a single change to configuration.

有一个巧妙的技巧可以让您将文件夹(或与此相关的文件)移动到虚拟磁盘,而无需对配置进行任何更改。

  1. Copy the folder to the Ramdisk
  2. Rename the original folder (I added -COPY to the end)
  3. Use the mklink /Jcommand to make a link from the place on disk where the directory used to be before you renamed it to where you copied it on the Ramdisk
  1. 复制文件夹到Ramdisk
  2. 重命名原始文件夹(我在最后添加了 -COPY)
  3. 使用mklink /J命令从磁盘上的目录在重命名之前所在的位置创建一个链接到您在 Ramdisk 上复制它的位置

For example:

例如:

cd C:\Dev\Apps
Xcopy jdk R:\jdk\ /s
ren jdk jdk-COPY
mklink /J jdk R:\jdk

The Ramdisk I selected has an option to persist state upon system shutdown (assuming there is no crash). I elected to move only relatively static files onto the Ramdisk, so once I have one good reboot, I should always find my Ramdisk in the state I need it.

我选择的 Ramdisk 有一个选项可以在系统关闭时保持状态(假设没有崩溃)。我选择只将相对静态的文件移动到 Ramdisk 上,所以一旦我重新启动了一次,我应该总能找到我的 Ramdisk 处于我需要的状态。

On pre-Vista machines you can substitute junction from SysInternals for mklink.

在Vista 之前的机器上,您可以用SysInternals 的junction 替换mklink。

回答by Eugene Kuleshov

You can try to move your Eclipse workspace into a ram disk. I am pretty sure neither javac, nor Eclipse compiler are using any temp files, so it goes straight from the *.java files to *.class files plus copying resource files from source location into a target folder.

您可以尝试将 Eclipse 工作区移动到 ram 磁盘中。我很确定 javac 和 Eclipse 编译器都没有使用任何临时文件,所以它直接从 *.java 文件到 *.class 文件,并将资源文件从源位置复制到目标文件夹中。

Another alternative you may want to consider is to use a solid state drive (SSD). You are going to see a significant performance improvements in many areas that are heavily reading and writing files from disk.

您可能需要考虑的另一种选择是使用固态驱动器 (SSD)。在从磁盘大量读取和写入文件的许多领域中,您将看到显着的性能改进。

回答by Rudy D'hauwe

I am using the SoftPerfect RAM Disk software. I installed the JDK, Eclipse, Maven, Gradle, and Ant on it. Also my workspace, my development git repositories and the local Maven repository (all downloaded dependencies) are on the RAM drive. I also created a "user home" directory on the RAM drive and I changed eclipse.ini to point to this new "user home" directory. Performance has improved dramatically and Eclipse now starts up under 10 seconds. I documented my approach here:

我正在使用 SoftPerfect RAM 磁盘软件。我在上面安装了 JDK、Eclipse、Maven、Gradle 和 Ant。我的工作区、我的开发 git 存储库和本地 Maven 存储库(所有下载的依赖项)都在 RAM 驱动器上。我还在 RAM 驱动器上创建了一个“用户主”目录,并将 eclipse.ini 更改为指向这个新的“用户主”目录。性能得到了显着提高,Eclipse 现在可以在 10 秒内启动。我在这里记录了我的方法:

http://www.whizu.org/articles/how-to-install-eclipse-on-a-ramdrive.whizu

http://www.whizu.org/articles/how-to-install-eclipse-on-a-ramdrive.whizu

回答by Freeman

I don't think move JDK and plugins folder to the ramdisk is a good solution for this case, since most time these IO is not the bottleneck for eclipse. I tried with your solution, and found that the workspace.metadata folder should be move to the ramdisk, that could help the build and execute speed. And if possible, you should move all your workspace folder under the ramdisk, and use some version control to ensure the data safe. Good luck.

我不认为将 JDK 和 plugins 文件夹移动到 ramdisk 是这种情况下的一个很好的解决方案,因为大多数情况下这些 IO 不是 eclipse 的瓶颈。我尝试了您的解决方案,发现应该将 workspace.metadata 文件夹移动到 ramdisk,这可以帮助构建和执行速度。如果可能,您应该将所有工作区文件夹移动到 ramdisk 下,并使用一些版本控制来确保数据安全。祝你好运。