Java Webstart 应用程序的内存分配

发布于 2024-10-05 05:59:36 字数 6479 浏览 4 评论 0原文

我正在使用名为 BLAST2GO 的 Java Webstart 应用程序,我遇到了内存分配问题。它需要将大型数据集加载到内存中,因此我一直尝试为该应用程序分配3-6GB。但是,无论我将最大堆大小设置为多少,它始终使用 455MB(如消息栏所示:“内存使用量:455MB 的 xxMB”)。我尝试将其设置为非常合理的级别(1024 MB),但仍然只分配了 455MB。

有什么想法吗?

顺便说一句,我使用的是 Ubuntu 10.04 32 位,24GB 内存,8 个进程。

更新:这是他们提供的 JNLP。当我编辑 initial-heap-sizemax-heap-size 属性的值时,我得到相同的结果。

<jnlp spec="1.0+" codebase="http://bioinfo.cipf.es/blast2go/webstart" href="http://bioinfo.cipf.es/blast2go/webstart/makeJnlp.php?mem=3072">
<information>
<title>Blast2GO 3072M</title>
<vendor>CIPF - UPV - IVIA</vendor>
<homepage href="http://www.blast2go.org"/>
<description>Blast2GO 3072M</description>
<description kind="short">Blast2GO 3072M</description>
<icon href="splash.gif"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+" initial-heap-size="64m" max-heap-size="3072M"/>
<jar href="ext/blast2go.jar"/>
<jar href="ext/biojava-1.3.1.jar"/>
<jar href="ext/jfreechart-1.0.10.jar"/>
<jar href="ext/mysql-connector-java-3.0.11-stable-bin.jar"/>
<jar href="ext/zvtm.jar"/>
<jar href="ext/jakarta-regexp-1.4.jar"/>
<jar href="ext/jcommon-1.0.13.jar"/>
<jar href="ext/Simpat1.1.jar"/>
<jar href="ext/iText-2.1.1.jar"/>
<jar href="ext/jdom/activation.jar"/>
<jar href="ext/jdom/ant.jar"/>
<jar href="ext/jdom/jaxen-core.jar"/>
<jar href="ext/jdom/jaxen-jdom.jar"/>
<jar href="ext/jdom/jdom.jar"/>
<jar href="ext/jdom/mail.jar"/>
<jar href="ext/jdom/saxpath.jar"/>
<jar href="ext/jdom/xalan.jar"/>
<jar href="ext/jdom/xerces.jar"/>
<jar href="ext/jdom/xml-apis.jar"/>
<jar href="ext/interpro/commons-cli-1.0.jar"/>
<jar href="ext/interpro/commons-cli.jar"/>
<jar href="ext/interpro/freefluo.jar"/>
<jar href="ext/interpro/servlet.jar"/>
<jar href="ext/interpro/WSInterProScan.jar"/>
<jar href="ext/axis_1_4/axis-ant.jar"/>
<jar href="ext/axis_1_4/axis.jar"/>
<jar href="ext/axis_1_4/commons-discovery-0.2.jar"/>
<jar href="ext/axis_1_4/commons-logging-1.0.4.jar"/>
<jar href="ext/axis_1_4/jaxrpc.jar"/>
<jar href="ext/axis_1_4/keggapi.jar"/>
<jar href="ext/axis_1_4/log4j-1.2.8.jar"/>
<jar href="ext/axis_1_4/saaj.jar"/>
<jar href="ext/axis_1_4/wsdl4j-1.5.1.jar"/>
<jar href="ext/axis2/activation-1.1.jar"/>
<jar href="ext/axis2/annogen-0.1.0.jar"/>
<jar href="ext/axis2/axiom-api-1.2.2.jar"/>
<jar href="ext/axis2/axiom-dom-1.2.2.jar"/>
<jar href="ext/axis2/axiom-impl-1.2.2.jar"/>
<jar href="ext/axis2/axis2-adb-1.1.1.jar"/>
<jar href="ext/axis2/axis2-adb-codegen-1.1.1.jar"/>
<jar href="ext/axis2/axis2-codegen-1.1.1.jar"/>
<jar href="ext/axis2/axis2-java2wsdl-1.1.1.jar"/>
<jar href="ext/axis2/axis2-jaxbri-1.1.1.jar"/>
<jar href="ext/axis2/axis2-jibx-1.1.1.jar"/>
<jar href="ext/axis2/axis2-kernel-1.1.1.jar"/>
<jar href="ext/axis2/axis2-saaj-1.1.1.jar"/>
<jar href="ext/axis2/axis2-soapmonitor-1.1.1.jar"/>
<jar href="ext/axis2/axis2-spring-1.1.1.jar"/>
<jar href="ext/axis2/axis2-tools-1.1.1.jar"/>
<jar href="ext/axis2/axis2-xmlbeans-1.1.1.jar"/>
<jar href="ext/axis2/backport-util-concurrent-2.2.jar"/>
<jar href="ext/axis2/commons-codec-1.3.jar"/>
<jar href="ext/axis2/commons-fileupload-1.1.1.jar"/>
<jar href="ext/axis2/commons-httpclient-3.0.1.jar"/>
<jar href="ext/axis2/commons-io-1.2.jar"/>
<jar href="ext/axis2/commons-logging-1.1.jar"/>
<jar href="ext/axis2/geronimo-spec-jms-1.1-rc4.jar"/>
<jar href="ext/axis2/jakarta-httpcore-4.0-alpha2.jar"/>
<jar href="ext/axis2/jaxb-api-2.0.2.jar"/>
<jar href="ext/axis2/jaxb-impl-2.0.2.jar"/>
<jar href="ext/axis2/jaxb-xjc-2.0.2.jar"/>
<jar href="ext/axis2/jaxen-1.1-beta-10.jar"/>
<jar href="ext/axis2/jibx-bind-1.1.3.jar"/>
<jar href="ext/axis2/jibx-run-1.1.3.jar"/>
<jar href="ext/axis2/mail-1.4.jar"/>
<jar href="ext/axis2/neethi-2.0.jar"/>
<jar href="ext/axis2/servletapi-2.3.jar"/>
<jar href="ext/axis2/stax-api-1.0.1.jar"/>
<jar href="ext/axis2/woden-1.0.0M6.jar"/>
<jar href="ext/axis2/wsdl4j-1.6.2.jar"/>
<jar href="ext/axis2/wstx-asl-3.2.0.jar"/>
<jar href="ext/axis2/xalan-2.7.0.jar"/>
<jar href="ext/axis2/xbean-2.2.0.jar"/>
<jar href="ext/axis2/xercesImpl-2.8.1.jar"/>
<jar href="ext/axis2/xml-apis-1.3.03.jar"/>
<jar href="ext/axis2/XmlSchema-1.2.jar"/>
<jar href="ext/batik/batik-anim.jar"/>
<jar href="ext/batik/batik-awt-util.jar"/>
<jar href="ext/batik/batik-bridge.jar"/>
<jar href="ext/batik/batik-codec.jar"/>
<jar href="ext/batik/batik-css.jar"/>
<jar href="ext/batik/batik-dom.jar"/>
<jar href="ext/batik/batik-extension.jar"/>
<jar href="ext/batik/batik-ext.jar"/>
<jar href="ext/batik/batik-gui-util.jar"/>
<jar href="ext/batik/batik-gvt.jar"/>
<jar href="ext/batik/batik-parser.jar"/>
<jar href="ext/batik/batik-script.jar"/>
<jar href="ext/batik/batik-svg-dom.jar"/>
<jar href="ext/batik/batik-svggen.jar"/>
<jar href="ext/batik/batik-swing.jar"/>
<jar href="ext/batik/batik-transcoder.jar"/>
<jar href="ext/batik/batik-util.jar"/>
<jar href="ext/batik/batik-xml.jar"/>
<jar href="ext/batik/js.jar"/>
<jar href="ext/batik/pdf-transcoder.jar"/>
<jar href="ext/batik/xalan-2.6.0.jar"/>
<jar href="ext/batik/xerces_2_5_0.jar"/>
<jar href="ext/batik/xml-apis-ext.jar"/>
<jar href="ext/batik/xml-apis.jar"/>
</resources>
<application-desc main-class="es.blast2go.prog.MainProg"/>
</jnlp>

