简体   繁体   English

Google Serverless function - 它可以运行一个进程还是只运行一个程序?

[英]Google Serverless function - Can it run a process or just a single program?

We have a shell script that runs a combination of java and python programs through multiple steps.我们有一个 shell 脚本,它通过多个步骤运行 java 和 python 程序的组合。 In AWS, when we need to run more than one concurrently, we send a parameter set, and a request to the VMs all prebuilt (serverlist is CV-1, CV-2,CV-3 etc) with this in mind.在 AWS 中,当我们需要同时运行多个时,我们会发送一个参数集和一个请求到所有预先构建的虚拟机(服务器列表是 CV-1、CV-2、CV-3 等)。 Several of these processes can be running at once, they don't have any inter-dependencies except the database updates.其中几个进程可以同时运行,除了数据库更新之外,它们没有任何相互依赖关系。 We have had up to 16 VM running at the same time with no issues, with one controlling instance that just keeps track of when each one is done.我们有多达 16 个虚拟机同时运行,没有任何问题,只有一个控制实例可以跟踪每个虚拟机何时完成。

We are looking for still more scalability.我们正在寻找更多的可扩展性。 It would be nice if we didn't need to have the 16 machines "running" and waiting for something to kick them off.如果我们不需要让 16 台机器“运行”并等待启动它们,那就太好了。 We would like to be able to kick off as many as we need, but equally interested in NOT paying for them when they are idle.我们希望能够启动尽可能多的项目,但同样有兴趣在它们空闲时不为它们付费。 They are idle more than 80% of the time.它们有超过 80% 的时间处于空闲状态。 But once we need them, we need them fast as some of these can take a while to finish.但是一旦我们需要它们,我们就需要它们,因为其中一些可能需要一段时间才能完成。 The machines are all the same size.机器尺寸都一样。 That may be a problem also.这也可能是个问题。

I was working through the google server less examples, and while it seems to be what I need, it isn't completely clear if it works the way I was hoping.我正在研究 google server less examples,虽然它似乎是我需要的,但它是否按我希望的方式工作并不完全清楚。 I am hoping that I can put all of the programs (python,Java, shell) in a container and instantiate an instance of the machine on the fly.我希望我可以将所有程序(python、Java、shell)放在一个容器中,并即时实例化机器的一个实例。 I only need to pass it 3 parameters and that looks easy enough.我只需要传递 3 个参数,这看起来很容易。

Where I am getting confused, is what it is capable of running.我感到困惑的地方是它能够运行什么 I have yet to see an example where it kicks off a shell script or a python program.我还没有看到启动 shell 脚本或 python 程序的示例。 Lots of Java "hello world" which for my level of expertise right now is fine, but I don't see anything that runs a shell script.很多 Java “hello world” 就我现在的专业水平来说还不错,但我没有看到任何运行 shell 脚本的东西。 Even a python "script" would be acceptable and might even be better.即使是 python “脚本”也是可以接受的,甚至可能更好。

Each script runs between 10 min and 5 hours depending on size of the input.每个脚本运行 10 分钟到 5 小时,具体取决于输入的大小。 So a startup of 4-5 min is not going to bother us.所以4-5分钟的启动不会打扰我们。 Most are in the 20 min range, about 5% are in the 4+hour range.大多数在 20 分钟范围内,大约 5% 在 4+ 小时范围内。

The questions is really: Is this approach going to work with Google serverless?问题确实是:这种方法是否适用于 Google 无服务器? If its a no, then the rest of these don't matter overmuch !如果它没有,那么这些 rest 无关紧要!

Thanks谢谢

The Serverless Compute products (Cloud Run, Cloud Function, App Engine) answer to HTTP request.无服务器计算产品(Cloud Run、Cloud Function、App Engine)响应 HTTP 请求。 So you need to expose an HTTP server to use these services.所以你需要暴露一个 HTTP 服务器来使用这些服务。 No background processing is possible, and you are limited in time无法进行后台处理,时间有限

  • 9 minutes with Cloud Functions云函数 9 分钟
  • 60 minutes with Cloud Run Cloud Run 60 分钟
  • 24h with App Engine standard with basic or manual scalling + Cloud Task 24 小时使用 App Engine 标准,带有基本或手动缩放 + Cloud Task

If you need to run background processes, or no https processes, you can cheat with Cloud Build (use your container and run the command that you want in a fake Build) or you can use AI Platform custom training to run your container for hours.如果您需要运行后台进程,或者没有 https 进程,您可以使用 Cloud Build 作弊(使用您的容器并在虚假构建中运行您想要的命令),或者您可以使用AI Platform 自定义训练来运行您的容器数小时。

This latest solution is the only one that support GPUs capacity.这个最新的解决方案是唯一支持 GPU 容量的解决方案。

You will need to update or redesign your processes to fit this model.您将需要更新或重新设计您的流程以适应此 model。 I think the portability isn't immediate according to your requirements.根据您的要求,我认为可移植性不是立即的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将数据从多个 Chrome 扩展程序提供给单个 Google 电子表格的最佳无服务器方式 - Best SERVERLESS way to feed data from multiple Chrome extensions to a single Google Spreadsheet 我可以使用Google App Engine在后台运行chrome扩展程序的python程序吗? - Can I use google app engine to run the python program in the background for chrome extension? 尝试运行Google App Engine程序时无法连接到localhost:8080 - Can't connect to localhost:8080 when trying to run Google App Engine program 如何在Google云上运行单个php文件? - How to run a single php file on Google cloud? 如何设计内存和计算密集型程序以在Google App Engine上运行 - How to design a memory and computationally intensive program to run on Google App Engine 我可以仅在GAE中的特定端点上使用Google Cloud Endpoints吗 - Can I use Google Cloud Endpoints just on a specific endpoint in GAE 如何仅将一个文件部署到谷歌应用引擎? - How can I deploy just one file to google app engine? 在Google App Engine后端上连续运行功能 - Run function continuously on Google App Engine Backends 无法在Google App Engine中运行Coursebuilder - Can't run coursebuilder in google app engine Pandas可以在Google App Engine for Python上运行吗? - Can Pandas run on Google App Engine for Python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM