views:

67

answers:

1

Hello All!

I recently deployed a Spring MVC application to google app engine, and the intial load time is about 7sec. Once the application is loaded, the app is quite responsive. But, if the app is idle for more than 1 minute (there isn't ANY traffic to it) the app needs to be again reloaded by GAE, which, takes about 7sec as well. For a PRD-level application this is unacceptable. (The app is empty -- I'm not even using JPA, Sitemesh, Spring Security, etc yet. It just loads a jsp page with some text.)

The only "best practice" to fix the 'load time' I've seen so far is to set up a cron job that hits the url every minute, therefore keeping the app 'loaded'. Obviously this is a terrible solution.

So here is the question: Are there any "best practices" for Spring on GAE in terms of "responsiveness"? Since google and spring are working on developing better integration between the two of them, has there been any news/progress on this problem? I can't find anything concrete, that's why I'm asking it here

Topic Discussions: http://groups.google.com/group/google-appengine-java/browse_thread/thread/80d014fd5abd526f

A: 

Ok, due to lack of responses I decided to go with the cron job (since I can't see any other option as of now)

Here is the cron.xml file I'm using

<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
  <cron>
    <url>/keepalive</url>
    <description>Keep the application alive</description>
    <schedule>every 1 minutes</schedule>
  </cron>
</cronentries>

And here's the controller:


package com.xxxxxxxxxxxxx.web;

import org.slf4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
@RequestMapping("/keepalive")
public class KeepAliveController {

    private Logger logger = org.slf4j.LoggerFactory.getLogger(KeepAliveController.class);

    @RequestMapping(method = RequestMethod.GET)
    public void keepAlive() {
        logger.info("I'm alive!");
    }
}
Vladimir