更新:我尝试更改根 jnlp 标记中的 href 属性,但在终端上收到一条非常奇怪的消息。我想知道 Java 是否每次都会从该 URL 重新下载 JNLP,并忽略我编辑 JNLP 的尝试。有什么办法可以防止这种情况发生吗?

> javaws blast2go3GB.jnlp 
Error occurred during initialization of VM
CCoouulldd  nnoott  crreesaetrev et heen oJuagvha  svpiarcteu aflo rm aocbhjiencet. 
heap

最终更新:事实证明这是 Java 版本的问题。当我下载并使用 Sun Java 时,我得到了预期的行为。

I'm using a Java webstart application called BLAST2GO I'm running into problems with memory allocation. It needs to load a large data set into memory, so I've been trying to allocate 3-6GB to this application. However, no matter what I set as the max heap size, it always uses 455MB (as indicated by the message bar: 'Memory usage: xxMB of 455MB'). I've tried setting it to very reasonable levels (1024 MB), but still only 455MB are allocation.

Any ideas?

BTW, I'm using Ubuntu 10.04 32-bit with 24GB memory, 8 procs.

Update: Here is the JNLP they provide. I get the same result when I edit the values of the initial-heap-size and max-heap-size attributes.

<jnlp spec="1.0+" codebase="http://bioinfo.cipf.es/blast2go/webstart" href="http://bioinfo.cipf.es/blast2go/webstart/makeJnlp.php?mem=3072">
<information>
<title>Blast2GO 3072M</title>
<vendor>CIPF - UPV - IVIA</vendor>
<homepage href="http://www.blast2go.org"/>
<description>Blast2GO 3072M</description>
<description kind="short">Blast2GO 3072M</description>
<icon href="splash.gif"/>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.5+" initial-heap-size="64m" max-heap-size="3072M"/>
<jar href="ext/blast2go.jar"/>
<jar href="ext/biojava-1.3.1.jar"/>
<jar href="ext/jfreechart-1.0.10.jar"/>
<jar href="ext/mysql-connector-java-3.0.11-stable-bin.jar"/>
<jar href="ext/zvtm.jar"/>
<jar href="ext/jakarta-regexp-1.4.jar"/>
<jar href="ext/jcommon-1.0.13.jar"/>
<jar href="ext/Simpat1.1.jar"/>
<jar href="ext/iText-2.1.1.jar"/>
<jar href="ext/jdom/activation.jar"/>
<jar href="ext/jdom/ant.jar"/>
<jar href="ext/jdom/jaxen-core.jar"/>
<jar href="ext/jdom/jaxen-jdom.jar"/>
<jar href="ext/jdom/jdom.jar"/>
<jar href="ext/jdom/mail.jar"/>
<jar href="ext/jdom/saxpath.jar"/>
<jar href="ext/jdom/xalan.jar"/>
<jar href="ext/jdom/xerces.jar"/>
<jar href="ext/jdom/xml-apis.jar"/>
<jar href="ext/interpro/commons-cli-1.0.jar"/>
<jar href="ext/interpro/commons-cli.jar"/>
<jar href="ext/interpro/freefluo.jar"/>
<jar href="ext/interpro/servlet.jar"/>
<jar href="ext/interpro/WSInterProScan.jar"/>
<jar href="ext/axis_1_4/axis-ant.jar"/>
<jar href="ext/axis_1_4/axis.jar"/>
<jar href="ext/axis_1_4/commons-discovery-0.2.jar"/>
<jar href="ext/axis_1_4/commons-logging-1.0.4.jar"/>
<jar href="ext/axis_1_4/jaxrpc.jar"/>
<jar href="ext/axis_1_4/keggapi.jar"/>
<jar href="ext/axis_1_4/log4j-1.2.8.jar"/>
<jar href="ext/axis_1_4/saaj.jar"/>
<jar href="ext/axis_1_4/wsdl4j-1.5.1.jar"/>
<jar href="ext/axis2/activation-1.1.jar"/>
<jar href="ext/axis2/annogen-0.1.0.jar"/>
<jar href="ext/axis2/axiom-api-1.2.2.jar"/>
<jar href="ext/axis2/axiom-dom-1.2.2.jar"/>
<jar href="ext/axis2/axiom-impl-1.2.2.jar"/>
<jar href="ext/axis2/axis2-adb-1.1.1.jar"/>
<jar href="ext/axis2/axis2-adb-codegen-1.1.1.jar"/>
<jar href="ext/axis2/axis2-codegen-1.1.1.jar"/>
<jar href="ext/axis2/axis2-java2wsdl-1.1.1.jar"/>
<jar href="ext/axis2/axis2-jaxbri-1.1.1.jar"/>
<jar href="ext/axis2/axis2-jibx-1.1.1.jar"/>
<jar href="ext/axis2/axis2-kernel-1.1.1.jar"/>
<jar href="ext/axis2/axis2-saaj-1.1.1.jar"/>
<jar href="ext/axis2/axis2-soapmonitor-1.1.1.jar"/>
<jar href="ext/axis2/axis2-spring-1.1.1.jar"/>
<jar href="ext/axis2/axis2-tools-1.1.1.jar"/>
<jar href="ext/axis2/axis2-xmlbeans-1.1.1.jar"/>
<jar href="ext/axis2/backport-util-concurrent-2.2.jar"/>
<jar href="ext/axis2/commons-codec-1.3.jar"/>
<jar href="ext/axis2/commons-fileupload-1.1.1.jar"/>
<jar href="ext/axis2/commons-httpclient-3.0.1.jar"/>
<jar href="ext/axis2/commons-io-1.2.jar"/>
<jar href="ext/axis2/commons-logging-1.1.jar"/>
<jar href="ext/axis2/geronimo-spec-jms-1.1-rc4.jar"/>
<jar href="ext/axis2/jakarta-httpcore-4.0-alpha2.jar"/>
<jar href="ext/axis2/jaxb-api-2.0.2.jar"/>
<jar href="ext/axis2/jaxb-impl-2.0.2.jar"/>
<jar href="ext/axis2/jaxb-xjc-2.0.2.jar"/>
<jar href="ext/axis2/jaxen-1.1-beta-10.jar"/>
<jar href="ext/axis2/jibx-bind-1.1.3.jar"/>
<jar href="ext/axis2/jibx-run-1.1.3.jar"/>
<jar href="ext/axis2/mail-1.4.jar"/>
<jar href="ext/axis2/neethi-2.0.jar"/>
<jar href="ext/axis2/servletapi-2.3.jar"/>
<jar href="ext/axis2/stax-api-1.0.1.jar"/>
<jar href="ext/axis2/woden-1.0.0M6.jar"/>
<jar href="ext/axis2/wsdl4j-1.6.2.jar"/>
<jar href="ext/axis2/wstx-asl-3.2.0.jar"/>
<jar href="ext/axis2/xalan-2.7.0.jar"/>
<jar href="ext/axis2/xbean-2.2.0.jar"/>
<jar href="ext/axis2/xercesImpl-2.8.1.jar"/>
<jar href="ext/axis2/xml-apis-1.3.03.jar"/>
<jar href="ext/axis2/XmlSchema-1.2.jar"/>
<jar href="ext/batik/batik-anim.jar"/>
<jar href="ext/batik/batik-awt-util.jar"/>
<jar href="ext/batik/batik-bridge.jar"/>
<jar href="ext/batik/batik-codec.jar"/>
<jar href="ext/batik/batik-css.jar"/>
<jar href="ext/batik/batik-dom.jar"/>
<jar href="ext/batik/batik-extension.jar"/>
<jar href="ext/batik/batik-ext.jar"/>
<jar href="ext/batik/batik-gui-util.jar"/>
<jar href="ext/batik/batik-gvt.jar"/>
<jar href="ext/batik/batik-parser.jar"/>
<jar href="ext/batik/batik-script.jar"/>
<jar href="ext/batik/batik-svg-dom.jar"/>
<jar href="ext/batik/batik-svggen.jar"/>
<jar href="ext/batik/batik-swing.jar"/>
<jar href="ext/batik/batik-transcoder.jar"/>
<jar href="ext/batik/batik-util.jar"/>
<jar href="ext/batik/batik-xml.jar"/>
<jar href="ext/batik/js.jar"/>
<jar href="ext/batik/pdf-transcoder.jar"/>
<jar href="ext/batik/xalan-2.6.0.jar"/>
<jar href="ext/batik/xerces_2_5_0.jar"/>
<jar href="ext/batik/xml-apis-ext.jar"/>
<jar href="ext/batik/xml-apis.jar"/>
</resources>
<application-desc main-class="es.blast2go.prog.MainProg"/>
</jnlp>

