简体   繁体   English

AWS:按需运行计算繁重的进程(Windows 可执行文件)

[英]AWS: Running Computation Heavy processes (Windows executable) on-demand

I need to run a Windows executable based on an HTTP request.我需要根据 HTTP 请求运行 Windows 可执行文件。 The process is computational heavy hence required large processing powers.该过程计算量很大,因此需要很大的处理能力。 I am using AWS ec2 instances so far to run these executions.到目前为止,我正在使用 AWS ec2 实例来运行这些执行。 C5.2xlarge, windows EC2 instance. C5.2xlarge,windows EC2 实例。

These requests are not frequent but have to be served without delay.这些请求并不频繁,但必须立即处理。

Issue here is这里的问题是

  • We are wasting quite a lot of money just to keep that heavy instance running for those abrupt requests.我们浪费了很多钱,只是为了让这个繁重的实例为那些突然的请求运行。
  • There is no Linux alternative for this executable.此可执行文件没有 Linux 替代方案。

Is it possible to make it more efficient?有没有可能让它更有效率? Paying only for the execution and not the idle time.只为执行而不是空闲时间付费。 Any suggestions for architectural changes?对架构更改有什么建议吗? Even on other cloud platforms will work for us.即使在其他云平台上也适用于我们。 Note: I could not figure out if AWS Lambda or Batch processing is possible for this scenario.注意:我不知道 AWS Lambda 或批处理是否适用于这种情况。

I would suggest changing the architecture a bit to facilitate your case and save some money:我建议稍微更改架构以方便您的案例并节省一些钱:

AWS Fargate. AWS 法门。

This is how their solution architect describes it:他们的解决方案架构师是这样描述的:

AWS Fargate is an easy way to deploy your containers on AWS. AWS Fargate 是一种在 AWS 上部署容器的简单方法。 To put it simply, Fargate is like EC2 but instead of giving you a virtual machine you get a container.简单地说,Fargate 就像 EC2,但不是给你一个虚拟机,而是一个容器。 It's a compute engine that allows you to use containers as a fundamental compute primitive without having to manage the underlying instances.它是一个计算引擎,允许您将容器用作基本计算原语,而无需管理底层实例。

Fargate service allows you to run containers on demand. Fargate 服务允许您按需运行容器。 Kind of a serverless for containers.一种用于容器的无服务器。

Assuming you have knowledge of containers (or can learn it) - all you have to do is to create a container with windows based image, that will contain all the executables you need.假设您了解容器(或可以学习) - 您所要做的就是创建一个带有基于 windows 的映像的容器,该容器将包含您需要的所有可执行文件。

Once created, you upload it to AWS ECR (Elastic Container Registry) where your image build will be stored and then, set up a new service in ECS Fargate (ECS = Elastic Container Service) specifying the CPU and memory requirements.创建后,您将其上传到 AWS ECR(Elastic Container Registry),您的镜像构建将在其中存储,然后在 ECS Fargate(ECS = Elastic Container Service)中设置新服务,指定 CPU 和 memory 要求。

Once all was set up correctly and all is working - you'll be able to launch the containers similarly to how you'd do it with Lambda.一旦一切设置正确并且一切正常 - 您将能够像使用 Lambda 一样启动容器。 Fargate will receive your request, bring the container up, do the computational job, and will shut down once completed. Fargate 将收到您的请求,启动容器,执行计算工作,并在完成后关闭。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM