Evolution of a Java Web E‑commerce System Architecture: From Single‑Server Deployment to Microservices and Distributed Infrastructure
This article walks through the step‑by‑step architectural evolution of a Java Web e‑commerce platform, covering initial single‑machine deployment, separation of application and database servers, clustering, load‑balancing algorithms, session handling, read/write splitting, search integration, caching, database sharding, microservice decomposition, SOA governance, and the introduction of message middleware.
Stage 0 – Introduction : The example builds a simple Java Web e‑commerce system to illustrate progressive architectural changes.
Stage 1 – Single‑Machine Site : All components (Tomcat/JBoss, JSP/Servlet, Spring, MyBatis, MySQL, etc.) run on one host, forming a basic monolithic system.
Stage 2 – Separate Application and Database Servers : The web server and database are split onto different machines, improving load capacity and fault tolerance.
Stage 3 – Application Server Cluster : Multiple application servers are added; traffic is distributed using load‑balancing techniques such as HTTP redirects, DNS round‑robin, reverse proxy (Nginx/Apache), IP‑level, and data‑link layer balancing. Algorithms like RR, WRR, LC, WRR‑LC, SH, DH, etc., are discussed.
Stage 4 – Session Consistency Solutions : Approaches include session sticky (IP hash), session replication, centralized session storage (database), and cookie‑based sessions, each with pros and cons.
Stage 5 – Read/Write Splitting and Master‑Slave Replication : Introduces read/write separation and MySQL master‑slave replication, or third‑party middleware (e.g., MyCat) to handle data consistency.
Stage 6 – Search Engine for Read‑Heavy Queries : Uses an inverted‑index search engine to accelerate fuzzy product searches, noting the added maintenance overhead.
Stage 7 – Caching Layer : Discusses page‑level, application‑level (Guava, Memcached), and database‑level (Redis) caching, emphasizing the need for consistent hashing in cache clusters.
Stage 8 – Database Sharding : Covers vertical sharding (separating user, product, transaction data) and horizontal sharding (splitting large tables across multiple databases), with challenges such as routing, primary‑key handling, and pagination.
Stage 9 – Application Decomposition : Moves toward microservices by splitting user, product, and transaction domains, then adopts SOA to centralize common services.
Stage 10 – Message Middleware Integration : Introduces language‑agnostic messaging (e.g., Dubbo with Zookeeper) to enable reliable inter‑service communication, load‑balancing transparency, and operational monitoring.
Conclusion : The evolution path is illustrative; real‑world architecture must be tailored to specific business needs and growth patterns.
IT Architects Alliance
Discussion and exchange on system, internet, large‑scale distributed, high‑availability, and high‑performance architectures, as well as big data, machine learning, AI, and architecture adjustments with internet technologies. Includes real‑world large‑scale architecture case studies. Open to architects who have ideas and enjoy sharing.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.