Update: I tried changing the href attribute in the root jnlp tag and I got a very strange message on the terminal. I wonder if Java is re-downloading the JNLP from this URL each time and ignoring my attempts to edit the JNLP. Is there a way I can prevent this?

> javaws blast2go3GB.jnlp 
Error occurred during initialization of VM
CCoouulldd  nnoott  crreesaetrev et heen oJuagvha  svpiarcteu aflo rm aocbhjiencet. 
heap

Final Update: Turns out this was a problem with the Java Version. I got the expected behavior when I downloaded and used Sun Java.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

沫雨熙 2024-10-12 05:59:36

您可以在 j2se 标记中指定堆大小,如下所示:

    <resources>
    .........
            <j2se version="1.6.0+" href="" initial-heap-size="1024m" max-heap-size="3000m" />
            <j2se version="1.5.0_05" href="" initial-heap-size="1024m" max-heap-size="3000m" />
            <j2se version="1.4.2_04" href="" initial-heap-size="1024m" max-heap-size="3000m" />        
    .........
    </resources>

并指定您将使用的每个 jre 版本。

You can specify the heap size in the j2se tag like this:

    <resources>
    .........
            <j2se version="1.6.0+" href="" initial-heap-size="1024m" max-heap-size="3000m" />
            <j2se version="1.5.0_05" href="" initial-heap-size="1024m" max-heap-size="3000m" />
            <j2se version="1.4.2_04" href="" initial-heap-size="1024m" max-heap-size="3000m" />        
    .........
    </resources>

