2

我们正在使用 JAVA GWT-P 框架(版本 2.4)开发我们的 Web 应用程序。我们使用 Eclipse(3.7 版)Indigo 作为开发 GUI。当我们调试应用程序时,eclipse 普遍被挂起,令人惊讶的是这是一种随机行为。

这并不仅仅发生在程序的一部分中。任何时候,当我们调试时,Eclipse 都会挂在不同的模块中。

为了解决这个问题,我们尝试使用不同的操作系统,例如 Windows XP(开发 gui:Eclipse 版本 3.7 Indigo)、Fedora 版本 16(开发 gui:Eclipse 版本 Helios Service Release 2)、Cent OS(开发 gui:Eclipse 版本) Helios 服务版本 2)。但没有运气。

谁能帮我决定我们应该使用哪个操作系统、eclipse或版本,这样才能解决挂起的问题?

4

2 回答 2

1

Use a machine with at least 8G RAM, quad core for GWT development. Anything less than that would be catastrophic and unproductive.

Ideally 8 core, 12 GB.

  • Increase your eclipse jvm vm heap size max, at startup. Default eclipse startup is either 256M or 512M. It should be at least 768M. I have tried 1024M which made only a marginal difference above 768M. I found 900M seems to be the most that would be used in my cases.

  • You may have to increase your permgen memory allocation too. I think permgen space is used for storing class definition and are never garbage-collected. I presume that when my eclipse hung indefinitely was when there was no more permgen space to store new class defn.

I have never had to redefine the stackspace allocation for eclipse.

You can google around to find out the jvm startup arguments to define mem allocation. e.g. -Xmx, etc.

  • Initially develop only for a single browser. Decide between using FF or Chrome as your dev browser. Then tune your entrypoint gwt.xml to set the user-agent property for that browser. Google on gwt set property user-agent. Compiling for only one browser, I have found, speeds up the compilation a lot.

  • Don't ever store your projects, source files, resources or libs that are accessed by the compiler, in a network or usb drive. All your compilable/includable resources should be on your local drive.

Try to use maven or some other tool for dependency management, so that you do not need to access your jars or dependent projects over the network.

  • Do not, ever, let your development strategy roll down the hill by depending on live-project dependencies. Having workspace with 50 or more projects is disaster and signifies a development team in crisis. The compulsive and persistent compilation, scanning of projects by eclipse background take a huge toll on the performance of eclipse.

  • Try to disable as much validation as possible. e.g., disable html and javascript validation.

If you have a huge number of server side projects ... You need to re-architect your development strategy to cluster your 50 - 100 projects into project packages, so that each project package has no more than 20 compilable/validateable project members (ideally less than 5 projects). Each package is frozen by versions and packaged as jars. Use only the jars for development dependencies.

Your programmers need to learn not to have the impulse to work on a workspace with 200 projects. Enhancements are reserved for bugzillas of each project package. Having a 200 project workspace is bad project management. It wastes your programmers' time by having eclipse slow down now and then.

  • Have sufficient temp space (or for Windows sufficient slack space on the user disk). I have experienced that insufficient disk space for compiler buffering/caching has caused slow-downs and hang-ups. Having a 5G slack space is the minimal - the more the merrier so as to preclude having to clear the trash or search for files to delete or clear the GWT compiler generated temp files. A 5G slack space is still very inconvenient.

AFAI have experienced, neither windows 7/vista or linux made much performance difference except that eclipse seems to start up much slower on Windows.

  • Therefore, if you know how to tune your anti-virus, may be you should tell the anti-virus software to skip scanning the workspace and project folders.

  • Unless you have an 8-core 12GB machine, you should disable most of windows aero, trasparency. But you need to keep windows compositing (otherwise you would destroy your eyesight looking at the bad fonts).

于 2012-07-03T06:13:28.457 回答
1

问题

我有一个 GWT 项目,在我的旧 core2 机器上运行良好。当我最近获得一个新的核心 i7、8GB 内存(Dell XPS Ubuntu 开发者版)时,我发现当我尝试通过单击“开发”下的浏览器链接开始调试时,Eclipse 经常挂起(大约 90% 的初创公司挂起)模式”日食视图。必须有一个线程同步错误(死锁),只有在“时间与正常测试用例不同”时才会发生。这是一个计时错误死锁这一事实,这就是为什么它看起来如此“随机”并且尚未被发现和修复的原因。在我写这篇文章的时候,我拥有所有最新的 GWT,以及最新的 Eclipse 等。

解决方法:

幸运的是,我发现如果我复制该链接并将其粘贴到已启动的 Firefox 实例(在 Eclipse 之外)中,则永远不会有任何挂起。我 100% 确定这在我的代码中不是问题。我有 95% 的把握这是 GWT 中发生的僵局。所以不要点击“开发模式”链接,你会没事的。希望对这篇文章的人有所帮助。

于 2013-04-08T11:47:42.837 回答