将 jetty8 Web 应用程序迁移到 Google 应用程序引擎
我目前在jetty8中部署了一个Web应用程序,它基于jsf2、jersey和atmosphere。我想迁移到 GAE,但我遇到了以下问题:
GAE 支持 jetty8 吗?
有一个servlet每天定期执行数据库清理任务。为了做到这一点,任务在开始时生成并在循环中延迟,以便每 24 小时运行一次。 我读过 GAE 不允许生成任务。还有其他方法可以做到这一点并得到 GAE 的支持吗?
I have a web application currently deployed in jetty8, which is based on jsf2, jersey and atmosphere. I would like to migrate to GAE but the following question comes up to me:
Does GAE support jetty8?
There is a servlet that performs periodically a data base cleaning task every day. In order to do that a task gets spawn at the beginning and delayed in a loop in order to run every 24h.
I've read GAE does not allow tasks to be spawned. Is there another way to do that and be supported by GAE?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道 GAE 是否特别支持 Jetty 版本 8,但它运行在 Jetty 实例上。
您必须将 GAE 更多地视为 PAAS(平台即服务)而不是 IAAS(基础设施即服务)提供商。您必须查看他们提供的服务并检查它们是否符合您的要求。请参阅什么是 Google App Engine? 了解一般概述或< a href="http://code.google.com/p/googleappengine/wiki/WillItPlayInJava" rel="nofollow">Java Enterprise Edition (Java EE) 技术以实现特定框架兼容性。 GAE 不是常见的 JRE,它具有一组有限的受支持类:JRE 类白名单。这可能会进一步限制兼容性。不知道大气能不能运转。我不知道您需要 Jetty 8 的具体信息。网络套接字?不。您可以改用渠道:Channel API (Java)。
不允许以您的方式长时间运行任务(24 小时延迟)。但您可以启动计划任务,请参阅此处:计划任务Java 的 Cron。
请求的执行时间有限(60 秒),因此您不能以这种方式运行长时间运行的任务。但您可以生成运行时间较长(10 分钟)的后台任务,请参阅此处:任务队列 Java API。
重要提示:请查看配额。由于它们会惩罚某些应用程序行为,因此您需要调整您的应用程序以适应这一点。这可以完全改变您的应用程序设计!
根据我的经验,迁移到 GAE 是一种强烈的参与。 GAE 不适合作为其他托管解决方案的替代品。如果您想要这样的 IAAS 提供商(如 Amazon EC2)更适合。
I don't know if GAE supports version 8 of Jetty specifically, but it runs on Jetty instances.
You have to think of GAE more as a PAAS (platform as a service) than an IAAS (infrastructure as a service) provider. You have to take a look at the services they provide and check if they match your requirements. See What Is Google App Engine? for a general overview or Java Enterprise Edition (Java EE) Technologies for specific framework compatibility. The GAE is not a common JRE, it has a limited set of supported classes: The JRE Class White List. This may limit compatibility further. I don't know if Atmosphere runs. I don't know what Jetty 8 specifics you need. Websockets? No. You may use channels instead: The Channel API (Java).
Long running tasks are not allowed the way you do it (a 24h delay). But you can start scheduled tasks, see here: Scheduled Tasks With Cron for Java.
Request are limited in execution time (60 seconds) so you can't run long running tasks that way. But you can spawn longer running (10 minutes) background tasks, see here: The Task Queue Java API.
Important: Look at the quotas. As they punish certain application behaviour you will need to adapt your application to this. This can totally change your application design!
In my experience migrating to GAE is an intense engagement. GAE is not suited as a drop in replacement for other hosting solutions. If you want such IAAS providers (like Amazon EC2) are better suited.
所有信息都很好,只做了一处更正 - 用户请求现在限制为 60 秒,而不是 30 秒。
还应该注意的是,存在以下限制:
您计划如何将数据模型迁移到 GAE 数据存储? GAE 数据存储确实不适合基于 JPA/JDO 的模型,因为它与普通关系数据库有显着不同。
All good information, with just one correction - user requests are now limited to 60 seconds rather than 30 seconds.
It should also be noted that there are the following restrictions:
How are you planning on migrating your data model to the GAE datastore? The GAE datastore really doesn't suit a JPA/JDO-based model, as it is significantly different than normal relation databases.