Long-running task even with autoscaling

0

I would like to scale-out (and scale-in) a node.js application on ECS (Fargate). However, one task (container) should be long-running, should always use the same internal IP and should serve all HTTP requests (the additional tasks will only listen to messages on a SQS queue). Note that the task definition could all be the same (e.g., same image).

Can this be achieved by setting the minimum number of tasks to one or shall I rather create two deployments (one for single master node and one for multiple worker nodes)?

Dunken
質問済み 2ヶ月前150ビュー
1回答
0
承認された回答

To address your requirements for scaling a Node.js application on Amazon ECS (Fargate), it is recommended to create two separate services. One service would be dedicated to hosting the long-running task that should serve all HTTP requests. The other service would be responsible for scaling the additional tasks that listen to messages on the SQS queue.

While it is possible to define a single task definition for both components, following best practices for containerization suggests separating concerns into distinct containers or services. This approach promotes modularity, maintainability, and scalability of the application components.

Please note that in the Fargate, it is not possible to maintain the same internal IP address for a task. Fargate tasks are designed to be ephemeral and dynamic, and their underlying infrastructure (including IP addresses) can change. Therefore, relying on a fixed internal IP address for communication between containers or services is not feasible.

Instead, it is recommended to leverage the built-in service discovery mechanisms provided by AWS, such as DNS resolution (Service Connect or Service Discovery) or load balancers (Application Load Balancer or Network Load Balancer). These mechanisms ensure reliable and scalable communication between services, even as tasks are dynamically scaled or replaced.

By adopting this architecture, you can effectively scale the worker tasks independently while ensuring the long-running task remains available and accessible through a consistent endpoint, facilitating efficient request handling and message processing.

References:

profile pictureAWS
回答済み 2ヶ月前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