35
MT Internals … enabling multi-tenant SaaS “in the cloud” Jan Vonka

Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

  • Upload
    j-v

  • View
    456

  • Download
    1

Embed Size (px)

DESCRIPTION

Alfresco DevCon 2012 (Berlin and San Jose) This talk will take a look at the internal workings of core multi-tenancy (MT) in the Alfresco Repository. We will briefly cover how Alfresco has supported MT since Alfresco 3 (including support for dynamic models, workflow, APIs/protocols and Share) and see how it has evolved in Alfresco 4 to support additional features, such as Solr and Activiti, that are required for the Cloud. We will also discuss some key differences between Alfresco core MT and our new Cloud extensions, eg. to support multiple networks, as well as outline where the architecture might head in the future. https://devcon.alfresco.com/sanjose/sessions/alfresco-multi-tenancy-internals-core-mt-repository-alfresco-cloud http://www.youtube.com/watch?v=Xsf79lD0vf4

Citation preview

Page 1: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Internals … enabling multi-tenant SaaS “in the cloud”!

!Jan Vonka!

Page 2: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

•  Jan Vonka - Senior Developer @ Alfresco!

•  Core Repository - Cloud / Hybrid Services!

•  At one time, lived & worked here in the Bay Area!

•  My passion:!

•  Flying hot-air balloons!

•  … once indoors @ Hangar 1, Moffett Field, CA!!

Quick intro!

Page 3: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

Agenda!

•  Multi-Tenant (MT) Overview!

•  MT Core!

•  MT 4.x and “in the cloud”!•  What’s new in Alfresco 4.x ?!•  How does Alfresco “in the cloud” differ ?!

•  Summary and Feedback (Q & A)!

Page 4: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Overview!

Page 5: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Overview!4.x instance – example 1!

DB Content (Shared F/S)

Search (Solr)

Share

Repository (including Transforms)

APIs / Protocols (CMIS, REST, WebDAV, …)

Page 6: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Overview!4.x instance – example 2!

DB DB2 DB1

Content (Shared F/S)

Search nodes Solr2 Solr1 Solr3

Share nodes Sh2 Sh1 Sh3

Repository Cluster R2 R1 R3

Transformer nodes T2 T1 T3

APIs / Protocols (CMIS, REST, WebDAV, …)

Page 7: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Overview!4.x instance – example 3!

Page 8: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Overview !

Content DB Search Index

Alfresco “vanilla” – single-tenant (single instance) !

Alfresco Cluster

Page 9: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

Alfresco – single-tenant (multi-instance)!

MT Overview !

Content DB Search Index

Alfresco Cluster

Content DB Search Index

Alfresco Cluster

Content DB Search Index

Alfresco Cluster

Content DB Search Index

Alfresco Cluster

T1 T2

T3 T4

Page 10: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

Alfresco MT – multi-tenant (single instance)!

MT Overview !

Content DB Search Index

Alfresco Cluster

T1

T2

T3

T4

Page 11: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Overview!

Why use MT ?!!•  Economies of scale!

•  Lower licensing / TCO (Total Cost of Ownership)!

•  Easier to manage!•  Less administrative overhead, easier upgrades!

•  Scale!•  Cloud – multi-tenant SaaS (Software as a Service)!

•  New use-cases!•  Cloud – eg. B2B collaboration (Business-to-Business)!

Page 12: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Overview!

Alfresco has provided multi-tenant option since v3!!•  Single instance / multiple tenants!

•  Each tenant can access logical repo!

•  Full partitioning (isolated tenants)!

•  UIs + APIs / Protocols!

•  Dynamic Models!

Page 13: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core!

Page 14: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core !Repository structure – stores, nodes, associations!!

•  Store -> node hierarchy •  (primary) parent / child assocs •  also

•  secondary child assocs •  peer assocs (source / target)!

!•  Example: workspace://SpaceStore

•  Company Home •  Sites

•  Site1, Site2, … •  User Homes

•  fsmith, jdoe, … •  …

Page 15: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core !Repository structure!!

