gpt4 book ai didi

java - 应该在微服务中使用多线程吗?

转载 作者:行者123 更新时间:2023-11-29 08:22:40 30 4
gpt4 key购买 nike

如果微服务是可扩展的,例如在 AWS 上部署为 ECS,是否应该在微服务开发中使用并行编程?

如果是,一个实例消耗更多资源与 N 个实例消耗相同资源有什么好处?

并行编程如何匹配https://12factor.net/

附言更具体地说——我应该在概念上使用并行流而不是简单流吗?

最佳答案

基本上您提供的链接也已经为您的问题提供了答案

This does not exclude individual processes from handling their own internal multiplexing, via threads inside the runtime VM, or the async/evented model found in tools such as EventMachine, Twisted, or Node.js. But an individual VM can only grow so large (vertical scale), so the application must also be able to span multiple processes running on multiple physical machines.

https://12factor.net/concurrency

关于java - 应该在微服务中使用多线程吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56244593/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com