arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2608.15668cs.SE

电商应用的单体架构与微服务架构的实证比较

An Empirical Comparison of Monolithic and Microservices Architectures for an E-Commerce Application

Swayam Amol Katole

AI总结:

本文通过实验比较同一电商应用的单体与微服务架构,发现100虚拟用户负载下微服务在吞吐量、延迟等指标上更优,但存在特定服务的短暂故障。

AI中文摘要:

微服务架构因承诺的可扩展性和模块化而被广泛采用,但将其运行时性能与单体设计进行比较的实证证据仍具有上下文依赖性。本文对同一电商应用的单体实现和微服务实现进行实验比较,两者均由共享的PostgreSQL数据库提供支持。使用k6工具,我们在60秒的运行时间内,以50个虚拟用户(VUs)和100个虚拟用户(VUs)的相同HTTP工作负载对两个系统进行测试,测量吞吐量、延迟和错误率。在50个VUs时,两种架构的性能相似,无错误。在100个VUs时,微服务设计的吞吐量比单体高5.4%,平均延迟低25%,p95延迟低39%,同时中位数错误率更低(0.00%对比0.69%)。单体在负载下出现持续的订单创建失败,而微服务的失败是短暂的,且在一次运行中仅局限于购物车服务。这些结果表明,在该部署场景下,将系统分解为微服务可提升压力下的可扩展性和尾部延迟,但会引入必须管理的、不同的特定服务故障模式。

英文摘要:

Microservices architectures are widely adopted for their promised scalability and modularity, yet empirical evidence comparing their runtime performance to monolithic designs remains context-dependent. This paper presents an experimental comparison of a monolithic and a microservices implementation of the same e-commerce application, both backed by a shared PostgreSQL database. Using k6, we subject both systems to identical HTTP workloads at 50 and 100 virtual users (VUs) over 60-second runs, measuring throughput, latency, and error rates. At 50 VUs, both architectures perform similarly with no errors. At 100 VUs, the microservices design achieves 5.4% higher throughput, 25% lower average latency, and 39% lower p95 latency than the monolith, while exhibiting a lower median error rate (0.00% vs 0.69%). The monolith shows consistent order-creation failures under load, whereas microservices failures are transient and confined to the cart service in one run. These results suggest that, in this deployment context, decomposing the system into microservices improves scalability and tail latency under stress, while introducing distinct, service-specific failure modes that must be managed.

补充信息

↑