And specify every jre version you would use.

︶葆Ⅱㄣ 2024-10-12 05:59:36

如果您运行的是 32 位 Linux,则只能运行 32 位 JVM,每个实例的内存限制约为 4 Gb。我相信即使你对内核有更多的可见性也是如此。

如果您确实需要在单个 JVM 中使用大量内存,则需要使用 64 位。


编辑:Java WebStart 没有为 OpenJDK 开源,因此使用了替代实现。尝试下载并使用 Sun Java 来实现此目的。下载并解压 JDK,然后运行 ​​bin/javaws foo.jnlp 就足够了。

If you are running a 32-bit Linux, you can only run a 32-bit JVM which is limited to about 4 Gb memory per instance. I believe this is also the case even if you have more visible to the kernel.

If you really, really need a lot of memory in a single JVM you need to go 64-bit.


EDIT: Java WebStart was not open sourced for OpenJDK so an alternative implementation is used. Try to download and use Sun Java for this instead. It should be enough to download and unzip the JDK, and run bin/javaws foo.jnlp.

菊凝晚露 2024-10-12 05:59:36

尝试使用手动命令行参数来设置它。像这样的东西:

Try to set it by using a manual command line parameter. Something like this:

<j2se version="1.6+" java-vm-args="-Xms3072m"/>