•  By default, five uniquely named stores •  Live store (workspace://SpacesStore) •  Version2 store (workspace://version2Store) •  Archive store (archive://SpacesStore) •  User store (user://alfrescoUserStore) •  System store (system://system)

!•  See Admin Node Browser (Explorer or Share)

Page 16: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core !MT implementation – tenant context!!

•  Auth (Security) ctx => fully qualified userid •  minimise impact on APIs + support standard protocols

•  myuser@mytenant

•  Internally partitioned by Alfresco “store” •  workspace://SpacesStore

•  workspace://@@mytenant@@SpacesStore

Page 17: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core !MT implementation – tenant context (cont’)!!

•  workspace://SpaceStore (workspace://@@acme.com@@SpacesStore)

•  Company Home •  Sites

•  Site1, Site2, … •  User Homes

•  [email protected], [email protected], …

•  workspace://SpaceStore (workspace://@@ano.co.uk@@SpacesStore)

•  Company Home •  Sites

•  Site1, Site2, … •  User Homes

•  [email protected], [email protected]

Page 18: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core !MT implementation – create tenant!

•  On 1st startup, we “bootstrap” the schema objects •  When creating a tenant, we “import” default data …

•  create tenant-specific stores (x5) •  Live store •  Version2 store •  Archive store •  User store •  System store

•  add to “alf_tenant” table •  Tenant Domain, Enabled/Disabled, Content Root (if not co-mingled)

Page 19: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core !MT implementation – Services vs DAOs!

•  Services / APIs

•  “always” accessed in tenant ctx •  notable exception is QuickShare service

•  public/shared links => no login required

•  Persistence DAOs •  direct use •  in some cases, apply to multiple / all (?) tenants

•  eg. system-wide patches / jobs etc

Page 20: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core !Quick reference … something to review later!!

•  MultiTServiceImpl ß TenantService •  Provides name mangling – injected in various services

•  MultiTAdminServiceImpl ß TenantAdminService •  Manage tenants – create, disable / enable, delete

•  MultiTNodeServiceInterceptor •  example that wraps (intercepts) generic NodeService •  instead of injecting TenantService (or extending)

Page 21: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core!See: node-services-context.xml!!

<bean id="multiTNodeServiceInterceptor" class="org.alfresco.repo.tenant.MultiTNodeServiceInterceptor">! <property name="tenantService">! <ref bean="tenantService" />! </property>!</bean>!!<bean id="mtAwareNodeService" class="org.springframework.aop.framework.ProxyFactoryBean" >! <property name="targetName">! <value>dbNodeService</value>! </property>! <property name="proxyInterfaces">! <list>! <value>org.alfresco.service.cmr.repository.NodeService</value>! </list>! </property>! <property name="interceptorNames">! <list>! <value>multiTNodeServiceInterceptor</value>! </list>! </property>!</bean>!!<bean id="dbNodeService" class="org.alfresco.repo.node.db.DbNodeServiceImpl" init-method="init" >! <!-- … more here … ->!</bean>!

Page 22: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

MT Core !

Other examples …!!

•  Core Services, eg.!•  NodeService -> FileFolderService!•  ContentService!•  SearchService (Lucene + Solr since v4)!•  WorkflowService (JBPM + Activiti since v4)!•  … etc!

•  APIs & Protocols, eg.!•  WebScripts!•  CMIS!•  WebDAV!

Page 23: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

What’s new in Alfresco v4.x ?!

Page 24: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

What’s new in Alfresco v4 !Changes include:

•  Activiti support for MT!•  in addition to JBPM!

•  Solr support for MT!•  “core” tracking, tenant ctx filter, …!

!•  MT pre-configured (enable w/ 1st tenant) !!

•  note: since Enterprise 4.0.2 / Community 4.2.a!

Page 25: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

What’s new in Alfresco v4 !Changes include:

•  Alf_Tenant table!•  replaces attribute list!

•  Common implementation!•  eg. for (tenant-based) caches!

•  Various bug fixes & other related improvements!•  from Cloud release + customer feedback!

Page 26: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

How does Alfresco “in the cloud” differ ?!

Page 27: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

How does Alfresco “in the cloud” differ ? !MT Core 4.x except hosted on AWS and …!!

Search Index (Solr) DB (RDS) Content (S3)

Alfresco Cluster

Page 28: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

How does Alfresco “in the cloud” differ ? !Architecture!

Page 29: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

How does Alfresco “in the cloud” differ ?!

… with Tenant (aka. Network switching)

•  Unlike MT core, cloud allows Tenant switching!•  User has primary tenant!•  Can be invited to secondary tenants!

•  We split Tenant ctx from Auth ctx (see TenantUtil)!•  Share + APIs support tenant switching!

•  via cloud extensions for:!•  Share / Surf!•  WebDAV protocol!•  SharePoint protocol!•  Core Repo APIs – including the new “public API”!

Page 30: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

How does Alfresco “in the cloud” differ ? !Scaling – networks, users, sites, documents, …

•  Hosted Core MT might be “100s” of tenants!•  Cloud supports “100s of thousands” of tenants!

•  over 30000 companies signed up (DG)!

•  Generic improvements get pushed back to core code!

Page 31: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

Futures!

Page 32: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

Futures!Health warning – this slide is speculative J!

•  Driven by both Enterprise and Cloud use-cases!

•  Scaling – scale & partition tiers, as needed!•  SharePoint Protocol!•  Refactor of MT dynamic models (+ CMIS 1.1)!•  More dynamic Share / platform (per-tenant overrides)!•  Public / Private / Hybrid – MT vs ST!•  …!

•  What would you like to see on the list ?!

Page 33: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

Summary!

Page 34: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

Summary!•  MT Core!•  Fully partitioned by tenant context!

•  What’s new in Alfresco 4.x ?!•  Activiti, Solr, … + improvements & bug fixes!

•  How does Alfresco “in the cloud” differ ?!•  Network switching!

•  Please try it out!•  Download latest Community 4.2 …!•  http://wiki.alfresco.com/wiki/Multi-Tenancy!

Page 35: Alfresco Multi-Tenancy: Internals of the Core Repository & Cloud

Thank you J

… Questions & Feedback ?

! !! ! !!

Photo credits: http://www.stonebalancing.com/ !