🤖 AI Summary
This study addresses the lack of empirical evidence regarding performance disparities between microservice and monolithic architectures in e-commerce scenarios. Utilizing k6, we conducted quantitative load testing on both architectural paradigms sharing identical application logic and database backends. Experimental results demonstrate that under a 100-concurrent-user workload, the microservice architecture achieves a 5.4% increase in throughput and a 39% reduction in p95 tail latency, alongside lower error rates and superior fault isolation. These findings bridge the empirical gap in runtime performance comparison, validating the scalability advantages and specific failure modes of microservices under high load. Consequently, this research provides a reliable quantitative basis for informed architectural decision-making in e-commerce systems.
📝 Abstract
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.