SlideShare a Scribd company logo
Micro-services
Architecture
Domain-Driven-Design
Multi-tenancy
DevOps
클라우드 서비스 개발을 위한 마이크로 서비스
아키텍처와 멀티테넌시 적용사례
Jinyoung Jang
(jyjang@uengine.org)
성공적인 서비스들
성공적 서비스로의 여정
운영자동화
• Business Continuity
• Zero-downtime
수익화
• Subscription Business
구현
• Mashups
• Multi-tenancy
• Self-Serviced
마이크로 서비스
• Separation of Concerns
Successful Serv
ice
Multi-tenancy Support
Self Service
Tenant-specific Customization > Custom Database Schema > S
hared Database vs. Shared schema
© 2013 uEngineCloud, I
nc.
Rigid, shared table Extension tabl
es
Datatype-specifi
c pivot tables
Private tables
Universal tabl
e with XML d
ocument
Universal table
Supporting Multi-tenancy
어떤 DB 구조로 설계해야 하나요?
Supporting Multi-tenancy
Force.com: Multi-tenant Kernel
Adaptive Object Model
7
http://adaptiveobjectmodel.com
• Class Definition model in
instance level
• Definition can be stored in a
XML file or database.
• Very Flexible to Extend
• Polymorphism for multi-
tenant
Drawbacks:
• Hard to read code
• Error-prone
Reflection + AOM
8
• Since Java 1.2
• Java Class definition can be
accessible with Reflection
APIs
• For the concrete part, Get
the Metadata from Class
Definition
• For the flexible part, use the
AOM
Annotation + Reflection + AOM
9
• Since Java 1.5
• Rather use separated XML
files, use @ for specifying
additional (user-defined)
metadata for class definition
Supporting Multi-tenancy
NoSQL databases
1. Inherent multi-tenancy - Schema Free
2. High Performance - Horizontally scalable and Memory cache
3. Web optimized – Query results are JSON - data can be
parsed by web browser directly and performantly.
Additionally -
4. Easy to implement Analytic services (MR) and Full Text Search
5. Event-driven Transaction - don't have to care about CQRS
something
6. Some NoSQL products (Couchbase, Cassandra) provides
pessimistic locking and ANSI SQL (Join Query) - easily
migrate to them.
DevOps: Issues
Continuous Delivery
11
Company Deploy Frequency Deploy Lead Time Reliability Customer
Responsiveness
Amazon 23,000 / day Minutes High High
Google 5,500 / day Minutes High High
Netflix 500 / day Minutes High High
Facebook 1 / day Hours High High
Twitter 3 / week Hours High High
Typical enterprise Once every 9 months Months or quarters Low / Medium Low / Medium
출처: 도서 The Phoenix Project
Amazon, Google, Netflix, Facebook, Twitter는 얼마나 자주 배포할까요?
Monolithic Architecture
 모든 서비스가 한번에 재배포
 한팀의 반영을 위하여 모든 팀이 대기
 지속적 딜리버리가 어려워
Micro Service Architecture
Contract based, Polyglot Programming
 Separation of Concerns, Parallel Development, Easy Outsourcing
Written in Java
Written in Node
Written in PHP
Example of Aggregate from different data
sources
14
REST Maturity Model
15
Level 0: Swamp of POX
• Use as a RPC, returns full serialized document
16
<openSlotList>
<slot start = "1400" end = "1450">
<doctor id = "mjones"/>
</slot>
<slot start = "1600" end = "1650">
<doctor id = "mjones"/> </slot> </openSlotList>
Level 1: Resources
Level 1 tackles the question of handling complexity by using divide
and conquer, breaking a large service endpoint down into multiple
resources.
17
<openSlotList>
<slot id = "1234" doctor = "mjones" start = "1400" end = "
<slot id = "5678" doctor = "mjones" start = "1600" end = "
</openSlotList>
Level 2: HTTP Verbs
Level 2 introduces a standard set of verbs so that we handle similar
situations in the same way, removing unnecessary variation.
18
Operation HTTP / REST
Create PUT / POST
Read (Retrieve) GET
Update (Modify) PUT / PATCH
Delete (Destroy) DELETE
Level 3: Hypermedia Controls
19
<appointment>
<slot id = "1234" doctor = "mjones" start = "1400" end =
"1450"/> <patient id = "jsmith"/>
<link rel = "/linkrels/appointment/cancel" uri =
"/slots/1234/appointment"/>
<link rel = "/linkrels/appointment/addTest" uri =
"/slots/1234/appointment/tests"/>
<link rel = "self" uri = "/slots/1234/appointment"/>
<link rel = "/linkrels/appointment/changeTime" uri =
"/doctors/mjones/slots?date=20100104@status=open"/>
<link rel = "/linkrels/appointment/updateContactInfo" uri =
"/patients/jsmith/contactInfo"/>
<link rel = "/linkrels/help" uri = "/help/appointment"/>
</appointment>
Level 3 introduces discoverability, providing a way of making a
protocol more self-documenting.
Micro Service Architecture
• 변경된 서비스만 재배포
 Side effect 최소화