旧情别恋 2024-10-12 05:59:36

您可以通过命令行选项简单地更改它,例如

javaws -J-Xmx16384m -J-Xms16384m <jnlp url>

You can change it simply via command line option, e.g.

javaws -J-Xmx16384m -J-Xms16384m <jnlp url>
三生殊途 2024-10-12 05:59:36

您是否尝试过 blast2go 起始页 中的解决方案?

“Blast2GO 需要更多内存?使用动态内存 JNLP URL:”

http://bioinfo.cipf.es/blast2go/webstart/makeJnlp.php?mem=<put here the amount of memory you need>

目前尚不清楚这里发生了什么,但我认为blast2go 很可能正在执行一些手动内存管理技巧。 (它声称报告使用了多少内存这一事实就表明了这一点。)如果是这种情况,那么在调整 JNLP 文件时可能需要设置应用程序特定的参数或属性。

Did you try the solution from the blast2go start page?

"Blast2GO needs more memory? Use the dynamic memory JNLP URL:"

http://bioinfo.cipf.es/blast2go/webstart/makeJnlp.php?mem=<put here the amount of memory you need>

It is not clear what is going on here, but I think it is likely that blast2go is doing some manual memory management tricks. (The fact that it claims to report how much memory is used is indicative of this.) If that is the case, then there may be application specific arguments or properties that need to be set if you tweak the JNLP file.

疑心病 2024-10-12 05:59:36

在生产中,如果客户希望根据可用的系统配置(客户端计算机上的 RAM 大小)自定义 jnlp 中的 java 堆大小

APPLICATION_TEMPLATE.JNLP 中的更改:使用 * 接受可配置值

appliation.jnlp 中的更改:

将实际值传递给 intial-heap-size 和 max-heap-size。
jnlp 文件支持 scriptlet 和表达式。

  • 使用 scriptlet <% %>读取属性文件中的配置值
  • 传递 <%=>;将实际值指向 intial-heap-size 的表达式和
    最大堆大小

In the production, if the customer want to customize the java heap size in jnlp based on the system configuration available ( RAM size on the client machine)

Changes in the APPLICATION_TEMPLATE.JNLP: use * to accept the configurable values

Changes in the appliation.jnlp :

Pass the actual values to intial-heap-size and max-heap-size.
jnlp file supports the scriptlets and expressions.

  • Using scriptlet <% %> read the properties file for the configured values
  • Pass the <%=> expression pointing the actual values to intial-heap-size and
    max-heap-size
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文