我已经在这里关注App Engine灵活环境的Java快速入门:
https://cloud.google.com/appengine/docs/flexible/java/quickstart
请注意那里的Servlet实现,我几乎没有改变:
@SuppressWarnings("serial")
@WebServlet(name = "helloworld", value = "/" )
public class HelloServlet extends HttpServlet {
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
PrintWriter out = resp.getWriter();
out.println("Hello, world - Flex Servlet");
}
}
因此,所有GET请求(包括来自Google /_ah/health
的健康检查的请求都将获得200个响应代码。尽管如此,在检查日志时,我发现/_ah/health
每秒有三个请求。这些永远存在。当然这很糟糕。
这是我的src/main/appengine/app.yaml
:
runtime: java
env: flex
service: service-name
runtime_config:
jdk: openjdk8
server: jetty9
manual_scaling:
instances: 1
handlers:
- url: /.*
script: this field is required, but ignored
secure: always
beta_settings:
java_quickstart: true
如何满足健康检查我的实例是否健康?