Configure Eclipse to pre-bundle App Engine classes into a single JAR for faster warm-up

后端 未结 7 1513
青春惊慌失措
青春惊慌失措 2021-02-02 12:15

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

7条回答
  •  醉梦人生
    2021-02-02 12:37

    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. using the appcfg tool with the option --enable_jar_classes.

    2. 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"

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


    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:

    Unable to read the java.util.logging configuration file, WEB-INF/classes/logging.properties

    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:

                    
                        
                            lib
                            WEB-INF/lib
                        
                        
                            
                            src/main/resources
                            
                                logging.properties
                            
                            WEB-INF
                        
                    
    

提交回复
热议问题