(评论)
(comments)
原始链接: https://news.ycombinator.com/item?id=38542764
这提出了与无服务器架构固有的性能和耐用性挑战相关的几个问题,并凸显了将它们应用于边缘网络和数据库操作等某些场景的局限性。 While serverless solutions provide significant advantages such as flexibility, cost savings, and scalability, they also present unique challenges that require careful consideration and planning during the development process.
首先,“本地读取和远程写入”这一说法揭示了与使用无服务器架构处理数据库操作相关的关键挑战。 使用数据库时,由于无服务器功能的异步特性可能导致数据不一致,因此一致性变得至关重要。 通过本地读取,如果请求的数据本地存储在托管请求功能的实例中,则可以减少延迟并提高性能。 另一方面,远程写入需要将数据从客户端传输到数据库,反之亦然,从而导致更高的延迟、增加的传输带宽要求以及由于异步特性而导致的更大的一致性风险。 这些挑战需要设计适当的数据流模式、模式模型和同步机制,以确保分散方式的一致性,同时最大限度地减少延迟。
其次,对于边缘网络,无服务器架构的一项主要挑战是要求近实时、低延迟的响应时间。 边缘网络严重依赖事件驱动的架构设计; 具体来说,事件触发器的使用允许边缘设备立即响应传感输入事件。 相比之下,在无服务器模型中,加载相应 Lambda 函数所需的启动时间导致的响应延迟会导致更长的延迟时间,这可能会导致错失机会或收入损失。 此外,缺乏直接 IP 地址访问需要仔细的路由管理和额外的开销来实现处理 HTTP 调用的端点,这会增加延迟,从而影响用户满意度。 因此,应对这些挑战需要采用替代方法,例如,明确设计用于解决这些挑战、提高响应能力并减少延迟时间的以混合边缘网络为中心的无服务器架构。
第三,在采用无服务器架构之前需要考虑某些因素。 其中一些因素包括考虑与传统服务器应用程序相比运行无服务器应用程序相关的成本。 尽管无服务器架构由于自动扩展和自我管理功能而导致整体基础设施减少并降低了运营费用,但它们可能会被证明
When starting out, these downsides are not really that visible. On the contrary, there is a very clear upside, which is that everything is free when you have low usage, and you have little to no maintenance.
It is only later, when you have built a hot mess of lambda workflows, which become more and more rigid due to interdependencies, that you wish you had just gone the monolith route and spent the few extra hundreds on something self-managed. (Or even less now, e.g. on fly.io)
A question for author: what if not using Elixir?
reply