简体   繁体   English

具有快速应用程序侦听和等待请求的 AWS Fargate docker 图像是否消耗 CPU?

[英]Does AWS Fargate docker image with express app listening and waiting for requests consume cpu?

I configured an AWS Fargate cluster with a docker image that runs nodejs express app and listens on port 80. Now I can browse to the public IP and successfully the request is handled by AWS Fargate.我使用运行 nodejs express 应用程序并侦听端口 80 的 docker 图像配置了一个 AWS Fargate 集群。现在我可以浏览到公共 IP 并成功地由 AWS Fargate 处理该请求。

Is it right that the docker container now is running and still waiting for requests? docker 容器现在正在运行,还在等待请求吗? Isn't it consuming CPU and so I have to pay as long as the docker container is running?它不是消耗 CPU,所以只要 docker 容器在运行,我就必须付费吗?

Do I have to build a docker image that just handles a single request and exits to be really serverless?我是否必须构建一个仅处理单个请求并退出的 docker 图像才能真正实现无服务器?

Thank you谢谢

Is it right that the docker container now is running and still waiting for requests? docker 容器现在正在运行,还在等待请求吗? Isn't it consuming CPU and so I have to pay as long as the docker container is running?它不是消耗 CPU,所以只要 docker 容器在运行,我就必须付费吗?

Yes, that's how ECS Fargate works.是的,这就是 ECS Fargate 的工作原理。 It's really no different from running a docker container on your local computer.这与在本地计算机上运行 docker 容器没有什么不同。 It has to be up and running all the time in order to handle requests that come in.它必须一直启动并运行才能处理传入的请求。

Do I have to build a docker image that just handles a single request and exits to be really serverless?我是否必须构建一个仅处理单个请求并退出的 docker 图像才能真正实现无服务器?

The term "serverless" is a vague marketing term and means different things depending on who you ask. “无服务器”一词是一个模糊的营销术语,根据您询问的对象不同,其含义也不同。 Amazon calls ECS Fargate serverless because you don't have to manage, or even know the details of, the server that is running the container. Amazon 将 ECS Fargate 称为无服务器,因为您不必管理运行容器的服务器,甚至不必了解其详细信息。 In contrast to ECS EC2 deployments, where you have to have EC2 servers up and running ahead of time and ECS just starts the containers on those EC2 servers.与 ECS EC2 部署相比,您必须提前启动并运行 EC2 服务器,而 ECS 只是在这些 EC2 服务器上启动容器。

If you want something that only runs, and only charges you, when a request comes in, then you would need to reconfigure your application to run on AWS Lambda instead of ECS Fargate.如果您想要只在收到请求时运行并且只向您收费的东西,那么您需要重新配置您的应用程序以在 AWS Lambda 而不是 ECS Fargate 上运行。

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

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