• 자율성
 각 서비스에 대한 자유로운 언어, 아키텍처, 아웃소싱 용이
• 병렬 개발, 타임 투 마켓, 린 개발
Building multi tenancy enterprise applications - quick
Micro Service Architecture
Design Factor for Front-end
One Page
N-Screen
Responsive
Dynamic
Real-time
Front-end
Image
Server
(Python)
Business
Logic
Server
(Java)
Extended Role of Front-end in Cloud Applications
Aggregator for multiple (polyglot programmed) micro-services
Component
Service
(C)
AJAX, RESTful
Concurrent Cloud Applications are composed of multiple
Micro Services and front-end serves as an aggregator of the
services
Writing One Page Web App
Problems: One Page Web App  Low Cohesion and High Coupling
<style>
style for A
style for B
style for C
</style>
<html>
element for A
element for B
element for C
</html>
<script>
script for A
script for B
script for C
</script>
W3C Web Components
<style>
style for A
style for B
style for C
</style>
<html>
element for A
element for B
element for C
</html>
<script>
script for A
script for B
script for C
</script>
#A.html
<style>
style for A
</style>
<html>
element for A
</html>
<script>
script for A
</script>
#B.html
<style>
style for B
</style>
<html>
element for B
</html>
<script>
script for B
</script>
#C.html
<style>
style for C
</style>
<html>
element for C
</html>
<script>
script for C
</script>
#index.html
<A> <A>
<B> <B> <B>
<C>
Web Components : Implementations
• Provides Cohesive Component Model
• Component Composition by HTML
markup
• Dynamic Data Binding
• Responsive Web by Material Design
• Standard
Polymer VueJS
IAM
(Human)
Front-end
Service
Service
API G/W
Service
Service
Stateless 인증, 통합빌링을 위한 IAM
Tenant Billing
(Machine)
Third-party Apps
Billing
IAM token
provider
API Gateway
(Human)
Front-end
Servi
ce
Service
API G/W
Service
Service
We need API Gateway for aggregating, forwarding
services and exposing composite APIs
Tenant-Specific Routing
(Machine)
Third-party Apps
Billing
(Human)
Front-end
Service
Service
API G/W
Service
Service
We need API Gateway for aggregating, forwarding
services and exposing composite APIs
Tenant-Specific Billing
(Machine)
Third-party Apps
Billing
Example: Auto Insurance - multi-tenancy
30
Java Back-end + RDB
(Spring REST/JPA/MySQL)
NoSQL
(Couchbase Bucket API)
Tenant-dataCommon-data
Example: Auto Insurance – IAM & API GW
31
Spring REST/JPA/MySQL Couchbase Bucket API
API GW
• Token Validation
• JSON trimming,
transformation
• Cross Origin Resource
Sharing
• Adding Hateoas links*
IAM
Id/pwd
JWT
token
Metaworks4
Open Source SaaS Platform mimicking Salesforce’s Multitenant Kernel
www.metaworks4.io
Concepts & Backgrounds
도메인 주도 설계 마이크로 서비스 아키텍처 머터리얼 디자인
MW4 개발 프로세스
생
성
생
성
• Full-fledged Responsive Web
Single Page Application
• With google-material design• POJO based Domain Model
• Add annotations (JAX-RS, JPA,
Jackson, metaworks)
• Domain Class Analysis
도메인
클래스
모델링
애노테이
션
UI 컴포넌
트 배치
DDD(Domain-Driven Design) - 도메인 주도 설계
• 마이크로서비스를 구현하기에 앞서 설계하기 위해 필요한 유용한 개념 DDD.
• 추천 도서 : “Eric Evans의 Domain Driven Design”, 도메인 주도 설계
• DDD에서 얻을 수 있는 해법(책에서 다루는 내용)
• 어떤 단위로 서비스를 구성할 것인가
• 서비스의 결합
• 변화에 강한 설계
• 레거시 시스템을 단계적 폐기
• 리팩터링 전략
35
BRIDGING THE WORLDS OF DDD & REST, https://ordina-
jworks.github.io/conference/2016/07/10/SpringIO16-DDD-Rest.html
https://www.infoq.com/minibooks/domain-driven-design-quickly
Domain-Driven Design
1. Using ‘Ubiquitous Language’ so that the domain expert and developer
can communicate
37
Entity & Value Object  ERD, DB, ORM
38
Generate ERD and Entity Classes (ORM)
• Open the Class Diagram in the
Project Explorer > Diagram
Navigator > ClassDiagram
• Set the type of attributes
– String for most types
– boolean for gender
– int for options
– double for money
– java.util.Date for Dates, timestamp
• Modeling > ORM > Generate Code
• Database Code Generation Options:
– Framework: JPA
– Persistence API: POJO
• Be careful:
– All attributes must have its type
– All classes should be belong to any
package
39
Generated Entity Classes (JPA)
• All Entity Codes are POJO Classes that are described with Java Annotations meaning
entity field descriptions and relationships.
40
Repository  REST, JSON
41
Entity PK type
Generated REST (Level 3) Service
• CRUD
• Pagination / Sorting
• HATEOAS
42
Aggregate  REST
43
# http://www.auto.com:8080/customers
[{ ”id" : 1,
”firstName": ’jinyoung',
”lastName": ’jang',
"tenantProperties":
'http://mongodb.auto.com:8080/tenantData/td
_1'},{...},{...},....]
#
http://mongodb.auto.com:8080/tenantData/t
d_1
{
"ext1": 'aaa’,
"ext2": 'bbb’
}
MW4 Components
44
MW4 Tags
IAM&Service
Locator
Iam-login
service-locator
Metadata
driven UI
object-grid
object-form
Self service
portal
ssp-class
ssp-meta
MW4 Components – Vue Material
45
Vue-material
Tags
Widgets
Avatar
List
Panel
Icon
...
Layout
responsive
layout
...
“Beautiful construct”
<iam-login/>
46
OAuth2.0
IAM Server
Id/pwd
Token
(expiration: XX)
<service-locator/>
Set the token
<service-locator/>
47
화면없음
(Headless tag) <service
-
locator/
>
<object-
grid/>
<object-
form/>
Backend
call
call
ajax
X-Auth-Token
<object-grid/>
48
<object-form/>
49
Self Service Portal <ssp-class/>
50
필드추가
Self Service Portal <ssp-mashup/>
51
default
customized
The Length of Code
52
323Lines
For Developing Full-CRUD, RESTful, MSA-based,
Material-Designed, Responsive, Grid+Form, Multi-
tenant and Self-Served Application:
• Number of fields of the entity: 10
• Total lines of code per an entity:
92 for front-end,
215 for domain class,
16 lines for repository.
How it works
Common Metadata
Domain Model
Classes
Class model for tenant1
ORM for tenant1
Common class model
Metadata of
Tenant1
Metadata of
Tenant2
Metadata of
Tenant3
Class model for tenant2
ORM for tenant2
Class model for tenant3
ORM for tenant3
Override by tenantID
Model
metadata
Front
(Vue.js /
polymer)
REST backend
(Spring hateoas)
ORM
(Spring
JPA)
Domain Class
Developer
generates generates
generates
How it works
Model
metadata
Front
(Vue.js /
polymer)
REST backend
(Spring hateoas)
ORM
(Spring
JPA)
Domain Class
Developer
generates generates
generates
How it works
ALPS
IETF Standard for metadata
Multi-tenant / Self service Support
Self service
Self service
portal
• Add new attribute
• Attributes can be String,
number, Data from referenced
class (table)
• Change the title, order of
attributes
• Hide/Show attribute
Model
metadata
Front
(Vue.js /
polymer)
REST backend
(Spring
hateoas)
ORM
(Spring
JPA)
Domain ClassSelf-Service Portal
couchbase
Tenant
Admin
Developer
overrides
Overriding
metadata
generates generates
generates
How it works
활용 오픈소스
Vue.js Vue MaterialFront
REST Service
Persistence
활용 오픈소스 – 2 – for MSA
BackEnd 1
IAM
API GW
BackEnd 2
Billing/
Metering
Front
OCE-IAM
OCE-API-GW
OCE-Bill
www.opence.org
OCE IAM
60
OCE API Gateway
OCE Billing – Open Source Billing
https://github.com/TheOpenCloudEngine/uEngine-bill
Roadmap
• Self Service Portal Tags – ssp-process, ssp-rule
• Annotation based HATEOAS Support
• CQRS Transaction
Roadmap
• Self Service Portal Tags – ssp-process, ssp-rule
• Annotation based HATEOAS Support
• CQRS Transaction
Spring REST/JPA/MySQL Couchbase Bucket API
API GW
consistency
Tip: SOA and MSA
65
SOA MSA
Aggregation
(데이터 통합)
Backend 가 주도 Front 가 주도
Database 통합 데이터베이스 서비스 별 데이터베이스
필수 환경 WAS DevOps, PaaS (Grid
Engine)
서비스 굵기 업무 비즈니스 기능별 구현 팀별, 10000 라인
이하로?, 관심사별
Container / Packaging WAS / WAR Spring-Boot, Docker
Source Code
• https://github.com/jinyoung/sw-modeling-example
• https://github.com/TheOpenCloudEngine/micro-service-
architecture-vuejs
• https://github.com/olivergierke/spring-restbucks
66
References
• Metaworks4 – www.metaworks4.io
• SPOSAD Architecture Style -
https://pdfs.semanticscholar.org/7635/17ef805f24e64c8bc1b9e221e1
cdbc7ef416.pdf
• Rest in Practice, pdf online - https://www.gitbook.com/book/dennis-
xlc/rest-in-practice/details
• DDD quickly, pdf online –
https://www.infoq.com/minibooks/domain-driven-design-quickly
• Spring JPA –
https://spring.io/guides/gs/accessing-data-jpa/
• Spring JPA and HATEOAS –
https://spring.io/guides/gs/accessing-data-rest/
• Mapping JPA entities to external REST resources in spring-data-rest –
https://objectpartners.com/2016/02/18/mapping-jpa-entities-to-
external-rest-resources-in-spring-data-rest/
• Vue JS with Material Design - https://vuematerial.github.io/#/getting-
started
67

More Related Content

PPTX
Micro service architecture
PPTX
Metaworks4 intro
PPTX
Bluemix paas 기반 saas 개발 사례
PDF
Building multi tenancy enterprise applications
PPTX
성공적인 서비스로의 플랫폼 선택
PPTX
microservice architecture public education v2
PPT
Soa Driven Project Management
PPTX
Safe cloud native transformation approaches
Micro service architecture
Metaworks4 intro
Bluemix paas 기반 saas 개발 사례
Building multi tenancy enterprise applications
성공적인 서비스로의 플랫폼 선택
microservice architecture public education v2
Soa Driven Project Management
Safe cloud native transformation approaches

What's hot (20)

PPTX
9 design factors for cloud applications
PPT
Soa Overview
PPTX
Microservices - Event-driven & the hidden landmines
PDF
Merging micrservices architecture with SOA Practices
PDF
Microservices architecture examples
PDF
Spring Into the Cloud
PPTX
REST and Microservices
PDF
#JaxLondon keynote: Developing applications with a microservice architecture
PPTX
Microservices with .Net - NDC Sydney, 2016
PDF
Node and Micro-Services at IBM
PDF
Grails and the World of Tomorrow
PDF
Bluemix 로 접근하는 DevOps - Cognitive Cloud Connect
PDF
JBoss Fuse Service Works
PDF
Full lifecycle of a microservice
PPT
Agile Development From A Developers Perspective
PPTX
Microservices Architecture (MSA) - Presentation made at AEA-MN quarterly even...
PPTX
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
PDF
Easy integration of Bluemix services with your applications
PDF
Microservices (msa) insights with comments
ODP
Spring Mvc,Java, Spring
9 design factors for cloud applications
Soa Overview
Microservices - Event-driven & the hidden landmines
Merging micrservices architecture with SOA Practices
Microservices architecture examples
Spring Into the Cloud
REST and Microservices
#JaxLondon keynote: Developing applications with a microservice architecture
Microservices with .Net - NDC Sydney, 2016
Node and Micro-Services at IBM
Grails and the World of Tomorrow
Bluemix 로 접근하는 DevOps - Cognitive Cloud Connect
JBoss Fuse Service Works
Full lifecycle of a microservice
Agile Development From A Developers Perspective
Microservices Architecture (MSA) - Presentation made at AEA-MN quarterly even...
Building Microservices with .NET (speaker Anton Vasilenko, Binary Studio)
Easy integration of Bluemix services with your applications
Microservices (msa) insights with comments
Spring Mvc,Java, Spring
Ad

Similar to Building multi tenancy enterprise applications - quick (20)

PPTX
Microservice Pattern Launguage
DOC
Shyam pcf
DOCX
@@@Resume2016 11 11_v001
PDF
Experiences using CouchDB inside Microsoft's Azure team
PPTX
Normalizing x pages web development
PPTX
Business and IT agility through DevOps and microservice architecture powered ...
PPTX
Microservices
PDF
Django è pronto per l'Enterprise
PDF
Sudhir srivastava profile
PPTX
Teched India Vijay Interop Track
PPTX
DevOps and Microservice
PPTX
Vijay Oscon
DOCX
Md Zahir Uddin
PPTX
PDF
All-inclusive insights on Building JavaScript microservices with Node!.pdf
PPTX
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
DOC
Madhava_Sr_JAVA_J2EE
PDF
Cloud APIs Overview Tucker
PPTX
Introduction to microservices
PDF
Nodejs framework for app development.pdf
Microservice Pattern Launguage
Shyam pcf
@@@Resume2016 11 11_v001
Experiences using CouchDB inside Microsoft's Azure team
Normalizing x pages web development
Business and IT agility through DevOps and microservice architecture powered ...
Microservices
Django è pronto per l'Enterprise
Sudhir srivastava profile
Teched India Vijay Interop Track
DevOps and Microservice
Vijay Oscon
Md Zahir Uddin
All-inclusive insights on Building JavaScript microservices with Node!.pdf
Dirigible powered by Orion for Cloud Development (EclipseCon EU 2015)
Madhava_Sr_JAVA_J2EE
Cloud APIs Overview Tucker
Introduction to microservices
Nodejs framework for app development.pdf
Ad

More from uEngine Solutions (20)

PPTX
이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기
PDF
Event storming based msa training commerce example add_handson_v3
PDF
Event storming based msa training commerce example v2
PDF
Event storming based msa training commerce example
PPTX
Event Storming and Implementation Workshop
PDF
designing, implementing and delivering microservices with event storming, spr...
PPTX
Microservice coding guide
PPTX
유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)
PPTX
Distributed transanction in microservices
PPTX
Open Cloud Engine PaaS Snapshots
PDF
Private PaaS with Docker, spring cloud and mesos
PPTX
Process Oriented Architecture
PPTX
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
PPTX
Essencia 2017
PPTX
Front-end architecture for cloud applications and Polymer
PPTX
객체지향프로그래밍 특강
PPTX
Open source apm scouter를 통한 관제 관리 jadecross 정환열 수석
PPTX
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
PPTX
Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사
PPTX
2015 u engine and oce day 개회사겸 식순 소개
이벤트스토밍과 BDD 를 혼합하여 소프트웨어 디자인과 테스트 자동화하기
Event storming based msa training commerce example add_handson_v3
Event storming based msa training commerce example v2
Event storming based msa training commerce example
Event Storming and Implementation Workshop
designing, implementing and delivering microservices with event storming, spr...
Microservice coding guide
유엔진 오픈소스 클라우드 플랫폼 (uEngine Microservice architecture Platform)
Distributed transanction in microservices
Open Cloud Engine PaaS Snapshots
Private PaaS with Docker, spring cloud and mesos
Process Oriented Architecture
아키텍트대회 유엔진-장진영-Sw공학표준을 기반한 alm
Essencia 2017
Front-end architecture for cloud applications and Polymer
객체지향프로그래밍 특강
Open source apm scouter를 통한 관제 관리 jadecross 정환열 수석
클라우드 서비스운영 플랫폼 가루다 Open cloudengine_패스트캣_cto 송상욱
Io t에서 big data를 통합하는 통합 빅데이터 플랫폼 flamingo_클라우다인_김병곤 대표이사
2015 u engine and oce day 개회사겸 식순 소개

Recently uploaded (20)

PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
AI in Product Development-omnex systems
PDF
Nekopoi APK 2025 free lastest update
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PDF
System and Network Administration Chapter 2
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
PDF
wealthsignaloriginal-com-DS-text-... (1).pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
ai tools demonstartion for schools and inter college
PDF
Digital Strategies for Manufacturing Companies
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Understanding Forklifts - TECH EHS Solution
PPTX
L1 - Introduction to python Backend.pptx
PPTX
history of c programming in notes for students .pptx
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
VVF-Customer-Presentation2025-Ver1.9.pptx
2025 Textile ERP Trends: SAP, Odoo & Oracle
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
AI in Product Development-omnex systems
Nekopoi APK 2025 free lastest update
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Navsoft: AI-Powered Business Solutions & Custom Software Development
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
System and Network Administration Chapter 2
Odoo POS Development Services by CandidRoot Solutions
Flood Susceptibility Mapping Using Image-Based 2D-CNN Deep Learnin. Overview ...
wealthsignaloriginal-com-DS-text-... (1).pdf
PTS Company Brochure 2025 (1).pdf.......
ai tools demonstartion for schools and inter college
Digital Strategies for Manufacturing Companies
How to Choose the Right IT Partner for Your Business in Malaysia
Understanding Forklifts - TECH EHS Solution
L1 - Introduction to python Backend.pptx
history of c programming in notes for students .pptx

Building multi tenancy enterprise applications - quick

  • 1. Micro-services Architecture Domain-Driven-Design Multi-tenancy DevOps 클라우드 서비스 개발을 위한 마이크로 서비스 아키텍처와 멀티테넌시 적용사례 Jinyoung Jang (jyjang@uengine.org)
  • 3. 성공적 서비스로의 여정 운영자동화 • Business Continuity • Zero-downtime 수익화 • Subscription Business 구현 • Mashups • Multi-tenancy • Self-Serviced 마이크로 서비스 • Separation of Concerns Successful Serv ice
  • 5. Tenant-specific Customization > Custom Database Schema > S hared Database vs. Shared schema © 2013 uEngineCloud, I nc. Rigid, shared table Extension tabl es Datatype-specifi c pivot tables Private tables Universal tabl e with XML d ocument Universal table Supporting Multi-tenancy 어떤 DB 구조로 설계해야 하나요?
  • 7. Adaptive Object Model 7 http://adaptiveobjectmodel.com • Class Definition model in instance level • Definition can be stored in a XML file or database. • Very Flexible to Extend • Polymorphism for multi- tenant Drawbacks: • Hard to read code • Error-prone
  • 8. Reflection + AOM 8 • Since Java 1.2 • Java Class definition can be accessible with Reflection APIs • For the concrete part, Get the Metadata from Class Definition • For the flexible part, use the AOM
  • 9. Annotation + Reflection + AOM 9 • Since Java 1.5 • Rather use separated XML files, use @ for specifying additional (user-defined) metadata for class definition
  • 10. Supporting Multi-tenancy NoSQL databases 1. Inherent multi-tenancy - Schema Free 2. High Performance - Horizontally scalable and Memory cache 3. Web optimized – Query results are JSON - data can be parsed by web browser directly and performantly. Additionally - 4. Easy to implement Analytic services (MR) and Full Text Search 5. Event-driven Transaction - don't have to care about CQRS something 6. Some NoSQL products (Couchbase, Cassandra) provides pessimistic locking and ANSI SQL (Join Query) - easily migrate to them.
  • 11. DevOps: Issues Continuous Delivery 11 Company Deploy Frequency Deploy Lead Time Reliability Customer Responsiveness Amazon 23,000 / day Minutes High High Google 5,500 / day Minutes High High Netflix 500 / day Minutes High High Facebook 1 / day Hours High High Twitter 3 / week Hours High High Typical enterprise Once every 9 months Months or quarters Low / Medium Low / Medium 출처: 도서 The Phoenix Project Amazon, Google, Netflix, Facebook, Twitter는 얼마나 자주 배포할까요?
  • 12. Monolithic Architecture  모든 서비스가 한번에 재배포  한팀의 반영을 위하여 모든 팀이 대기  지속적 딜리버리가 어려워
  • 13. Micro Service Architecture Contract based, Polyglot Programming  Separation of Concerns, Parallel Development, Easy Outsourcing Written in Java Written in Node Written in PHP
  • 14. Example of Aggregate from different data sources 14
  • 16. Level 0: Swamp of POX • Use as a RPC, returns full serialized document 16 <openSlotList> <slot start = "1400" end = "1450"> <doctor id = "mjones"/> </slot> <slot start = "1600" end = "1650"> <doctor id = "mjones"/> </slot> </openSlotList>
  • 17. Level 1: Resources Level 1 tackles the question of handling complexity by using divide and conquer, breaking a large service endpoint down into multiple resources. 17 <openSlotList> <slot id = "1234" doctor = "mjones" start = "1400" end = " <slot id = "5678" doctor = "mjones" start = "1600" end = " </openSlotList>
  • 18. Level 2: HTTP Verbs Level 2 introduces a standard set of verbs so that we handle similar situations in the same way, removing unnecessary variation. 18 Operation HTTP / REST Create PUT / POST Read (Retrieve) GET Update (Modify) PUT / PATCH Delete (Destroy) DELETE
  • 19. Level 3: Hypermedia Controls 19 <appointment> <slot id = "1234" doctor = "mjones" start = "1400" end = "1450"/> <patient id = "jsmith"/> <link rel = "/linkrels/appointment/cancel" uri = "/slots/1234/appointment"/> <link rel = "/linkrels/appointment/addTest" uri = "/slots/1234/appointment/tests"/> <link rel = "self" uri = "/slots/1234/appointment"/> <link rel = "/linkrels/appointment/changeTime" uri = "/doctors/mjones/slots?date=20100104@status=open"/> <link rel = "/linkrels/appointment/updateContactInfo" uri = "/patients/jsmith/contactInfo"/> <link rel = "/linkrels/help" uri = "/help/appointment"/> </appointment> Level 3 introduces discoverability, providing a way of making a protocol more self-documenting.
  • 20. Micro Service Architecture • 변경된 서비스만 재배포  Side effect 최소화 • 자율성  각 서비스에 대한 자유로운 언어, 아키텍처, 아웃소싱 용이 • 병렬 개발, 타임 투 마켓, 린 개발
  • 22. Micro Service Architecture Design Factor for Front-end One Page N-Screen Responsive Dynamic Real-time
  • 23. Front-end Image Server (Python) Business Logic Server (Java) Extended Role of Front-end in Cloud Applications Aggregator for multiple (polyglot programmed) micro-services Component Service (C) AJAX, RESTful Concurrent Cloud Applications are composed of multiple Micro Services and front-end serves as an aggregator of the services
  • 24. Writing One Page Web App Problems: One Page Web App  Low Cohesion and High Coupling <style> style for A style for B style for C </style> <html> element for A element for B element for C </html> <script> script for A script for B script for C </script>
  • 25. W3C Web Components <style> style for A style for B style for C </style> <html> element for A element for B element for C </html> <script> script for A script for B script for C </script> #A.html <style> style for A </style> <html> element for A </html> <script> script for A </script> #B.html <style> style for B </style> <html> element for B </html> <script> script for B </script> #C.html <style> style for C </style> <html> element for C </html> <script> script for C </script> #index.html <A> <A> <B> <B> <B> <C>
  • 26. Web Components : Implementations • Provides Cohesive Component Model • Component Composition by HTML markup • Dynamic Data Binding • Responsive Web by Material Design • Standard Polymer VueJS
  • 27. IAM (Human) Front-end Service Service API G/W Service Service Stateless 인증, 통합빌링을 위한 IAM Tenant Billing (Machine) Third-party Apps Billing IAM token provider
  • 28. API Gateway (Human) Front-end Servi ce Service API G/W Service Service We need API Gateway for aggregating, forwarding services and exposing composite APIs Tenant-Specific Routing (Machine) Third-party Apps
  • 29. Billing (Human) Front-end Service Service API G/W Service Service We need API Gateway for aggregating, forwarding services and exposing composite APIs Tenant-Specific Billing (Machine) Third-party Apps Billing
  • 30. Example: Auto Insurance - multi-tenancy 30 Java Back-end + RDB (Spring REST/JPA/MySQL) NoSQL (Couchbase Bucket API) Tenant-dataCommon-data
  • 31. Example: Auto Insurance – IAM & API GW 31 Spring REST/JPA/MySQL Couchbase Bucket API API GW • Token Validation • JSON trimming, transformation • Cross Origin Resource Sharing • Adding Hateoas links* IAM Id/pwd JWT token
  • 32. Metaworks4 Open Source SaaS Platform mimicking Salesforce’s Multitenant Kernel www.metaworks4.io
  • 33. Concepts & Backgrounds 도메인 주도 설계 마이크로 서비스 아키텍처 머터리얼 디자인
  • 34. MW4 개발 프로세스 생 성 생 성 • Full-fledged Responsive Web Single Page Application • With google-material design• POJO based Domain Model • Add annotations (JAX-RS, JPA, Jackson, metaworks) • Domain Class Analysis 도메인 클래스 모델링 애노테이 션 UI 컴포넌 트 배치
  • 35. DDD(Domain-Driven Design) - 도메인 주도 설계 • 마이크로서비스를 구현하기에 앞서 설계하기 위해 필요한 유용한 개념 DDD. • 추천 도서 : “Eric Evans의 Domain Driven Design”, 도메인 주도 설계 • DDD에서 얻을 수 있는 해법(책에서 다루는 내용) • 어떤 단위로 서비스를 구성할 것인가 • 서비스의 결합 • 변화에 강한 설계 • 레거시 시스템을 단계적 폐기 • 리팩터링 전략 35 BRIDGING THE WORLDS OF DDD & REST, https://ordina- jworks.github.io/conference/2016/07/10/SpringIO16-DDD-Rest.html https://www.infoq.com/minibooks/domain-driven-design-quickly
  • 36. Domain-Driven Design 1. Using ‘Ubiquitous Language’ so that the domain expert and developer can communicate
  • 37. 37
  • 38. Entity & Value Object  ERD, DB, ORM 38
  • 39. Generate ERD and Entity Classes (ORM) • Open the Class Diagram in the Project Explorer > Diagram Navigator > ClassDiagram • Set the type of attributes – String for most types – boolean for gender – int for options – double for money – java.util.Date for Dates, timestamp • Modeling > ORM > Generate Code • Database Code Generation Options: – Framework: JPA – Persistence API: POJO • Be careful: – All attributes must have its type – All classes should be belong to any package 39
  • 40. Generated Entity Classes (JPA) • All Entity Codes are POJO Classes that are described with Java Annotations meaning entity field descriptions and relationships. 40
  • 41. Repository  REST, JSON 41 Entity PK type
  • 42. Generated REST (Level 3) Service • CRUD • Pagination / Sorting • HATEOAS 42
  • 43. Aggregate  REST 43 # http://www.auto.com:8080/customers [{ ”id" : 1, ”firstName": ’jinyoung', ”lastName": ’jang', "tenantProperties": 'http://mongodb.auto.com:8080/tenantData/td _1'},{...},{...},....] # http://mongodb.auto.com:8080/tenantData/t d_1 { "ext1": 'aaa’, "ext2": 'bbb’ }
  • 44. MW4 Components 44 MW4 Tags IAM&Service Locator Iam-login service-locator Metadata driven UI object-grid object-form Self service portal ssp-class ssp-meta
  • 45. MW4 Components – Vue Material 45 Vue-material Tags Widgets Avatar List Panel Icon ... Layout responsive layout ... “Beautiful construct”
  • 50. Self Service Portal <ssp-class/> 50 필드추가
  • 51. Self Service Portal <ssp-mashup/> 51 default customized
  • 52. The Length of Code 52 323Lines For Developing Full-CRUD, RESTful, MSA-based, Material-Designed, Responsive, Grid+Form, Multi- tenant and Self-Served Application: • Number of fields of the entity: 10 • Total lines of code per an entity: 92 for front-end, 215 for domain class, 16 lines for repository.
  • 53. How it works Common Metadata Domain Model Classes Class model for tenant1 ORM for tenant1 Common class model Metadata of Tenant1 Metadata of Tenant2 Metadata of Tenant3 Class model for tenant2 ORM for tenant2 Class model for tenant3 ORM for tenant3 Override by tenantID
  • 54. Model metadata Front (Vue.js / polymer) REST backend (Spring hateoas) ORM (Spring JPA) Domain Class Developer generates generates generates How it works
  • 55. Model metadata Front (Vue.js / polymer) REST backend (Spring hateoas) ORM (Spring JPA) Domain Class Developer generates generates generates How it works ALPS IETF Standard for metadata
  • 56. Multi-tenant / Self service Support Self service Self service portal • Add new attribute • Attributes can be String, number, Data from referenced class (table) • Change the title, order of attributes • Hide/Show attribute
  • 57. Model metadata Front (Vue.js / polymer) REST backend (Spring hateoas) ORM (Spring JPA) Domain ClassSelf-Service Portal couchbase Tenant Admin Developer overrides Overriding metadata generates generates generates How it works
  • 58. 활용 오픈소스 Vue.js Vue MaterialFront REST Service Persistence
  • 59. 활용 오픈소스 – 2 – for MSA BackEnd 1 IAM API GW BackEnd 2 Billing/ Metering Front OCE-IAM OCE-API-GW OCE-Bill www.opence.org
  • 62. OCE Billing – Open Source Billing https://github.com/TheOpenCloudEngine/uEngine-bill
  • 63. Roadmap • Self Service Portal Tags – ssp-process, ssp-rule • Annotation based HATEOAS Support • CQRS Transaction
  • 64. Roadmap • Self Service Portal Tags – ssp-process, ssp-rule • Annotation based HATEOAS Support • CQRS Transaction Spring REST/JPA/MySQL Couchbase Bucket API API GW consistency
  • 65. Tip: SOA and MSA 65 SOA MSA Aggregation (데이터 통합) Backend 가 주도 Front 가 주도 Database 통합 데이터베이스 서비스 별 데이터베이스 필수 환경 WAS DevOps, PaaS (Grid Engine) 서비스 굵기 업무 비즈니스 기능별 구현 팀별, 10000 라인 이하로?, 관심사별 Container / Packaging WAS / WAR Spring-Boot, Docker
  • 66. Source Code • https://github.com/jinyoung/sw-modeling-example • https://github.com/TheOpenCloudEngine/micro-service- architecture-vuejs • https://github.com/olivergierke/spring-restbucks 66
  • 67. References • Metaworks4 – www.metaworks4.io • SPOSAD Architecture Style - https://pdfs.semanticscholar.org/7635/17ef805f24e64c8bc1b9e221e1 cdbc7ef416.pdf • Rest in Practice, pdf online - https://www.gitbook.com/book/dennis- xlc/rest-in-practice/details • DDD quickly, pdf online – https://www.infoq.com/minibooks/domain-driven-design-quickly • Spring JPA – https://spring.io/guides/gs/accessing-data-jpa/ • Spring JPA and HATEOAS – https://spring.io/guides/gs/accessing-data-rest/ • Mapping JPA entities to external REST resources in spring-data-rest – https://objectpartners.com/2016/02/18/mapping-jpa-entities-to- external-rest-resources-in-spring-data-rest/ • Vue JS with Material Design - https://vuematerial.github.io/#/getting- started 67

Editor's Notes

  • #67: 레가시와의 통합 – Self Service Visual Mashup 에 대한 화면 MSA - DevOps 자동화 퍼포먼스의 최대한의 발휘를 위한 아키텍처 테스트 자동화를 위한 ALPS 의 확대 서비스간의 발견 – Ribbon, By Consulting or By Framework Concourse? 이득을 보는 경우, 실패하는 경우
  • #68: 레가시와의 통합 – Self Service Visual Mashup 에 대한 화면 MSA - DevOps 자동화 퍼포먼스의 최대한의 발휘를 위한 아키텍처 테스트 자동화를 위한 ALPS 의 확대 서비스간의 발견 – Ribbon, By Consulting or By Framework Concourse? 이득을 보는 경우, 실패하는 경우