The Micro-service design of E-commerce System
Background
Suppose you are the CTO of a start-up company. The engineering team is about 30 people, including 5 front-ends and 25 back-ends. All the back-end are Java developers. Now you are going to start a small program e-commerce business from scratch.
Microservice
E-commerce is a very well-developed industry. There are so many successful patterns we can learn and borrow. We can start on the shoulders of giants. Since e-commerce is a well-developed industry and we already have a good understanding of the business domains, we can decompose our services by business domains.
Microservices Decomposition Pattern — Decompose by Subdomain
This is what the business subdomains look like. We would have:
Product Catalog
Orders
Inventory
Payment
Customers
External Forecasting
Each business subdomain will be a microservice.
Infrastructure
Core elements of a microservices architecture
For infrastructure, such as service registry, service discovery, and routing, there are different approaches.
Embed SDK
Service Proxy
Service Mesh
Since we are a small start-up company, we don't have many DevOps resources and a unique language small team (all use Java), Embedded SDK is the best fit.
Framework
Since we are using Java and the embedded SDK approach, we will choose Spring Cloud.
What is Spring Cloud
Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, micro-proxy, control bus, one-time tokens, global locks, leadership election, distributed sessions, cluster state). Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns. They will work well in any distributed environment, including the developer’s own laptop, bare metal data centres, and managed platforms such as Cloud Foundry.
Spring Cloud focuses on providing good out of box experience for typical use cases and extensibility mechanism to cover others.
Distributed/versioned configuration
Service registration and discovery
Routing
Service-to-service calls
Load balancing
Circuit Breakers
Global locks
Leadership election and cluster state
Distributed messaging
版权声明: 本文为 InfoQ 作者【David】的原创文章。
原文链接:【http://xie.infoq.cn/article/c6be75a5d04677106f2e704aa】。文章转载请联系作者。
评论