Microservice fit into a cloud architecture
- A large and diverse user base: features to be delivered quickly
- Extremely high uptime requirements: easily isolate faults and problems to specific parts of an application without taking down the entire application
- Uneven volume requirements: components can be deployed independently of one another
Identifying and decomposing a business problem into microservice candidates → with Data model
- Describe the business problem, and listen to the nouns you’re using to describe the problem (contracts, licenses and assets)
- Pay attention to the verbs (looks, updates)
- Look for data cohesion: Microservices should completely own their data
self-contained unit
해당영역을 소유하는 서비스만 그 영역의 데이터베이스에 액세스 할 수 있음
- 모든 것을 마이크로서비스로 만들지 않는다 → 마이크로서비스는 비지니스로직의 표현
- 서비스간 교류방식에 집중
- 서비스의 크기와 책임이 늘어나면 새 서비스들의 기능을 캡슐화 한다
Conversation in Services: Service Interface
서비스 인터페이스 설계 지침
- REST 철학 수용: HTTP protocol and methods
- URI 사용해 의도 전달
- 요청, 응답에 JSON 사용
- HTTP 상태코드로 결과 전달
Designing the microservice architecture
Decomposing the business problem → Data model
- Describe the business problem and listen to the nouns
- Pay attention to the verbs
- Look for data cohesion → Microservices should own their data
Establishing service granularity
- start broad with your microservices and refactor to smaller services
- focus on how your services will interact with one another → interfaces
- responsibilities will change over time as your understanding of the problem domain grows
Microservice : an expression of business logic and not an abstraction layer over your data sources
Service interfaces
- Embrace the REST philosophy
- Use URI’s to communicate intent
- Use JSON for your request and response
- Use HTTP status codes to communicate results
마이크로 서비스 기본 골격
- maven script(pom.xml) 작성
-
Bootstrap 클래스 작성
- @SpringBootApplication
Reference
https://www.manning.com/books/spring-microservices-in-action