The number of online systems that users can rent is growing. Call it SaaS or something else these systems are way harder to build than regular ones. This presentation is technical deep-dive to multi-tenant web applications. It focuses on implementation details and offers ready to use solutions to most common problems.
6. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
The term "software multitenancy" refers to a software architecture in
which a single instance of software runs on a server and serves multiple
tenants.
A tenant is a group of users who share a common access with specific
privileges to the software instance.
With a multitenant architecture, a software application is designed to
provide every tenant a dedicated share of the instance - including its
data, configuration, user management, tenant individual functionality
and non-functional properties.
„Multitenancy“, Wikipedia
What is multitenancy?
8. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
All resources are shared between tenants
Shared model
Tenant 1 Tenant 2
App
hosting
Storage
Tenant 3 Tenant 4
App
hosting
Storage
9. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
Some resources are shared between tenants
Hybrid model
Tenant 1 Tenant 2
App
hosting
StorageStorage
SQL
database
CDN Cache
10. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
No shared resources
Dedicated model
App
hosting
Storage
Data
Tenant 1
App
hosting
Storage
Data
Tenant 2
11. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
• Customer provided environment
• Multi-instance, not multitenant hosting
• Usually special case
On-premises
14. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
• Data structure that defines tenant technically
• Used by multitenant application
• Provided to application externally
Tenant definition
15. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
• Detects current tenant
• Provides other parts of
application with tenant
information
• Multiple
implementations
Tenant provider
ITenantProvider
DbTenantProvider FileTenantProvider
BlobTenantProvider HttpTenantProvider
16. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
• Request middleware
• Handles missing tenants
• Usually redirects to some page
• Don’t throw nasty errors
Missing tenant middleware
17. @ITCAMPRO #ITCAMP18Community Conference for IT Professionals
• Provides correct cache key for model caching
• Defensive CRUD operations
• Checks for cross-tenant operations
• Database provider agnostic
Multitenant DbContext