Anzeige
Anzeige

Más contenido relacionado

Anzeige

Más de uEngine Solutions(20)

Anzeige

Building multi tenancy enterprise applications - quick

  1. Micro-services Architecture Domain-Driven-Design Multi-tenancy DevOps 클라우드 서비스 개발을 위한 마이크로 서비스 아키텍처와 멀티테넌시 적용사례 Jinyoung Jang (jyjang@uengine.org)
  2. 성공적인 서비스들
  3. 성공적 서비스로의 여정 운영자동화 • Business Continuity • Zero-downtime 수익화 • Subscription Business 구현 • Mashups • Multi-tenancy • Self-Serviced 마이크로 서비스 • Separation of Concerns Successful Serv ice
  4. Multi-tenancy Support Self Service
  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 구조로 설계해야 하나요?
  6. Supporting Multi-tenancy Force.com: Multi-tenant Kernel
  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
  15. REST Maturity Model 15
  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 최소화 • 자율성  각 서비스에 대한 자유로운 언어, 아키텍처, 아웃소싱 용이 • 병렬 개발, 타임 투 마켓, 린 개발
  21. Micro Service Architecture Design Factor for Front-end One Page N-Screen Responsive Dynamic Real-time
  22. 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
  23. 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>
  24. 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>
  25. Web Components : Implementations • Provides Cohesive Component Model • Component Composition by HTML markup • Dynamic Data Binding • Responsive Web by Material Design • Standard Polymer VueJS
  26. IAM (Human) Front-end Service Service API G/W Service Service Stateless 인증, 통합빌링을 위한 IAM Tenant Billing (Machine) Third-party Apps Billing IAM token provider
  27. 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
  28. 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
  29. Example: Auto Insurance - multi-tenancy 30 Java Back-end + RDB (Spring REST/JPA/MySQL) NoSQL (Couchbase Bucket API) Tenant-dataCommon-data
  30. 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
  31. Metaworks4 Open Source SaaS Platform mimicking Salesforce’s Multitenant Kernel www.metaworks4.io
  32. Concepts & Backgrounds 도메인 주도 설계 마이크로 서비스 아키텍처 머터리얼 디자인
  33. 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 컴포넌 트 배치
  34. 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
  35. Domain-Driven Design 1. Using ‘Ubiquitous Language’ so that the domain expert and developer can communicate
  36. 37
  37. Entity & Value Object  ERD, DB, ORM 38
  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
  39. Generated Entity Classes (JPA) • All Entity Codes are POJO Classes that are described with Java Annotations meaning entity field descriptions and relationships. 40
  40. Repository  REST, JSON 41 Entity PK type
  41. Generated REST (Level 3) Service • CRUD • Pagination / Sorting • HATEOAS 42
  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’ }
  43. 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
  44. MW4 Components – Vue Material 45 Vue-material Tags Widgets Avatar List Panel Icon ... Layout responsive layout ... “Beautiful construct”
  45. <iam-login/> 46 OAuth2.0 IAM Server Id/pwd Token (expiration: XX) <service-locator/> Set the token
  46. <service-locator/> 47 화면없음 (Headless tag) <service - locator/ > <object- grid/> <object- form/> Backend call call ajax X-Auth-Token
  47. <object-grid/> 48
  48. <object-form/> 49
  49. Self Service Portal <ssp-class/> 50 필드추가
  50. Self Service Portal <ssp-mashup/> 51 default customized
  51. 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.
  52. 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
  53. Model metadata Front (Vue.js / polymer) REST backend (Spring hateoas) ORM (Spring JPA) Domain Class Developer generates generates generates How it works
  54. 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
  55. 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
  56. 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
  57. 활용 오픈소스 Vue.js Vue MaterialFront REST Service Persistence
  58. 활용 오픈소스 – 2 – for MSA BackEnd 1 IAM API GW BackEnd 2 Billing/ Metering Front OCE-IAM OCE-API-GW OCE-Bill www.opence.org
  59. OCE IAM 60
  60. OCE API Gateway
  61. OCE Billing – Open Source Billing https://github.com/TheOpenCloudEngine/uEngine-bill
  62. Roadmap • Self Service Portal Tags – ssp-process, ssp-rule • Annotation based HATEOAS Support • CQRS Transaction
  63. 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
  64. Tip: SOA and MSA 65 SOA MSA Aggregation (데이터 통합) Backend 가 주도 Front 가 주도 Database 통합 데이터베이스 서비스 별 데이터베이스 필수 환경 WAS DevOps, PaaS (Grid Engine) 서비스 굵기 업무 비즈니스 기능별 구현 팀별, 10000 라인 이하로?, 관심사별 Container / Packaging WAS / WAR Spring-Boot, Docker
  65. Source Code • https://github.com/jinyoung/sw-modeling-example • https://github.com/TheOpenCloudEngine/micro-service- architecture-vuejs • https://github.com/olivergierke/spring-restbucks 66
  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

Hinweis der Redaktion

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