配置Eclipse将App Engine类预捆绑到单个JAR中以加快预热 [英] Configure Eclipse to pre-bundle App Engine classes into a single JAR for faster warm-up

查看:211
本文介绍了配置Eclipse将App Engine类预捆绑到单个JAR中以加快预热的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在与另一家使用App Engine的同事进行讨论之后,他告诉我,他使用以下步骤,将应用程序的预热时间从〜15秒缩短到〜5秒。

After some discussion with a colleague from another company that also uses App Engine, he told me that he managed to cut down his app warm up time from ~15 seconds to ~5 seconds using the following steps:



  1. 配置Eclipse将编译期间生成的类捆绑成一个JAR文件。

  2. 配置Eclipse在App Engine部署期间上传这个单独的JAR文件而不是数百(或数千个)单独的Java类。



$ b $他认为,在实例加热期间,由于实例需要加载一个单独的捆绑JAR文件而不是数千个单独的类,所以预热将显着加快。对此的任何想法或意见?

He argues that during instance warm up, since the instance need to load only a single bundled JAR file instead of thousands of separate classes, the warm up would be significantly faster. Any thoughts or opinions about this?

我一定要自己尝试,但是我没有足够的Eclipse-mojo知道如何配置这样的步骤。有没有人知道如何配置Eclipse或Eclipse的Google插件来执行上述步骤? (当然,让部署的应用程序成功运行在App Engine中)

I would definitely like to try it by myself, but I don't have enough Eclipse-mojo to know how to configure such steps. Does anyone know how to configure Eclipse or the Google Plugin for Eclipse to do the steps outlined above? (And have the deployed apps successfully runs in App Engine, of course)

谢谢,

推荐答案

早期答案所述,App Engine SDK支持打包 WEB-INF / classes 转换成一个jar文件,最后在$ code> WEB-INF / lib / _ah_webinf_classes-0000.jar 中。您可以使用具有选项 - enable_jar_classes

As stated in an earlier answer, the App Engine SDK supports packaging WEB-INF/classes into a jar file, which will end up in WEB-INF/lib/_ah_webinf_classes-0000.jar. You can activate this


  1. c>。

  1. using the appcfg tool with the option --enable_jar_classes.

使用Google Plugin for Eclipse通过配置WAR或EAR项目的属性:项目属性> Google App Engine>部署>软件包WEB-INF /类作为一个jar

using the Google Plugin for Eclipse by configuring the properties of either your WAR or EAR project: Project properties > Google App Engine > Deployment > "Package WEB-INF/classes as a jar"

对于我来说,在App Engine 1.9.4中,稍微改进(约5-10%,如果有的话)。

For me, on App Engine 1.9.4, this resulted in only a minor improvement in instance spin-up (about 5-10 %, if any).

请注意,这将包WEB-INF / classes中的所有文件(不仅仅是.class类)。在更改之后,我在实例化过程中收到一条错误消息,无法再读取logging.properties文件;可能是因为当时没有读取新的jar文件:

Note that this will package all files in WEB-INF/classes (not only .class ones). Following the change, I got an error message during instantiation about not being able to read the logging.properties file anymore; probably because the new jar file hasn't been read at that time:

无法读取java.util.logging配置文件,WEB- INF / classes / logging.properties

作为解决方法,我将appengine-web.xml中的路径更改为 WEB-INF / logging.properties 并将maven-war-plugin配置为将文件复制到该位置:

As a workaround, I changed the path in appengine-web.xml to WEB-INF/logging.properties and configured the maven-war-plugin to copy the file to that location:

                <webResources>
                    <resource>
                        <directory>lib</directory>
                        <targetPath>WEB-INF/lib</targetPath>
                    </resource>
                    <resource>
                        <!-- Workaround: During GAE deployment, all files in WEB-INF/classes will be packaged into WEB-INF/lib/_ah_webinf_classes-0000.jar, 
                            which prevents the logging.properties referenced in appengine-web.xml from being read. -->
                        <directory>src/main/resources</directory>
                        <includes>
                            <include>logging.properties</include>
                        </includes>
                        <targetPath>WEB-INF</targetPath>
                    </resource>
                </webResources>

这篇关于配置Eclipse将App Engine类预捆绑到单个JAR中以加快预热的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