[英]Using amazon web services as google app engine back end
I am currently using google app engine as my mobile application back end. 我目前正在使用谷歌应用引擎作为我的移动应用程序后端。 I have a few tasks that can not be performed in the gae environment (mainly image recognition using opencv).
我有一些无法在gae环境中执行的任务(主要是使用opencv进行图像识别)。 My intention is to retain gae and use AWS to perform these specific tasks.
我的目的是保留gae并使用AWS来执行这些特定任务。
Is there a simple way to pass specific tasks from gae to AWS? 有没有一种简单的方法可以将特定任务从gae传递到AWS? Eg A task queue?
例如一个任务队列?
You could either push tasks from GAE towards AWS, or have your AWS instances pull tasks from GAE. 您可以将任务从GAE推送到AWS,也可以让您的AWS实例从GAE中提取任务。
If you push tasks from GAE towards AWS, you could use URLFetch
to push your data towards your AWS instances. 如果您将任务从GAE推送到AWS,则可以使用
URLFetch
将数据推送到AWS实例。
If you prefer to have your AWS instances pull tasks from GAE, you could have your GAE instances put their tasks in the GAE Pull Queue
, and then have your AWS instances use the Task Queue REST API
to lease tasks from the queue. 如果您希望让AWS实例从GAE中提取任务,您可以让GAE实例将其任务放入GAE
Pull Queue
,然后让您的AWS实例使用Task Queue REST API
从队列中租用任务。
In either case, the AWS instance could report back the processing result through a simple POST request to your GAE servlets, or through inserting tasks via the abovementioned REST API
which would later be leased by your GAE instances. 在任何一种情况下,AWS实例都可以通过对GAE servlet的简单POST请求报告处理结果,或者通过上述
REST API
插入任务,稍后由GAE实例租用。 The latter could be useful if you want to control the rate of which your GAE app process the results. 如果您想控制GAE应用处理结果的速率,后者可能很有用。
Have you considered using amazon simple queue service ? 您是否考虑过使用亚马逊简单队列服务? http://aws.amazon.com/sqs/
http://aws.amazon.com/sqs/
You should be able to add items to the queue from gae using a standard http clint. 您应该能够使用标准的http clint从gae向队列添加项目。
Sure. 当然。 AppEngine has a Task Queue , where you can put in your tasks by simply implementing DeferredTask .
AppEngine有一个任务队列 ,您可以通过简单地实现DeferredTask来完成任务。 In that task you can make requests to AWS.
在该任务中,您可以向AWS 发出请求 。
Disclaimer: I'm a lead developer on the AppScale project. 免责声明:我是AppScale项目的首席开发人员。
One way that you could go is with AppScale - it's an open source implementation of the App Engine APIs that runs over Amazon EC2 (as well as other clouds). 您可以采用的一种方式是AppScale - 它是在Amazon EC2(以及其他云)上运行的App Engine API的开源实现。 Since it's open source, you could alter the AppServer that we ship with it to enable OpenCV to be used.
由于它是开源的,您可以更改我们随附的AppServer以启用OpenCV。 This would require you to run your App Engine app in AWS, but you could get creative and have a copy of your app running with Google, and have it send Task Queue requests to the version of your app running in AWS only when you need to use the OpenCV libraries.
这需要您在AWS中运行您的App Engine应用程序,但您可以获得创意并拥有与Google一起运行的应用程序副本,并让它仅在您需要时将任务队列请求发送到在AWS中运行的应用程序版本使用OpenCV库。
Your intention to retain the application in GAE and use AWS to perform a few tasks, that can not be performed in the GAE, seems for me a right scenario. 您打算在GAE中保留应用程序并使用AWS执行一些无法在GAE中执行的任务,这对我来说是一个正确的方案。
I'd like to share a few ideas along with some resources to answer the main part of your question: 我想分享一些想法和一些资源来回答你问题的主要部分:
Is there a simple way to pass specific tasks from gae to AWS?
有没有一种简单的方法可以将特定任务从gae传递到AWS? Eg A task queue?
例如一个任务队列?
If you need GAE and AWS to perform the task all the time (24/7) then your application will definitely depend on batch schedule or task queue. 如果您需要GAE和AWS一直执行任务(24/7),那么您的应用程序肯定会依赖于批处理计划或任务队列。 They are available by GAE.
它们由GAE提供。
However if you could arrange to pull the task in GAE and perform by AWG on interval basis (say twice a day of less than an hour each), you may no need to use them as long you can manage the GAE to put the data on Google Cloud Storage (GCS) as public . 但是,如果您可以安排在GAE中执行任务并按间隔执行AWG(每天说两次,每次不到一小时),您可能无需使用它们,只要您可以管理GAE以放置数据Google云端存储(GCS)已公开发布 。
For this scenario, you need to setup AWS EC2 Instance for On/Off Schedule and let the instance to run a boot script using cloud-init to collect the data through your domain that pointed to GCS (c.storage.googleapis.com) like so: 对于此场景,您需要为开/关计划设置AWS EC2实例,并让实例使用cloud-init运行启动脚本,以通过指向GCS(c.storage.googleapis.com)的域收集数据所以:
wget -q --read-timeout=0.0 --waitretry=5 --tries=400 \\
--background http://your.domain.com/yourfile?q=XXX...
By having the data from GCS, then AWS can perform these specific tasks. 通过从GCS获取数据,AWS可以执行这些特定任务。 Let it fire up GAE to clean the data and put the result back to GCS to be ready to be used as your mobile application back end.
让它启动GAE来清理数据并将结果返回给GCS以准备好用作移动应用程序后端。
Following are some options to consider: 以下是一些需要考虑的选项:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.